#24548 closed Bug (wontfix)
A testrunner test fails with unittest2 installed
| Reported by: | David D. Riddle | Owned by: | nobody |
|---|---|---|---|
| Component: | Testing framework | Version: | 1.6 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
RHEL6 system with Python 2.7.5
ddriddle@sdg-py27-dev:~/tmp/Django-1.6.11/tests$ python ./runtests.py --settings=test_sqlite -v0
======================================================================
ERROR: test_dotted_test_method_vanilla_unittest (test_runner.test_discover_runner.DiscoverRunnerTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/services/scratch/ddriddle/tmp/Django-1.6.11/tests/test_runner/test_discover_runner.py", line 57, in test_dotted_test_method_vanilla_unittest
["test_discovery_sample.tests_sample.TestVanillaUnittest.test_sample"],
File "/opt/cites-sdg/sdg_2015a_python27/root/usr/lib/python2.7/site-packages/django/test/runner.py", line 63, in build_suite
tests = self.test_loader.loadTestsFromName(label)
File "/opt/rh/python27/root/usr/lib/python2.7/site-packages/unittest2/loader.py", line 219, in loadTestsFromName
test = obj()
TypeError: unbound method test_sample() must be called with TestVanillaUnittest instance as first argument (got nothing instead)
Debian 7.8 with Python 2.7.3
ddriddle@rockband:~/src/Django-1.6.11/tests$ python ./runtests.py --settings=test_sqlite -v0 test_runner
----------------------------------------------------------------------
Ran 31 tests in 0.770s
OK
ddriddle@rockband:~/src/Django-1.6.11/tests$ easy_install -U --user unittest2
ddriddle@rockband:~/src/Django-1.6.11/tests$ python ./runtests.py --settings=test_sqlite -v0 test_runner
======================================================================
ERROR: test_dotted_test_method_vanilla_unittest (test_runner.test_discover_runner.DiscoverRunnerTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/ddriddle/src/Django-1.6.11/tests/test_runner/test_discover_runner.py", line 57, in test_dotted_test_method_vanilla_unittest
["test_discovery_sample.tests_sample.TestVanillaUnittest.test_sample"],
File "/home/ddriddle/.local/lib/python2.7/site-packages/django/test/runner.py", line 63, in build_suite
tests = self.test_loader.loadTestsFromName(label)
File "/home/ddriddle/.local/lib/python2.7/site-packages/unittest2-1.0.1-py2.7.egg/unittest2/loader.py", line 219, in loadTestsFromName
test = obj()
TypeError: unbound method test_sample() must be called with TestVanillaUnittest instance as first argument (got nothing instead)
----------------------------------------------------------------------
Ran 31 tests in 0.827s
FAILED (errors=1)
This bug only happens when unitest2 is installed. I tested this on RHEL6 with Python 2.7.5 and Debian 7.8 with Python 2.7.3. The Django version used in both cases was Django 1.6.11. This bug is related to ticket 20437.
Change History (3)
comment:1 by , 11 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
comment:2 by , 11 years ago
I did some further testing and this bug does not exist in master or 1.7.x.
comment:3 by , 11 years ago
I created a fix for this issue. I know it will not be merged in but I am documenting this fix for others that might find it helpful. The patch can be found here: https://github.com/ddriddle/django/tree/ticket_24548
Django 1.6 is only receiving security fixes at this point.