Movatterモバイル変換


[0]ホーム

URL:


homepage

Message224907

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Authormartin.panter
Recipientsdocs@python, martin.panter
Date2014-08-06.05:00:02
SpamBayes Score-1.0
Marked as misclassifiedYes
Message-id<1407301202.17.0.719208246986.issue22153@psf.upfronthosting.co.za>
In-reply-to
Content
The documentation for "unittest.TestCase" says "the standard implementation of the default 'methodName', runTest(), will run every method starting with 'test' as an individual test". However:>>> from unittest import *>>> class Test(TestCase):...     def test_method(self): pass... >>> t = Test()>>> t.run()Traceback (most recent call last):  File "<stdin>", line 1, in <module>  File "/usr/lib/python3.4/unittest/case.py", line 552, in run    testMethod = getattr(self, self._testMethodName)AttributeError: 'Test' object has no attribute 'runTest'After further experimentation, I see that if my test method is called "runTest", it can be automatically discovered, but only if there are no other test- prefixed methods.Perhaps you could drop the end of the second paragraph for TestCase, so that it just reads:Each instance of TestCase will run a single base method: the method named "methodName".I think the details about the test- prefix and counting results are covered elsewhere, and in most uses you wouldn't instantiate a TestCase yourself, so changing the method name is irrelevant.Also, perhaps under "TestLoader.loadTestsFromTestCase" it should say:If no methods with the usual name prefix are found, but the "runTest" method is implemented, there will be a single test case using that method.
History
DateUserActionArgs
2014-08-06 05:00:02martin.pantersetrecipients: +martin.panter,docs@python
2014-08-06 05:00:02martin.pantersetmessageid: <1407301202.17.0.719208246986.issue22153@psf.upfronthosting.co.za>
2014-08-06 05:00:02martin.panterlinkissue22153 messages
2014-08-06 05:00:02martin.pantercreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp