From 5b1f52f9c8a669e0808a4ccdbfa69a6bcd7fc729 Mon Sep 17 00:00:00 2001 From: Leif Walsh Date: Wed, 20 Dec 2023 20:57:56 +0000 Subject: [PATCH] fix tests on python >=3.11 --- marbles/core/tests/test_setuptools.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/marbles/core/tests/test_setuptools.py b/marbles/core/tests/test_setuptools.py index 0ef7275..dc98dd0 100644 --- a/marbles/core/tests/test_setuptools.py +++ b/marbles/core/tests/test_setuptools.py @@ -52,10 +52,10 @@ def test_locals(self): def test_tests_run(self): expected_lines = [ - 'test_test (tests.test_two.TestTest) ... ok', - 'test_test (tests.test.TestTest) ... FAIL', - 'Ran 2 tests in', - ] + 'test_test (tests.test_two.TestTest) ... ok', + 'test_test (tests.test.TestTest) ... FAIL', + 'Ran 2 tests in', + ] for e in expected_lines: self.assertIn(e, self.stderr) @@ -79,19 +79,19 @@ def test_locals(self): def test_tests_run(self): expected_lines = [ - 'test_neg_nums (tests.namespace.core.test.TestCase) ... ok', - 'test_pos_nums (tests.namespace.core.test.TestCase) ... FAIL', - 'Ran 2 tests in', - ] + r'test_neg_nums \(tests\.namespace\.core\.test\.TestCase(\.test_neg_nums)?\) \.\.\. ok', # noqa: E501 + r'test_pos_nums \(tests\.namespace\.core\.test\.TestCase(\.test_pos_nums)?\) \.\.\. FAIL', # noqa: E501 + r'Ran 2 tests in', + ] for e in expected_lines: - self.assertIn(e, self.stderr) + self.assertRegexpMatches(self.stderr, e) def test_source(self): expected_lines = [ - 'Source', - 'for i in range(10)', - 'self.assertEqual(i*2, m.double(i))' - ] + 'Source', + 'for i in range(10)', + 'self.assertEqual(i*2, m.double(i))' + ] for e in expected_lines: self.assertIn(e, self.stderr)