Created
January 27, 2018 02:04
-
-
Save aaronlelevier/eb0155c3aadb4314c3c75544db13e9ee to your computer and use it in GitHub Desktop.
Has friendly test fail header formatting so the test header matches syntax for running a single test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from nose.result import TextTestResult as NoseTextTestResult | |
| class TextTestResult(NoseTextTestResult): | |
| def getDescription(self, test): | |
| """ | |
| Overrides the default test header, so the failed test name | |
| can be copied as is and syntax works to be able to run the | |
| single test "as copied" from this output. | |
| Example: | |
| 'myapp.tests.test_models:MyModelTests.test_foo' | |
| Returns: | |
| str (always) | |
| """ | |
| return '({module}:{test_class}.{test_method})'.format( | |
| module=test.test.__class__.__module__, | |
| test_class=test.test.__class__.__name__, | |
| test_method=test.test._testMethodName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment