summaryrefslogtreecommitdiff
path: root/testtools/tests/test_testcase.py
Commit message (Collapse)AuthorAgeFilesLines
* Prevent AttributeError in TestCase.__eq__Tim Burke2022-11-041-0/+5
| | | | Not all objects have a __dict__ attribute.
* Making sure that TestCase can be hashedBen Beecher2022-07-011-0/+4
|
* Merge branch 'master' into rm-3.5Hugo van Kemenade2022-06-061-10/+10
|\
| * Fix DeprecationWarning: Only valid in 1.8.1 and earlier. Use skipTest instead.Hugo van Kemenade2022-06-041-1/+1
| |
| * Replace deprecated assertRaisesRegexp with assertRaisesRegexHugo van Kemenade2022-06-041-10/+10
| |
* | Merge branch 'master' into rm-3.5Hugo van Kemenade2022-05-041-6/+8
|\ \ | |/
| * Upgrade asserts with teyit for Python 3.11 compatibilityHugo van Kemenade2022-02-071-8/+10
| |
* | Upgrade Python syntax with pyupgrade --py36-plusHugo van Kemenade2022-02-071-7/+7
|/
* Merge branch 'master' into rm-2Hugo van Kemenade2020-03-191-0/+87
|\
| * Allow skip/skipIf/skipUnless as class decoratorsZane Bitter2018-11-191-0/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In unittest/unittest2 the skip/skipIf/skipUnless decorators can be used to decorate either individual test methods or entire TestCase classes. However, the testtools equivalents could previously only be used to decorate test methods. If used on a TestCase the class would be replaced with a function, resulting in the tests either not be discovered at all or (if a custom test loader was used) potentially an error. This change allows the skip decorators to be used on the TestCase subclass, for equivalent functionality with unittest. Fixes #205 Signed-off-by: Zane Bitter <zbitter@redhat.com>
| * Get rid of Python 2.4 support from skip decoratorZane Bitter2018-11-191-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | All of the python versions we support have functools.wraps(), so there is no need to have a soft import for it any more (indeed, we use it unconditionally elsewhere). Also, avoid modifying the attributes of the function passed in and relying on functools.wraps() to copy them to the function we're actually returning. Just add the attributes to the substitute function and return it as the user is probably expecting. Signed-off-by: Zane Bitter <zbitter@redhat.com>
* | Remove sixHugo2020-01-181-2/+0
| |
* | Upgrade Python syntax with pyupgrade --py3-plusHugo2020-01-181-29/+29
| |
* | Remove redundant Python 2 compatability codeHugo2020-01-181-6/+5
| |
* | Upgrade Python syntax with pyupgradeHugo2020-01-181-8/+8
|/
* Remove old Python 2.6 codehugovk2018-01-091-11/+0
|
* Python 3.6 invalid escape sequence deprecation fixes (#262)Ville Skyttä2017-05-291-2/+2
| | | https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
* Add unique_text_generatorBrant Knudson2016-02-291-1/+48
| | | | | | | | | This provides a way to make it easier to test with unicode text strings. The value returned will be like TestCase.getUniqueString but the value is six.text_type and contains unicode. Change-Id: I3f144e1294a801b23793f7a2520465e15f3a5222
* Stop using deprecated `skip()` internallyJonathan Lange2016-02-041-22/+57
|
* Review tweaksJonathan Lange2016-01-101-3/+5
| | | | | | | | * NEWS: 'during' -> 'within' * `throw` -> `raise_` Additionally, make `raise_` take a constructed exception, rather than constructing it ourselves.
* Merge branch 'master' into rerun-testJonathan Lange2015-12-291-4/+35
|\
| * Suppress skip traceback based on skipExceptionJonathan Lange2015-12-241-1/+12
| |
| * Merge branch 'master' into assert_raises_regexpJonathan Lange2015-12-231-3/+3
| |\
| | * Put expected on the right for binary mismatchJonathan Lange2015-12-211-3/+3
| | |
| * | Don't need our own assertRaisesRegexp.Jonathan Lange2015-12-211-1/+0
| | | | | | | | | | | | We get it just fine from unittest2
| * | Clarify the testsJonathan Lange2015-12-211-6/+8
| | |
| * | Add assertRaisesRegexp method.Julia Varlamova2015-12-211-0/+19
| |/ | | | | | | | | | | | | | | | | | | The method assertRaisesRegexp was introduced in python 2.7. This patch implements assertRaisesReagexp method to make possible using it in python 2.6. assertRaisesRegexp asserts that a method raises an exception and given pattern matches on the string representation of the raised exception.
* | Rewrite patch tests using make_test_caseJonathan Lange2015-12-071-23/+46
| |
* | `throw` helperJonathan Lange2015-12-071-7/+3
| |
* | Rewrite addCleanup tests in terms of make_test_caseJonathan Lange2015-12-071-110/+168
| |
* | No need for special caseJonathan Lange2015-12-041-21/+1
| |
* | Encapsulate constructionJonathan Lange2015-12-041-6/+2
| |
* | Start to use generated behaviorsJonathan Lange2015-12-041-3/+25
| |
* | Non-deterministic test caseJonathan Lange2015-11-301-2/+28
| |
* | Rename all_sample_cases_scenarios to deterministic_sample_cases_scenariosJonathan Lange2015-11-301-2/+2
| |
* | Treat tear down failure as a scenarioJonathan Lange2015-11-301-28/+0
| |
* | Begin to write scenario-based testsJonathan Lange2015-11-271-10/+13
| |
* | Split run twice tests to separate caseJonathan Lange2015-11-271-0/+9
| |
* | Handle failure in tearDownJonathan Lange2015-11-181-0/+30
| |
* | Allow tests to be run twiceJonathan Lange2015-11-161-0/+12
|/
* Fix setUpClass upcalls on Python 2.6.Robert Collins2014-11-171-22/+25
| | | | | | | | ``testtools.TestCase`` now inherits from unittest2.TestCase, which provides a ``setUpClass`` for upcalls on Python 2.6. (Robert Collins, #1393283) Change-Id: Id56212e3d7d519c7b73d2e19d3e34013fac34544
* Improve support for discovery on testtools.tests.Robert Collins2014-11-071-6/+0
| | | | | | | | | | | Our tests currently import test_with_with into test_testcase so that we could still run tests on python2.5. Since we no longer support 2.5, we don't need this hack. Its a hack because discovery will import test_with_with directly itself, and thus we triggered a duplicate test id error when attempting to use discover on the testtools test base. Change-Id: I027929ab4b0df350dd18ab01ffd5c493fe35e101
* Fix handling of uncatchable exceptions.Robert Collins2014-09-021-0/+12
| | | | | | | | | | | | | | | | | Fix a long-standing bug where tearDown and cleanUps would not be called if the test run was interrupted. This should fix leaking external resources from interrupted tests. (Robert Collins, #1364188) Fix a long-standing bug where calling sys.exit(0) from within a test would cause the test suite to exit with 0, without reporting a failure of that test. We still allow the test suite to be exited (since catching higher order exceptions requires exceptional circumstances) but we now call a last-resort handler on the TestCase, resulting in an error being reported for the test. (Robert Collins, #1364188) Change-Id: I0700f33fe7ed01416b37c21eb3f3fd0a7ea917eb
* Fix issue where using the skip* family of decorators still ran the setUp and ↵Thomi Richards2014-09-011-0/+71
| | | | tearDown test methods.
* Error if setUp or tearDown are called twice.Robert Collins2014-08-221-0/+24
| | | | | | | TestCase.setUp and TestCase.tearDown are only meant to be called once. Change-Id: If39046eed35257938062b07655b50d9bef0ea5ee Closes-Bug: #882884
* Merge pull request #82 from thomir/fix-expectedFailureJonathan Lange2014-05-261-0/+22
|\ | | | | Fix expected failure
| * Added failing test for python 3.4 unittest.expectedFailure decorator changes.Thomi Richards2014-03-101-0/+22
| |
* | Add optional message to assert(Not)InJoe Gordon2014-02-141-0/+22
|/ | | | | Just like many other asserts, add an optional message to assertIn and assertNotIn. This allows for more descriptive failures.
* Add expectThat method to testtools.TestCase.Thomi Richards2013-12-091-0/+32
| | | | Change-Id: I387df10140fe76af03d2ec693b35e326b2da932e
* Add 'force_failure' feature to testtools.TestCase.Thomi Richards2013-11-281-0/+10
| | | | Change-Id: Idb8c8d0c837ab2cb6ec53c84d144c29b5d6da8ea