diff options
author | Hugo van Kemenade <hugovk@users.noreply.github.com> | 2022-05-04 13:14:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 13:14:53 +0300 |
commit | 446e78409d258b17b457a8eecf302c28bc974ff5 (patch) | |
tree | 2d656fabcf1fc3ec3d956b8d4121976ed848d43f | |
parent | 182bb4b405f29f33a9086ef35c0fa814ac299447 (diff) | |
parent | 4fc915b74bb152a62a077f4abaf43a123029e98a (diff) | |
download | testtools-446e78409d258b17b457a8eecf302c28bc974ff5.tar.gz |
Merge branch 'master' into rm-3.5
-rw-r--r-- | doc/for-framework-folk.rst | 5 | ||||
-rw-r--r-- | doc/for-test-authors.rst | 2 | ||||
-rw-r--r-- | doc/news.rst | 1 | ||||
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | testtools/tests/test_content.py | 2 | ||||
-rw-r--r-- | testtools/tests/test_monkey.py | 6 | ||||
-rw-r--r-- | testtools/tests/test_testcase.py | 14 |
7 files changed, 16 insertions, 16 deletions
diff --git a/doc/for-framework-folk.rst b/doc/for-framework-folk.rst index 2fd6804..fb55ce1 100644 --- a/doc/for-framework-folk.rst +++ b/doc/for-framework-folk.rst @@ -133,10 +133,7 @@ DecorateTestCaseResult This object calls out to your code when ``run`` / ``__call__`` are called and allows the result object that will be used to run the test to be altered. This is very useful when working with a test runner that doesn't know your test case -requirements. For instance, it can be used to inject a ``unittest2`` compatible -adapter when someone attempts to run your test suite with a ``TestResult`` that -does not support ``addSkip`` or other ``unittest2`` methods. Similarly it can -aid the migration to ``StreamResult``. +requirements. For instance, it can aid the migration to ``StreamResult``. e.g.:: diff --git a/doc/for-test-authors.rst b/doc/for-test-authors.rst index 5261154..27ea212 100644 --- a/doc/for-test-authors.rst +++ b/doc/for-test-authors.rst @@ -84,7 +84,6 @@ of them will happily run testtools tests. In particular: * testrepository_ * Trial_ * nose_ -* unittest2_ * `zope.testrunner`_ (aka zope.testing) From now on, we'll assume that you know how to run your tests. @@ -1463,7 +1462,6 @@ Here, ``repr(nullary)`` will be the same as ``repr(f)``. .. _testrepository: https://launchpad.net/testrepository .. _Trial: http://twistedmatrix.com/documents/current/core/howto/testing.html .. _nose: http://somethingaboutorange.com/mrl/projects/nose/ -.. _unittest2: http://pypi.python.org/pypi/unittest2 .. _zope.testrunner: http://pypi.python.org/pypi/zope.testrunner/ .. _xUnit test patterns: http://xunitpatterns.com/ .. _fixtures: http://pypi.python.org/pypi/fixtures diff --git a/doc/news.rst b/doc/news.rst new file mode 100644 index 0000000..4264fd6 --- /dev/null +++ b/doc/news.rst @@ -0,0 +1 @@ +.. include:: ../NEWS @@ -5,7 +5,7 @@ home_page = https://github.com/testing-cabal/testtools description_file = doc/overview.rst author = Jonathan M. Lange author_email = jml+testtools@mumak.net -classifier = +classifier = Development Status :: 5 - Production/Stable Intended Audience :: Developers License :: OSI Approved :: MIT License diff --git a/testtools/tests/test_content.py b/testtools/tests/test_content.py index 35231b6..f507f3f 100644 --- a/testtools/tests/test_content.py +++ b/testtools/tests/test_content.py @@ -287,7 +287,7 @@ class TestStacktraceContent(TestCase): def test_top_frame_is_skipped_when_no_stack_is_specified(self): actual = StacktraceContent().as_text() - self.assertTrue('testtools/content.py' not in actual) + self.assertNotIn('testtools/content.py', actual) class TestAttachFile(TestCase): diff --git a/testtools/tests/test_monkey.py b/testtools/tests/test_monkey.py index 7e8d755..2196be3 100644 --- a/testtools/tests/test_monkey.py +++ b/testtools/tests/test_monkey.py @@ -113,11 +113,13 @@ class MonkeyPatcherTest(TestCase): result = self.monkey_patcher.run_with_patches(f) self.assertEqual( ('haha', self.original_object.bar, self.original_object.baz), - result) + result + ) result = self.monkey_patcher.run_with_patches(f) self.assertEqual( ('haha', self.original_object.bar, self.original_object.baz), - result) + result + ) def test_run_with_patches_restores(self): # run_with_patches restores the original values after the function has diff --git a/testtools/tests/test_testcase.py b/testtools/tests/test_testcase.py index 1b2ee73..48f0dda 100644 --- a/testtools/tests/test_testcase.py +++ b/testtools/tests/test_testcase.py @@ -349,9 +349,11 @@ class TestAssertions(TestCase): exception = self.assertRaises(RuntimeError, raiseError) self.assertEqual(1, len(raisedExceptions)) - self.assertTrue( - exception is raisedExceptions[0], - f"{exception!r} is not {raisedExceptions[0]!r}") + self.assertIs( + exception, + raisedExceptions[0], + '{!r} is not {!r}'.format(exception, raisedExceptions[0]) + ) def test_assertRaises_with_multiple_exceptions(self): # assertRaises((ExceptionOne, ExceptionTwo), function) asserts that @@ -516,7 +518,7 @@ class TestAssertions(TestCase): def test_assertIs(self): # assertIs asserts that an object is identical to another object. - self.assertIs(None, None) + self.assertIsNone(None) some_list = [42] self.assertIs(some_list, some_list) some_object = object() @@ -645,7 +647,7 @@ class TestAssertions(TestCase): test = Test("test") result = test.run() details = test.getDetails() - self.assertTrue("Failed expectation" in details) + self.assertIn('Failed expectation', details) def test__force_failure_fails_test(self): class Test(TestCase): @@ -1687,7 +1689,7 @@ class TestSkipping(TestCase): def check_test_does_not_run_setup(self, test, reason): result = test.run() self.assertTrue(result.wasSuccessful()) - self.assertTrue(reason in result.skip_reasons, result.skip_reasons) + self.assertIn(reason, result.skip_reasons, result.skip_reasons) self.assertFalse(test.setup_ran) def test_testtools_skip_decorator_does_not_run_setUp(self): |