diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-11-09 15:56:22 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-11-09 15:59:18 +0100 |
commit | 5b46aca8e449f6d1902b8fbb20e30dcf4528c1b8 (patch) | |
tree | 685f81b343c2fe3922fddc1460af2c1be85b9c2d | |
parent | 3e87888e66babd1c1de06a334297a82988e7dfc7 (diff) | |
download | pylint-git-simplify-toml-test-using-env-var.tar.gz |
Use a stable file in order to have a stable exit codesimplify-toml-test-using-env-var
-rw-r--r-- | tests/config/file_to_lint.py | 1 | ||||
-rw-r--r-- | tests/config/test_config.py | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/tests/config/file_to_lint.py b/tests/config/file_to_lint.py new file mode 100644 index 000000000..e7c395dd9 --- /dev/null +++ b/tests/config/file_to_lint.py @@ -0,0 +1 @@ +"""Perfect module with only documentation for configuration tests""" diff --git a/tests/config/test_config.py b/tests/config/test_config.py index 921826702..4e7f5ffff 100644 --- a/tests/config/test_config.py +++ b/tests/config/test_config.py @@ -7,12 +7,16 @@ from typing import Union import pylint.lint from pylint.lint.run import Run +# We use an external file and not __file__ or pylint warning in this file +# makes the tests fails because the exit code change +FILE_TO_LINT = str(Path(__file__).parent / "file_to_lint.py") + def get_runner_from_config_file( config_file: Union[str, Path], expected_exit_code: int = 0 ) -> Run: """Initialize pylint with the given configuration file and return the Run""" - args = ["--rcfile", str(config_file), __file__] + args = ["--rcfile", str(config_file), FILE_TO_LINT] # If we used `pytest.raises(SystemExit)`, the `runner` variable # would not be accessible outside the `with` block. with unittest.mock.patch("sys.exit") as mocked_exit: |