allmydata/__init__.py has surprising side-effects #2931

Closed
opened 2018-06-18 14:41:49 +00:00 by exarkun · 1 comment

I can't explain what's going on yet but I'm fairly sure that whatever it is, it is bad and should be fixed:

$ python -c 'from twisted.trial._dist.workerreporter import *'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "local/lib/python2.7/site-packages/twisted/trial/_dist/workerreporter.py", line 15, in <module>
    from twisted.trial.reporter import TestResult
  File "local/lib/python2.7/site-packages/twisted/trial/reporter.py", line 29, in <module>
    from twisted.trial.unittest import makeTodo
  File "local/lib/python2.7/site-packages/twisted/trial/unittest.py", line 16, in <module>
    from twisted.trial._asyncrunner import (
  File "local/lib/python2.7/site-packages/twisted/trial/_asyncrunner.py", line 16, in <module>
    from twisted.trial import itrial, reporter
ImportError: cannot import name reporter
$ python -c 'import allmydata; from twisted.trial._dist.workerreporter import *'
$

Supposition: An import of allmydata should have no observable consequences for a subsequent import of any twisted module (or, arguably, any module outside of allmydata).

I can't explain what's going on yet but I'm fairly sure that whatever it is, it is bad and should be fixed: ``` $ python -c 'from twisted.trial._dist.workerreporter import *' Traceback (most recent call last): File "<string>", line 1, in <module> File "local/lib/python2.7/site-packages/twisted/trial/_dist/workerreporter.py", line 15, in <module> from twisted.trial.reporter import TestResult File "local/lib/python2.7/site-packages/twisted/trial/reporter.py", line 29, in <module> from twisted.trial.unittest import makeTodo File "local/lib/python2.7/site-packages/twisted/trial/unittest.py", line 16, in <module> from twisted.trial._asyncrunner import ( File "local/lib/python2.7/site-packages/twisted/trial/_asyncrunner.py", line 16, in <module> from twisted.trial import itrial, reporter ImportError: cannot import name reporter $ python -c 'import allmydata; from twisted.trial._dist.workerreporter import *' $ ``` Supposition: An import of `allmydata` should have no observable consequences for a subsequent import of any `twisted` module (or, arguably, any module outside of `allmydata`).
exarkun added the
unknown
normal
defect
1.12.1
labels 2018-06-18 14:41:49 +00:00
exarkun added this to the undecided milestone 2018-06-18 14:41:49 +00:00
Author

This seems to be down to the difference between:

python -c 'from twisted.trial._dist.workerreporter import *'

and

python -c 'import twisted.trial.unittest; from twisted.trial._dist.workerreporter import *'

Therefore, this is really a Twisted problem and Tahoe-LAFS is just feelings the effects of it.

This seems to be down to the difference between: > python -c 'from twisted.trial._dist.workerreporter import *' and > python -c 'import twisted.trial.unittest; from twisted.trial._dist.workerreporter import *' Therefore, this is really a Twisted problem and Tahoe-LAFS is just feelings the effects of it.
exarkun added the
somebody else's problem
label 2018-08-01 14:41:58 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#2931
No description provided.