Opened 6 years ago

Last modified 3 years ago

#8267 defect new

— at Can not import twisted.trial.reporter without first importing unittest (or some other class)Version 2

Reported by: alex---- Owned by:
Priority: normal Milestone:
Component: trial Keywords: tests
Cc: Jonathan Lange Branch:
Author:

Description (last modified by Thijs Triemstra)

Looks like importing reporter imports unittest, which imports _asyncrunner which import reporter which is not going to be possible while trying to import reporter.

You can work around the issue by importing unittest first (which imports _asyncrunner which imports reporter.

This was not the case in earlier versions of twisted. I am seeing it in version 16.0.0 of twisted.

>>> from twisted.trial import reporter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/twisted/trial/reporter.py", line 29, in <module>
    from twisted.trial.unittest import makeTodo
  File "/usr/local/lib/python2.7/dist-packages/twisted/trial/unittest.py", line 16, in <module>
    from twisted.trial._asyncrunner import (
  File "/usr/local/lib/python2.7/dist-packages/twisted/trial/_asyncrunner.py", line 16, in <module>
    from twisted.trial import itrial, reporter
ImportError: cannot import name reporter
>>> from twisted.trial import unittest
>>> from twisted.trial import reporter
>>>

Change History (2)

comment:1 Changed 6 years ago by DefaultCC Plugin

Cc: Jonathan Lange added

comment:2 Changed 6 years ago by Thijs Triemstra

Description: modified (diff)

fixing markup

Note: See TracTickets for help on using tickets.