summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/config/file_to_lint.py1
-rw-r--r--tests/config/test_config.py6
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: