summaryrefslogtreecommitdiff
path: root/testtools
Commit message (Collapse)AuthorAgeFilesLines
* Prevent AttributeError in TestCase.__eq__Tim Burke2022-11-042-1/+6
| | | | Not all objects have a __dict__ attribute.
* Merge branch 'master' into compound-fixtureJelmer Vernooij2022-07-015-13/+22
|\
| * simplifying codeBen Beecher2022-07-011-3/+1
| |
| * less codeBen Beecher2022-07-011-5/+2
| |
| * Making sure that TestCase can be hashedBen Beecher2022-07-012-0/+11
| |
| * Fix various test failures with Python 3.11Colin Watson2022-07-013-13/+16
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Use CompoundFixture from fixtures>=2.0 rather than rolling our ownColin Watson2022-07-011-16/+2
|/ | | | `fixtures` 2.0 was released in 2016.
* Merge branch 'master' into rm-3.5Hugo van Kemenade2022-06-066-17/+17
|\
| * Fix DeprecationWarning: Only valid in 1.8.1 and earlier. Use skipTest instead.Hugo van Kemenade2022-06-046-8/+8
| |
| * Replace deprecated assertRaisesRegexp with assertRaisesRegexHugo van Kemenade2022-06-041-10/+10
| |
* | Merge branch 'master' into rm-3.5Hugo van Kemenade2022-05-043-9/+13
|\ \ | |/
| * Upgrade asserts with teyit for Python 3.11 compatibilityHugo van Kemenade2022-02-073-33/+37
| |
* | Upgrade Python syntax with pyupgrade --py36-plusHugo van Kemenade2022-02-0726-104/+101
|/
* Fix docstring formatting warnings.Jelmer Vernooij2022-01-241-7/+6
|
* Deprecate distutils integrationStephen Finucane2021-12-131-2/+10
| | | | | | | | We don't want to remove this immediately, but we should try to do so sooner rather than later. Signed-off-by: Stephen Finucane <stephen@that.guru> Closes: #316
* Add support for Python 3.10Jürgen Gmach2021-10-141-1/+4
|
* Update testtools/compat.pyMatthew Treinish2021-07-141-2/+1
|
* Merge branch 'master' into 310_retrocompatibilityMatthew Treinish2021-07-142-1/+3
|\
| * Fix for Python 3.10Hugo van Kemenade2021-06-261-0/+2
| |
| * Fix tests with Python 3.10Cyril Roelandt2021-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Python 3, error messages have become a bit more precise. For instance, the following code snippet: ---- class Foo(): def bar(self, a): pass try: Foo().bar(1, 2) except TypeError as e: print(e) ---- will return: - in Python 3.9: "bar() takes 2 positional arguments but 3 were given" - in Python 3.10: "Foo.bar() takes 2 positional arguments but 3 were given" Fix our tests accordingly.
* | testtools.compat: provide BytesIO, StringIO againMatthieu Huin2021-06-161-0/+4
|/ | | | | This allows projects dependent on testtools.compat some respite if they haven't been updated for python 3.10 yet.
* Merge branch 'master' into public_samemembersMatthew Treinish2021-03-0861-1183/+1007
|\
| * Remove mimeparse dependencyStephen Finucane2021-02-251-7/+19
| | | | | | | | | | | | We can do this ourselves quite easily. Signed-off-by: Stephen Finucane <stephen@that.guru>
| * trivial: Cleanup importsStephen Finucane2021-02-2512-103/+77
| | | | | | | | | | | | | | 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-2514-18/+60
| | | | | | | | | | | | | | | | | | | | | | | | 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-257-32/+15
| | | | | | | | | | | | | | | | 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-257-32/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Merge branch 'master' into remove-unittest2Matthew Treinish2020-12-032-3/+3
| |\
| | * Merge branch 'master' into masterMatthew Treinish2020-12-0258-980/+821
| | |\
| | * | Update testtools/content.py Matthew Treinish2020-12-021-1/+1
| | | | | | | | | | | | Co-Authored-By: Jelmer Vernooij <jelmer@jelmer.uk>
| | * | Update content.pypvinci2019-11-101-1/+1
| | | |
| | * | Update _warnings.pypvinci2019-11-101-2/+2
| | | |
| * | | Merge branch 'master' into remove-unittest2Matthew Treinish2020-11-172-7/+1
| |\ \ \ | | | |/ | | |/|
| | * | Drop traceback2 in favor of traceback and remove unused linecache2Chih-Hsuan Yen2020-08-242-7/+1
| | | |
| * | | restore testtools/tests/test_testcase.pyFederico Ressi2020-07-101-11/+0
| | | |
| * | | Remove unittest2 from setup.cfg and add tox.ini fileFederico Ressi2020-07-101-0/+11
| | | |
| * | | Remove unrelated changeFederico Ressi2020-07-101-1/+0
| | | |
| * | | Restore test_spinner.pyFederico Ressi2020-07-101-2/+2
| | | |
| * | | Merge branch 'remove-unittest2' into drop-unittest2Federico Ressi2020-07-102-3/+2
| |\ \ \
| | * \ \ Merge remote-tracking branch 'origin/master' into remove-unittest2Matthew Treinish2020-07-081-0/+3
| | |\ \ \ | | | |/ /
| | * | | Update testtools/testcase.pyMatthew Treinish2020-07-081-17/+1
| | | | | | | | | | | | | | | Co-authored-by: Thomas Grainger <tagrain@gmail.com>
| | * | | Remove stray six importMatthew Treinish2020-04-051-1/+0
| | | | |
| | * | | Merge branch 'master' into remove-unittest2Matthew Treinish2020-04-0458-965/+804
| | |\ \ \
| | * \ \ \ Merge branch 'master' into remove-unittest2Jelmer Vernooij2019-11-283-10/+15
| | |\ \ \ \
| | * | | | | Remove unittest2 usage from testtoolsMatthew Treinish2019-05-038-26/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently testtools bases all of it's unittest extensions off of unittest2 instead of the stdlib unittest. At one point this made sense since unittest2 provided a stable base as unittest in stdlib added features. But it's been ~5 years since there was a unittest2 release (or a patch merged) and things have changed since then. The best example of this is of the supported python versions listed in the unittest2 project description/README only one is still supported by upstream python, 2.7, which goes end of life at the end of this year. More specific to testtools the use of unittest2 causes a whole slew of issues because of differences in behavior with stdlib unittest. For example here a couple issues encountered: https://bugs.launchpad.net/testtools/+bug/1467558 https://bugs.launchpad.net/testtools/+bug/1417803 mtreinish/stestr#238 testing-cabal/testtools#272 which are caused, at least in part, by unittest2. There are likely other bugs related to it that haven't been reported (or I just missed/forgot about). At this point it's better to remove the unittest2 usage and just rely on the upstream stdlib unittest which if nothing else is actively maintained. It'll improve compatibility using the testtools runner with stdlib unittest test suites and removes the class of bugs caused by the differences in unittest2. Fixes #263
| * | | | | | Remove unused try_importFederico Ressi2020-07-102-5/+3
| | | | | | |
| * | | | | | Compare items using sets instead of sequencesFederico Ressi2020-07-092-17/+2
| | | | | | |
| * | | | | | Add implementation for legacy assertItemsEqual existing in unittest2 libraryFederico Ressi2020-07-091-0/+15
| | | | | | |
| * | | | | | Do actually remove all references to unittest2 libraryFederico Ressi2020-07-098-28/+16
| | |_|_|/ / | |/| | | |
| * | | | | 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 ```