Skip to content

Commit

Permalink
Merge pull request #237 from netromdk/issue-236
Browse files Browse the repository at this point in the history
Fix overriding config exclusion regexes from other instance
  • Loading branch information
netromdk authored Oct 19, 2023
2 parents 7441f2e + 9612b7c commit a0647aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions tests/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand All @@ -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())
Expand Down
8 changes: 7 additions & 1 deletion tests/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion vermin/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a0647aa

Please sign in to comment.