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: Use pathlib.Path on the entire message.location.path #580

Merged
merged 10 commits into from
Feb 15, 2023
141 changes: 112 additions & 29 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions tests/suppression/test_suppression.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,12 @@ def test_filter_messages(self):
pros = Prospector(config)
pros.execute()
self.assertEqual(0, pros.summary["message_count"])

def test_filter_messages_negative(self):
workdir = Path(__file__).parent / "testdata/test_filter_messages_negative"
with patch("setoptconf.source.commandline.sys.argv", ["prospector"]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checkout the tests/utils.py module, patch_execution and patch_cli might do what you need here and might as well reuse it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christokur I'm not sure you took carlio's comment into account, could you look into it please ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took it into account yes

with patch("setoptconf.source.commandline.sys.argv", ...

and

with patch("sys.argv",  ...

have different semantics which is why I did not use patch_cli

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok refactored things but be aware that pyupgrade also made changes to how typing is used

config = ProspectorConfig(workdir=workdir)
config.paths = [workdir]
pros = Prospector(config)
pros.execute()
self.assertEqual(5, pros.summary["message_count"])
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
output-format: pylint
autodetect: false
strictness: veryhigh
test-warnings: true
doc-warnings: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum, unique


@unique
class FOO_BAR(Enum):
BAZ = 1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import collections
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import collections
import os
import tempfile