This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author michael.foord
Recipients michael.foord
Date 2011-02-10.20:19:07
SpamBayes Score 2.600775e-06
Marked as misclassified No
Message-id <1297369148.53.0.82343889297.issue11178@psf.upfronthosting.co.za>
In-reply-to
Content
Reported by a user and verified by me with both Python 2.7 and 3.2.

Trying to run tests by module or package name seems to fail.

directory structure:

    project root: C:\Users\hpierson\Projects\pytest
        \test
            __init__.py (empty)
            testfoo.py (sample test file

running test package by name - no tests discovered

C:\Users\hpierson\Projects\pytest
PS» cpy C:\Python31\Scripts\unit2.py test

----------------------------------------------------------------------
Ran 0 tests in 0.000s

 

running test module by name - can't find module

C:\Users\hpierson\Projects\pytest
PS» cpy C:\Python31\Scripts\unit2.py test.testfoo
Traceback (most recent call last):
  File "C:\Python31\Scripts\unit2.py", line 7, in <module>
    main_()
  File "C:\Python31\lib\site-packages\unittest2\main.py", line 237, in main_
    main(module=None)
  File "C:\Python31\lib\site-packages\unittest2\main.py", line 94, in __init__
    self.parseArgs(argv)
  File "C:\Python31\lib\site-packages\unittest2\main.py", line 149, in parseArgs
    self.createTests()
  File "C:\Python31\lib\site-packages\unittest2\main.py", line 158, in createTests
    self.module)
  File "C:\Python31\lib\site-packages\unittest2\loader.py", line 133, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "C:\Python31\lib\site-packages\unittest2\loader.py", line 133, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "C:\Python31\lib\site-packages\unittest2\loader.py", line 101, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'testfoo'
History
Date User Action Args
2011-02-10 20:19:08michael.foordsetrecipients: + michael.foord
2011-02-10 20:19:08michael.foordsetmessageid: <1297369148.53.0.82343889297.issue11178@psf.upfronthosting.co.za>
2011-02-10 20:19:07michael.foordlinkissue11178 messages
2011-02-10 20:19:07michael.foordcreate