| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |\ |
|
| | | |
|
| |/ |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
This is kept separately from the reintroduction of 'try_imports' to keep
that patch reasonable.
Signed-off-by: Stephen Finucane <stephen@that.guru>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
```
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
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.
|
| |
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Twisted's IReporter contract doesn't specify `stop` or `shouldStop`.
With this change, we can still meaningfully call `stop()` after adapting
with `ExtendedToOriginalDecorator`.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
| |
were reported.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
StreamSummary was calculating testsRun incorrectly: exists status tests were
counted as run tests, but they are not.
Change-Id: I9581be45e878a4281904e2039dd7790f9bc1a3bb
Closes-Bug: #1203728
|
| |
|
|
| |
Per bug 1188420 this currently completely hides important context.
|
| |
|
|
|
|
| |
The router dispatches packets to another StreamResult based on their
route_code, stripping the matching section. Unroutable events are forwarded to
a fallback stream.
|
| | |
|
| |
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
| |
This permits using code that uses any Python unittest test code
with a StreamResult.
|
| | |
|
| |
|
|
|
|
| |
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).
|
| |
|
|
|
| |
This avoids all of the buffer management and analysis and should be suitable
for most terminal filters.
|
| |
|
|
| |
This allows applying multiple terminal handlers to one stream.
|
| | |
|
| |
|
|
| |
This is intended to prototype the new API for inclusion upstream.
|
| |
|
|
|
|
|
|
|
| |
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)
|
| |
|
|
|
| |
Previously it was advertised in the help but ignored.
(Robert Collins, #1090582)
|
| | |
|
| | |
|
| | |
|
| | |
|