summaryrefslogtreecommitdiff
path: root/testtools/tests/test_testresult.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix various test failures with Python 3.11Colin Watson2022-07-011-10/+13
| | | | | | | | | | | The changes for https://peps.python.org/pep-0657/ require a number of changes in our tests. Some tests still fail due to https://twistedmatrix.com/trac/ticket/10336, so I'm not adding 3.11 to the test matrix yet. Fixes #325.
* Merge branch 'master' into rm-3.5Hugo van Kemenade2022-06-061-3/+3
|\
| * Fix DeprecationWarning: Only valid in 1.8.1 and earlier. Use skipTest instead.Hugo van Kemenade2022-06-041-3/+3
| |
* | Upgrade Python syntax with pyupgrade --py36-plusHugo van Kemenade2022-02-071-1/+0
|/
* Add support for Python 3.10Jürgen Gmach2021-10-141-1/+4
|
* Fix for Python 3.10Hugo van Kemenade2021-06-261-0/+2
|
* trivial: Cleanup importsStephen Finucane2021-02-251-4/+3
| | | | | | | This is kept separately from the reintroduction of 'try_imports' to keep that patch reasonable. Signed-off-by: Stephen Finucane <stephen@that.guru>
* Re-introduce 'try_imports'Stephen Finucane2021-02-251-1/+1
| | | | | | | | | | | | There are few if any people still (knowingly) using the 'extras' lib. OpenStack users have their own implementation (sigh) in 'oslo.utils' and everyone else is getting by with try-except statements. Reintroduce this utility to 'testtools.helpers', allowing us to eventually drop the dependency on extras. Note however that we can't actually do this yet since 'fixtures' has an implicit dependency on 'extras' through 'testtools', and we break that by removing it here. Signed-off-by: Stephen Finucane <stephen@that.guru>
* Remove use of 'try_imports'Stephen Finucane2021-02-251-3/+4
| | | | | | | | This was being used in places to handle differences between Python 2 and Python 3. Since we only care about the latter now, the utility can be removed. Signed-off-by: Stephen Finucane <stephen@that.guru>
* Remove use of 'safe_hasattr'Stephen Finucane2021-02-251-2/+2
| | | | | | | | | | | | | This was used to workaround some issues with 'hasattr' on Python 2.x versions, discussed in the source for extras (where this utility was moved to make it more useful to others) [1] and elsewhere on the internet [2]. These issues are no longer present on the versions of Python we now support (Python 3.6+) so this is no longer necessary. [1] https://github.com/testing-cabal/extras/blob/1.0.0/extras/__init__.py#L101-L108 [2] https://hynek.me/articles/hasattr/ Signed-off-by: Stephen Finucane <stephen@that.guru>
* Fix syntax error test for Python 3.9Michel Alexandre Salim2020-05-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Python 3.9 the zero-width no-break space Unicode character U+FEFF does not get printed in syntax errors. See: https://bugzilla.redhat.com/show_bug.cgi?id=1831126 This is reproducible in a virtual environment as well. Before: ``` .venv ❯ make check PYTHONPATH=/home/michel/src/github/testing-cabal/testtools python -m testtools.run testtools.tests.test_suite /usr/lib64/python3.9/runpy.py:127: RuntimeWarning: 'testtools.run' found in sys.modules after import of package 'testtools', but prior to execution of 'testtools.run'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) Tests running... ====================================================================== FAIL: testtools.tests.test_testresult.TestNonAsciiResults.test_syntax_error_line_utf_8 ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/michel/src/github/testing-cabal/testtools/testtools/tests/test_testresult.py", line 2744, in test_syntax_error_line_utf_8 self.assertThat( File "/home/michel/src/github/testing-cabal/testtools/testtools/testcase.py", line 499, in assertThat raise mismatch_error testtools.matchers._impl.MismatchError: 'Tests running...\n======================================================================\nERROR: test_syntax_error_line_utf_8.Test.runTest\n----------------------------------------------------------------------\nTraceback (most recent call last):\n File "/tmp/TestNonAsciiResultsblblh75h/test_syntax_error_line_utf_8.py", line 6, in runTest\n import bad\n File "/tmp/TestNonAsciiResultsblblh75h/bad.py", line 1\n \ufeff^ = 0 # paɪθən\n ^\nSyntaxError: invalid syntax\n\nRan 1 test in 0.001s\nFAILED (failures=1)\n' does not match /.*bad.py", line 1\n\s*\^ = 0 # pa\u026a\u03b8\u0259n\n \s*\^\nSyntaxError:.*/ ====================================================================== FAIL: testtools.tests.test_testresult.TestNonAsciiResultsWithUnittest.test_syntax_error_line_utf_8 ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/michel/src/github/testing-cabal/testtools/testtools/tests/test_testresult.py", line 2744, in test_syntax_error_line_utf_8 self.assertThat( File "/home/michel/src/github/testing-cabal/testtools/testtools/testcase.py", line 499, in assertThat raise mismatch_error testtools.matchers._impl.MismatchError: 'E\n======================================================================\nERROR: runTest (test_syntax_error_line_utf_8.Test)\ntest_syntax_error_line_utf_8.Test.runTest\n----------------------------------------------------------------------\ntesttools.testresult.real._StringException: Traceback (most recent call last):\n File "/tmp/TestNonAsciiResultsWithUnittest_zzswpmj/test_syntax_error_line_utf_8.py", line 6, in runTest\n import bad\n File "/tmp/TestNonAsciiResultsWithUnittest_zzswpmj/bad.py", line 1\n \ufeff^ = 0 # paɪθən\n ^\nSyntaxError: invalid syntax\n\n\n----------------------------------------------------------------------\nRan 1 test in 0.000s\n\nFAILED (errors=1)\n' does not match /.*bad.py", line 1\n\s*\^ = 0 # pa\u026a\u03b8\u0259n\n \s*\^\nSyntaxError:.*/ Ran 2627 tests in 0.569s FAILED (failures=2) make: *** [Makefile:7: check] Error 1 ``` After: ``` .venv ❯ make check PYTHONPATH=/home/michel/src/github/testing-cabal/testtools python -m testtools.run testtools.tests.test_suite /usr/lib64/python3.9/runpy.py:127: RuntimeWarning: 'testtools.run' found in sys.modules after import of package 'testtools', but prior to execution of 'testtools.run'; this may result in unpredictable behaviour warn(RuntimeWarning(msg)) Tests running... Ran 2627 tests in 0.492s OK ```
* Drop support for EOL Python 2.7Hugo2020-01-181-7/+2
|
* Upgrade Python syntax with pyupgrade --py3-plusHugo2020-01-181-8/+8
|
* Remove redundant Python 2 compatability codeHugo2020-01-181-61/+50
|
* Upgrade Python syntax with pyupgradeHugo2020-01-181-68/+68
|
* Extra space expected in PyPy outputHugo2019-11-251-1/+6
|
* Drop support for EOL Python 3.3Hugo2018-05-031-1/+1
|
* Spelling fixes (#261)Ville Skyttä2017-05-291-3/+3
|
* Add ResourcedToStreamDecorator test result decorator for testresources ↵Free Ekanayaka2017-04-111-2/+75
| | | | | integration (#243) This new decorator implements the TestResult protocol extension supported by test resources. For example, tt makes it possible to easily have resource-related events streamed to subunit.
* Don't add file details without content (#252)Thomas Hervé2017-02-081-0/+12
| | | | | In the test record API, skip adding file details to the record if there are not bytes. This reduces that amount of data kept when there is none.
* Support TestResults without stop/shouldStopJonathan Lange2016-02-041-15/+27
| | | | | | Twisted's IReporter contract doesn't specify `stop` or `shouldStop`. With this change, we can still meaningfully call `stop()` after adapting with `ExtendedToOriginalDecorator`.
* Remove VWSJonathan Lange2015-11-061-3/+0
|
* Lint clear-upJonathan Lange2015-11-021-5/+15
|
* Fix output of empty attachments.Robert Collins2015-03-101-0/+47
| | | | | | | | | Empty attachments to tests were triggering a file payload of None in the ``ExtendedToStreamDecorator`` code, which caused multiple copies of attachments that had been output prior to the empty one. (Robert Collins, #1378609) Change-Id: I34a989546d57b245d4384b8c5b6d444e7ce0ac1b
* Overhaul exception reporting.Robert Collins2015-03-101-15/+28
| | | | | | | | | | | unittest2 recently added the ability to show local variables in tracebacks as https://github.com/testing-cabal/testtools/issues/111 requested for us. Reusing that requires some refactoring of our code, in particular where we were reimplementing bits of the traceback module. Now we can just hard-depend on traceback2 and linecache2 which are brought in by unittest2 1.0.0. Change-Id: Ieb3268029d26b48ed4fcd25ed644bd339f6aa3fb
* Fix unit tests which failed under pypy due to a change in the way tracebacks ↵Thomi Richards2014-10-151-14/+25
| | | | were reported.
* Remove Python 2.4 deprecation warning special-casing.Daniel Watkins2013-12-031-8/+0
|
* Remove (always skipped) test for string exceptions.Daniel Watkins2013-12-031-9/+0
|
* Remove another Python 2.4 special case.Daniel Watkins2013-12-031-1/+1
|
* Remove trailing whitespace.Daniel Watkins2013-12-031-1/+1
|
* Fix StreamSummary counting of testsRun.Robert Collins2013-11-051-1/+2
| | | | | | | | StreamSummary was calculating testsRun incorrectly: exists status tests were counted as run tests, but they are not. Change-Id: I9581be45e878a4281904e2039dd7790f9bc1a3bb Closes-Bug: #1203728
* Disable hiding internal frames within user frames.Robert Collins2013-06-161-0/+1
| | | | Per bug 1188420 this currently completely hides important context.
* Add a StreamResult Router.Robert Collins2013-04-031-0/+146
| | | | | | The router dispatches packets to another StreamResult based on their route_code, stripping the matching section. Unroutable events are forwarded to a fallback stream.
* Add a StreamResult safe for use in threaded/concurrent code.Robert Collins2013-03-201-1/+59
|
* Add a timestamping StreamResult.Robert Collins2013-03-181-0/+33
| | | | | | This allows event generators to ignore the timestamp field, it can be added into the stream - as long as it is before any buffering/queueing/blocking occur it will be accurate enough.
* Add StreamTagger, for tagging StreamResult events.Robert Collins2013-03-161-0/+46
|
* Add an adapter to adapt StreamResult event streams into ExtendedTestResult.Robert Collins2013-03-161-0/+16
| | | | | | This permits running existing tools like test runners and reporters with StreamResult generating test runs adapting any unittest or testtools compatible TestResult into a StreamResult.
* Add an adapter to convert ExtendedTestResult to StreamResult.Robert Collins2013-03-151-0/+64
| | | | | This permits using code that uses any Python unittest test code with a StreamResult.
* Add a dedicated interface for controlling an in-progress TestRun.Robert Collins2013-03-141-0/+60
|
* Add StreamSummary to generate summary statistics and capture failures.Robert Collins2013-03-121-0/+157
| | | | | | This is equivalent the to behaviour in the TestResult class, but split into a dedicated helper (so that decorators and the like don't need to waste cycles generating them).
* Provide a loosely typed buffer layer for simple processing of completed tests.Robert Collins2013-03-121-0/+94
| | | | | This avoids all of the buffer management and analysis and should be suitable for most terminal filters.
* Adds a CopyStreamResult which copies StreamResult events to multiple outputs.Robert Collins2013-03-091-0/+40
| | | | This allows applying multiple terminal handlers to one stream.
* Adds a recording StreamResult for writing tests with.Robert Collins2013-03-081-0/+43
|
* This defines a new sort of TestResult, StreamResult.Robert Collins2013-03-071-0/+64
| | | | This is intended to prototype the new API for inclusion upstream.
* * Testtools now depends on extras, a small library split out from it to containRobert Collins2013-01-181-1/+2
| | | | | | | | | generally useful non-testing facilities. Since extras has been around for a couple of testtools releases now, we're making this into a hard dependency of testtools. (Robert Collins) * Testtools now uses setuptools rather than distutils so that we can document the extras dependency. (Robert Collins)
* * ``testtools.run`` now supports the ``-f`` or ``--failfast`` parameter.Robert Collins2012-12-161-0/+55
| | | | | Previously it was advertised in the help but ignored. (Robert Collins, #1090582)
* Address mgz's comment.Jonathan Lange2012-10-191-5/+3
|
* Broaden the check to include PermissionError.Jonathan Lange2012-10-191-6/+8
|
* Fix all of the cosmetic Python 3.3 failures.Jonathan Lange2012-10-191-8/+16
|
* Fix some tests to account for new py3k quirksMartin2012-07-271-1/+3
|