diff options
author | Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com> | 2022-08-03 20:54:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-03 20:54:47 +0200 |
commit | 20a2f129e82349f8a216c288905dee748ba55423 (patch) | |
tree | 30cc96f1cc15ba868cc41308f5441781ccde3003 | |
parent | 8db7b72f297c8a604f1ad1002fda0b138497c211 (diff) | |
download | pylint-git-20a2f129e82349f8a216c288905dee748ba55423.tar.gz |
Fix failing tests in 'test_self.py' under MacOS (#7234)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
-rw-r--r-- | tests/test_self.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/test_self.py b/tests/test_self.py index efa38fab4..7c11601a9 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -1176,7 +1176,9 @@ class TestCallbackOptions: (["--long-help"], "Environment variables:"), ], ) - def test_output_of_callback_options(command: list[str], expected: str) -> None: + def test_output_of_callback_options( + command: list[str], expected: str, tmp_path: Path + ) -> None: """Test whether certain strings are in the output of a callback command.""" command = _add_rcfile_default_pylintrc(command) process = subprocess.run( @@ -1184,6 +1186,7 @@ class TestCallbackOptions: capture_output=True, encoding="utf-8", check=False, + cwd=str(tmp_path), ) assert expected in process.stdout @@ -1196,7 +1199,9 @@ class TestCallbackOptions: [["--help-msg"], "--help-msg: expected at least one argumen", True], ], ) - def test_help_msg(args: list[str], expected: str, error: bool) -> None: + def test_help_msg( + args: list[str], expected: str, error: bool, tmp_path: Path + ) -> None: """Test the --help-msg flag.""" args = _add_rcfile_default_pylintrc(args) process = subprocess.run( @@ -1204,6 +1209,7 @@ class TestCallbackOptions: capture_output=True, encoding="utf-8", check=False, + cwd=str(tmp_path), ) if error: result = process.stderr @@ -1212,7 +1218,7 @@ class TestCallbackOptions: assert expected in result @staticmethod - def test_generate_rcfile() -> None: + def test_generate_rcfile(tmp_path: Path) -> None: """Test the --generate-rcfile flag.""" args = _add_rcfile_default_pylintrc(["--generate-rcfile"]) process = subprocess.run( @@ -1220,6 +1226,7 @@ class TestCallbackOptions: capture_output=True, encoding="utf-8", check=False, + cwd=str(tmp_path), ) assert "[MAIN]" in process.stdout assert "[MASTER]" not in process.stdout @@ -1230,6 +1237,7 @@ class TestCallbackOptions: capture_output=True, encoding="utf-8", check=False, + cwd=str(tmp_path), ) assert process.stdout == process_two.stdout @@ -1268,7 +1276,7 @@ class TestCallbackOptions: assert "suppressed-message" in messages @staticmethod - def test_generate_toml_config() -> None: + def test_generate_toml_config(tmp_path: Path) -> None: """Test the --generate-toml-config flag.""" args = _add_rcfile_default_pylintrc( [ @@ -1281,6 +1289,7 @@ class TestCallbackOptions: capture_output=True, encoding="utf-8", check=False, + cwd=str(tmp_path), ) assert "[tool.pylint.main]" in process.stdout assert "[tool.pylint.master]" not in process.stdout @@ -1293,6 +1302,7 @@ class TestCallbackOptions: capture_output=True, encoding="utf-8", check=False, + cwd=str(tmp_path), ) assert process.stdout == process_two.stdout |