Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overriding config exclusion regexes from other instance #237

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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