From e8b8a77619d2582d5b5b9758d150a5b3a1834efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20FERRY?= Date: Tue, 17 May 2022 12:01:27 +0200 Subject: [PATCH 1/2] chore(test): unpin pytest version --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 1a8d803..62df628 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist=py3,check-manifest,mypy,flake8,black,black-run,yamllint [testenv] deps = pytz - pytest == 5.4.1 + pytest git+https://github.com/psycojoker/pytest-capture-deprecatedwarnings commands= {envpython} -m pytest test {posargs} -- GitLab From cb24adddf482fa2b818f0720a72168935e2bdc97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20FERRY?= Date: Wed, 18 May 2022 15:53:02 +0200 Subject: [PATCH 2/2] test: change a very strange way to use self.assertXXX --- test/test_date.py | 11 ++++++----- test/test_testlib.py | 16 ++++++++-------- test/test_textutils.py | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/test/test_date.py b/test/test_date.py index f573e16..29a358e 100644 --- a/test/test_date.py +++ b/test/test_date.py @@ -78,12 +78,13 @@ class DateTC(TestCase): def test_get_national_holidays(self): holidays = get_national_holidays - yield self.assertEqual, holidays(self.datecls(2008, 4, 29), self.datecls(2008, 5, 2)), [ - self.datecls(2008, 5, 1) - ] - yield self.assertEqual, holidays(self.datecls(2008, 5, 7), self.datecls(2008, 5, 8)), [] + self.assertEqual( + holidays(self.datecls(2008, 4, 29), self.datecls(2008, 5, 2)), + [self.datecls(2008, 5, 1)], + ) + self.assertEqual(holidays(self.datecls(2008, 5, 7), self.datecls(2008, 5, 8)), []) x = self.datetimecls(2008, 5, 7, 12, 12, 12) - yield self.assertEqual, holidays(x, x + self.timedeltacls(days=1)), [] + self.assertEqual(holidays(x, x + self.timedeltacls(days=1)), []) def test_open_days_now_and_before(self): nb = nb_open_days diff --git a/test/test_testlib.py b/test/test_testlib.py index 84b8e5c..561a30a 100644 --- a/test/test_testlib.py +++ b/test/test_testlib.py @@ -501,7 +501,7 @@ class TestLoaderTC(TestCase): ("FooTC.whatever", 0), ] for pattern, expected_count in data: - yield self.assertRunCount, pattern, self.module, expected_count + self.assertRunCount(pattern, self.module, expected_count) def test_collect_with_pattern(self): data = [ @@ -516,7 +516,7 @@ class TestLoaderTC(TestCase): ("ab", 0), ] for pattern, expected_count in data: - yield self.assertRunCount, pattern, self.module, expected_count + self.assertRunCount(pattern, self.module, expected_count) def test_testcase_with_custom_metaclass(self): class mymetaclass(type): @@ -553,7 +553,7 @@ class TestLoaderTC(TestCase): ("MyTestCase.whatever", 0), ] for pattern, expected_count in data: - yield self.assertRunCount, pattern, MyMod, expected_count + self.assertRunCount(pattern, MyMod, expected_count) def test_collect_everything_and_skipped_patterns(self): testdata = [ @@ -562,7 +562,7 @@ class TestLoaderTC(TestCase): (["foo", "bar"], 0), ] for skipped, expected_count in testdata: - yield self.assertRunCount, None, self.module, expected_count, skipped + self.assertRunCount(None, self.module, expected_count, skipped) def test_collect_specific_pattern_and_skip_some(self): testdata = [ @@ -571,7 +571,7 @@ class TestLoaderTC(TestCase): ("bar", ["bar"], 0), ] for runpattern, skipped, expected_count in testdata: - yield self.assertRunCount, runpattern, self.module, expected_count, skipped + self.assertRunCount(runpattern, self.module, expected_count, skipped) def test_skip_classname(self): testdata = [ @@ -579,7 +579,7 @@ class TestLoaderTC(TestCase): (["FooTC"], 1), ] for skipped, expected_count in testdata: - yield self.assertRunCount, None, self.module, expected_count, skipped + self.assertRunCount(None, self.module, expected_count, skipped) def test_skip_classname_and_specific_collect(self): testdata = [ @@ -587,7 +587,7 @@ class TestLoaderTC(TestCase): ("foo", ["FooTC"], 0), ] for runpattern, skipped, expected_count in testdata: - yield self.assertRunCount, runpattern, self.module, expected_count, skipped + self.assertRunCount(runpattern, self.module, expected_count, skipped) def test_nonregr_dotted_path(self): self.assertRunCount("FooTC.test_foo", self.module, 2) @@ -615,7 +615,7 @@ class TestLoaderTC(TestCase): ("odd", 0), ] for pattern, expected_count in data: - yield self.assertRunCount, pattern, MyMod, expected_count + self.assertRunCount(pattern, MyMod, expected_count) def test_nonregr_class_skipped_option(self): class MyMod: diff --git a/test/test_textutils.py b/test/test_textutils.py index 6a62039..91d0db1 100644 --- a/test/test_textutils.py +++ b/test/test_textutils.py @@ -318,7 +318,7 @@ class UnormalizeTC(TestCase): ("Bordeaux\u2013Mérignac", "Bordeaux-Merignac"), ] for input, output in data: - yield self.assertEqual, tu.unormalize(input), output + self.assertEqual(tu.unormalize(input), output) def test_unormalize_substitute(self): self.assertEqual(tu.unormalize("ab \u8000 cd", substitute="_"), "ab _ cd") -- GitLab