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)Initial Version

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


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/", line 29, in <module>

from twisted.trial.unittest import makeTodo

File "/usr/local/lib/python2.7/dist-packages/twisted/trial/", line 16, in <module>

from twisted.trial._asyncrunner import (

File "/usr/local/lib/python2.7/dist-packages/twisted/trial/", 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 (0)

Note: See TracTickets for help on using tickets.