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.

classification
Title: test_unittest crashes loading 'unittest.test.testmock' when run from installed Python
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: michael.foord, ned.deily, python-dev, vinay.sajip
Priority: normal Keywords: patch

Created on 2012-03-22 00:07 by ned.deily, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
Makefile.pre.in.diff vinay.sajip, 2012-03-22 13:34 Suggested change to include testmock directory in installation
Messages (4)
msg156526 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-03-22 00:07
When run from an installed location, rather than from the build directory, test_unittest now crashes:

$ ./root/bin/python3.3 -m test -w -uall,-largefile test_unittest
[1/1] test_unittest
test test_unittest crashed -- Traceback (most recent call last):
  File "/py/dev/default/b10.7_t10.7_x4.2_cclang_d/unix/root/lib/python3.3/test/regrtest.py", line 1236, in runtest_inner
    indirect_test()
  File "/py/dev/default/b10.7_t10.7_x4.2_cclang_d/unix/root/lib/python3.3/test/test_unittest.py", line 8, in test_main
    support.run_unittest(unittest.test.suite())
  File "/py/dev/default/b10.7_t10.7_x4.2_cclang_d/unix/root/lib/python3.3/unittest/test/__init__.py", line 17, in suite
    suite.addTest(loader.loadTestsFromName('unittest.test.testmock'))
  File "/py/dev/default/b10.7_t10.7_x4.2_cclang_d/unix/root/lib/python3.3/unittest/loader.py", line 105, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'testmock'

1 test failed:
    test_unittest
Re-running failed tests in verbose mode
Re-running test 'test_unittest' in verbose mode
test test_unittest crashed -- Traceback (most recent call last):
  File "/py/dev/default/b10.7_t10.7_x4.2_cclang_d/unix/root/lib/python3.3/test/regrtest.py", line 1236, in runtest_inner
    indirect_test()
  File "/py/dev/default/b10.7_t10.7_x4.2_cclang_d/unix/root/lib/python3.3/test/test_unittest.py", line 8, in test_main
    support.run_unittest(unittest.test.suite())
  File "/py/dev/default/b10.7_t10.7_x4.2_cclang_d/unix/root/lib/python3.3/unittest/test/__init__.py", line 17, in suite
    suite.addTest(loader.loadTestsFromName('unittest.test.testmock'))
  File "/py/dev/default/b10.7_t10.7_x4.2_cclang_d/unix/root/lib/python3.3/unittest/loader.py", line 105, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'testmock'
msg156557 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2012-03-22 13:34
This should be fixable using the attached patch.
msg156565 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2012-03-22 14:44
Thanks vinay (and ned). I thought that was the cause of the problem - but glad you diagnosed and fixed it before I had to look into it. Patch looks good to apply.
msg156618 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-03-22 20:35
New changeset 1ec74eeda4e8 by Ned Deily in branch 'default':
Issue #14382: Ensure new unittest.test.testmock is installed.
http://hg.python.org/cpython/rev/1ec74eeda4e8
History
Date User Action Args
2022-04-11 14:57:28adminsetgithub: 58590
2012-03-22 20:36:17ned.deilysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2012-03-22 20:35:22python-devsetnosy: + python-dev
messages: + msg156618
2012-03-22 14:44:13michael.foordsetmessages: + msg156565
2012-03-22 13:34:11vinay.sajipsetfiles: + Makefile.pre.in.diff

type: behavior

keywords: + patch
nosy: + vinay.sajip
messages: + msg156557
stage: needs patch -> patch review
2012-03-22 00:07:17ned.deilycreate