From 4635423cd68108a4ec8768ac3872133e69d9d4bb Mon Sep 17 00:00:00 2001 From: Morten Kristensen Date: Thu, 19 Oct 2023 17:23:08 +0200 Subject: [PATCH 1/2] Fix overriding config from other instance --- tests/config.py | 2 ++ vermin/config.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/config.py b/tests/config.py index 5b6c676e..b412fc42 100644 --- a/tests/config.py +++ b/tests/config.py @@ -39,6 +39,7 @@ def test_override_from(self): other.set_show_tips(False) other.set_analyze_hidden(True) other.add_exclusion("foo.bar.baz") + other.add_exclusion_regex("foo/") self.assertTrue(other.add_backport("typing")) self.assertTrue(other.enable_feature("fstring-self-doc")) self.assertTrue(other.add_target("2.3")) @@ -58,6 +59,7 @@ def test_override_from(self): self.assertEqual(other.show_tips(), self.config.show_tips()) self.assertEqual(other.analyze_hidden(), self.config.analyze_hidden()) self.assertEqual(other.exclusions(), self.config.exclusions()) + self.assertEqual(other.exclusion_regex(), self.config.exclusion_regex()) self.assertEqual(other.backports(), self.config.backports()) self.assertEqual(other.features(), self.config.features()) self.assertEqual(other.targets(), self.config.targets()) diff --git a/vermin/config.py b/vermin/config.py index 2a63f27f..d5da9dff 100644 --- a/vermin/config.py +++ b/vermin/config.py @@ -47,7 +47,7 @@ def override_from(self, other_config): self.__show_tips = other_config.show_tips() self.__analyze_hidden = other_config.analyze_hidden() self.__exclusions = set(other_config.exclusions()) - self.__exclusion_regex = set(other_config.exclusion_regex()) + self.__exclusion_regex = {re.compile(r) for r in other_config.exclusion_regex()} self.__make_paths_absolute = other_config.make_paths_absolute() self.__backports = other_config.backports() self.__features = other_config.features() From 9612b7cade51ffdbd1dd51498f9fc1ff752bbb77 Mon Sep 17 00:00:00 2001 From: Morten Kristensen Date: Thu, 19 Oct 2023 17:34:30 +0200 Subject: [PATCH 2/2] Override incorrect Windows test error --- tests/general.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/general.py b/tests/general.py index 78c226c9..f36ba6bb 100644 --- a/tests/general.py +++ b/tests/general.py @@ -380,7 +380,13 @@ def test_exclude_regex_relative(self): paths = detect_paths(["a"], config=self.config) self.assertEqual(paths, [join("a", "code.py")]) - rmtree(tmp_fld) + # When running on Windows, this can sometimes fail: + # PermissionError: [WinError 32] The process cannot access the file because it is being used + # by another process: + # 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmpAAAANNNN' + # But we can ignore that since the files reside in a temporary folder anyway, and the + # folders/files aren't being used any longer either. + rmtree(tmp_fld, ignore_errors=True) def test_detect_vermin_min_versions(self): paths = detect_paths([abspath("vermin")], config=self.config)