Opened 5 years ago

Closed 5 years ago

#8972 defect closed wontfix (wontfix)

`trial ...` and `python -m twisted.trial ...` result in significantly divergent `sys.path` values

Reported by: Jean-Paul Calderone Owned by: Craig Rodrigues
Priority: normal Milestone:
Component: trial Keywords:
Cc: Branch:


(trialtest) exarkun@baryon:/tmp/trialthing$ trial --version
Twisted version: 16.6.0dev0
(trialtest) exarkun@baryon:/tmp/trialthing$ cat
import sys
import pprint


(trialtest) exarkun@baryon:/tmp/trialthing$ echo ${PYTHONPATH}

(trialtest) exarkun@baryon:/tmp/trialthing$ trial test_thing
test_thing ...                                                          [ERROR]

Traceback (most recent call last):
  File "/home/exarkun/Projects/twisted/src/twisted/trial/", line 602, in loadByNames
  File "/home/exarkun/Projects/twisted/src/twisted/trial/", line 406, in findByName
    return reflect.namedAny(name)
  File "/home/exarkun/Projects/twisted/src/twisted/python/", line 306, in namedAny
    raise ModuleNotFound("No module named %r" % (name,))
twisted.python.reflect.ModuleNotFound: No module named 'test_thing'

Ran 1 tests in 0.012s

FAILED (errors=1)
(trialtest) exarkun@baryon:/tmp/trialthing$ python -m twisted.trial test_thing


(trialtest) exarkun@baryon:/tmp/trialthing$ 

I can't quite find an explicit statement that the change of behavior to trial to exclude "" from sys.path was intentional - but I did find which discusses the parallel change in twistd and suggests it was intentional (or at least accidental but then desired).

In this case, making twistd -m twisted.trial ... agree with the desired behavior seems to make more sense than allowing the two to diverge, with the new (presumably desirable) version having the old (apparently undesirable) behavior.

Change History (6)

comment:1 Changed 5 years ago by Jean-Paul Calderone

Apparently this was discussed, perhaps on IRC, and the decision was made that not putting pwd in sys.path is the right thing to do.

It would be nice if someone involved in the discussion documented that rationale, though.

comment:2 Changed 5 years ago by Glyph

#8978 was a duplicate of this.

comment:3 Changed 5 years ago by Julian Berman

Owner: set to Craig Rodrigues

comment:4 Changed 5 years ago by Julian Berman

Keywords: review added

comment:5 Changed 5 years ago by Julian Berman

Keywords: review removed

comment:6 Changed 5 years ago by Julian Berman

Resolution: wontfix
Status: newclosed

At least one part of the rationale is in

Closing this out given that it sounds like consensus is to leave as-is.

Note: See TracTickets for help on using tickets.