Opened 15 years ago

Closed 15 years ago

#2005 defect closed fixed (fixed)

trial twisted/mail/ traces back, omitting trailing / does not.

Reported by: Stephen Thorne Owned by:
Priority: highest Milestone:
Component: trial Keywords:
Cc: spiv, therve Branch:
Author:

Description

$ trial twisted/mail/
Traceback (most recent call last):
  File "/Users/stephen/src/Twisted/trunk/bin/trial", line 24, in ?
    run()
  File "/Users/stephen/src/Twisted/trunk/twisted/scripts/trial.py", line 346, in run
    suite = _getSuite(config)
  File "/Users/stephen/src/Twisted/trunk/twisted/scripts/trial.py", line 308, in _getSuite
    return loader.loadByNames(config['tests'], recurse)
  File "/Users/stephen/src/Twisted/trunk/twisted/trial/runner.py", line 429, in loadByNames
    suites = [self.loadAnything(thing, recurse)
  File "/Users/stephen/src/Twisted/trunk/twisted/trial/runner.py", line 398, in loadAnything
    return self.loadPackage(thing, recurse)
  File "/Users/stephen/src/Twisted/trunk/twisted/trial/runner.py", line 364, in loadPackage
    pkgobj = modules.getModule(package.__name__)
  File "/Users/stephen/src/Twisted/trunk/twisted/python/modules.py", line 625, in getModule
    return theSystemPath[moduleName]
  File "/Users/stephen/src/Twisted/trunk/twisted/python/modules.py", line 569, in __getitem__
    pe = PathEntry(
  File "/Users/stephen/src/Twisted/trunk/twisted/python/modules.py", line 525, in _findEntryPathString
    assert rval in self.importerCache, '%r for %r not in import cache %s' % (
AssertionError: 'twisted' for <module '__init__' from 'twisted/mail/__init__.pyc'> not in import cache {'/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4': None,
 '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/': None,
 '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/encodings': None,
 '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/lib-dynload': None,

Change History (10)

comment:1 Changed 15 years ago by Stephen Thorne

Type: enhancementdefect

comment:2 Changed 15 years ago by Jean-Paul Calderone

See also #2489 and #2507

comment:3 Changed 15 years ago by therve

Maybe comes from this:

>>> from twisted.python import reflect
>>> reflect.filenameToModuleName('twisted/test')
'twisted.test'
>>> reflect.filenameToModuleName('twisted/test/')
'twisted.'

comment:4 Changed 15 years ago by spiv

Cc: spiv added
Priority: normalhigh

This is really irritating and confusing, and clearly a regression for earlier versions.

comment:5 Changed 15 years ago by therve

Owner: changed from Jonathan Lange to therve

comment:6 Changed 15 years ago by therve

Cc: therve added
Keywords: review added
Owner: therve deleted
Priority: highhighest

Ready to review in trial-slash-2005.

comment:7 Changed 15 years ago by radix

Keywords: review removed
Owner: set to therve

It'd be niceish if the code that says "if not base:" had a small comment like "# this happens when fn ends with a path separator".

I'm glad you tested it at the trial level too. Thanks for this, please merge.

comment:8 Changed 15 years ago by radix

Oh right, one more thing: please just "import os" instead of "os.path".

comment:9 Changed 15 years ago by therve

Resolution: fixed
Status: newclosed

(In [19823]) Merge trial-slash-2005

Author: therve Reviewer: radix Fixes #2005

Workaround a problem with reflect.filenameToModuleName which cause unexpected behavior with trial: 'trial foo/bar' worked whereas 'trial foo/bar/' didn't. Also, add tests for trial's loader and for reflect.

comment:10 Changed 11 years ago by <automation>

Owner: therve deleted
Note: See TracTickets for help on using tickets.