summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_epylint.py27
-rw-r--r--tests/test_pylint_runners.py30
2 files changed, 37 insertions, 20 deletions
diff --git a/tests/test_epylint.py b/tests/test_epylint.py
index e1b090395..7e9116e99 100644
--- a/tests/test_epylint.py
+++ b/tests/test_epylint.py
@@ -25,12 +25,12 @@ def example_path(tmp_path: PosixPath) -> PosixPath:
def test_epylint_good_command(example_path: PosixPath) -> None:
- out, err = lint.py_run(
- # pylint: disable-next=consider-using-f-string
- "%s -E --disable=E1111 --msg-template '{category} {module} {obj} {line} {column} {msg}'"
- % example_path,
- return_std=True,
- )
+ with pytest.warns(DeprecationWarning):
+ out, _ = lint.py_run(
+ f"{example_path} -E --disable=E1111 --msg-template "
+ "'{category} {module} {obj} {line} {column} {msg}'",
+ return_std=True,
+ )
msg = out.read()
assert (
msg
@@ -39,16 +39,16 @@ def test_epylint_good_command(example_path: PosixPath) -> None:
error my_app IvrAudioApp.run 4 8 Instance of 'IvrAudioApp' has no 'hassan' member
"""
)
- assert err.read() == ""
def test_epylint_strange_command(example_path: PosixPath) -> None:
- out, err = lint.py_run(
- # pylint: disable-next=consider-using-f-string
- "%s -E --disable=E1111 --msg-template={category} {module} {obj} {line} {column} {msg}"
- % example_path,
- return_std=True,
- )
+ with pytest.warns(DeprecationWarning):
+ out, _ = lint.py_run(
+ # pylint: disable-next=consider-using-f-string
+ "%s -E --disable=E1111 --msg-template={category} {module} {obj} {line} {column} {msg}"
+ % example_path,
+ return_std=True,
+ )
assert (
out.read()
== """\
@@ -66,4 +66,3 @@ def test_epylint_strange_command(example_path: PosixPath) -> None:
error
"""
)
- assert err.read() == ""
diff --git a/tests/test_pylint_runners.py b/tests/test_pylint_runners.py
index 8e68f8eaa..8d6930535 100644
--- a/tests/test_pylint_runners.py
+++ b/tests/test_pylint_runners.py
@@ -33,9 +33,7 @@ class _RunCallable(Protocol): # pylint: disable=too-few-public-methods
...
-@pytest.mark.parametrize(
- "runner", [run_epylint, run_pylint, run_pyreverse, run_symilar]
-)
+@pytest.mark.parametrize("runner", [run_pylint, run_pyreverse, run_symilar])
def test_runner(runner: _RunCallable, tmpdir: LocalPath) -> None:
filepath = os.path.abspath(__file__)
testargs = ["", filepath]
@@ -46,9 +44,18 @@ def test_runner(runner: _RunCallable, tmpdir: LocalPath) -> None:
assert err.value.code == 0
-@pytest.mark.parametrize(
- "runner", [run_epylint, run_pylint, run_pyreverse, run_symilar]
-)
+def test_epylint(tmpdir: LocalPath) -> None:
+ """TODO: 3.0 delete with epylint."""
+ filepath = os.path.abspath(__file__)
+ with tmpdir.as_cwd():
+ with patch.object(sys, "argv", ["", filepath]):
+ with pytest.raises(SystemExit) as err:
+ with pytest.warns(DeprecationWarning):
+ run_epylint()
+ assert err.value.code == 0
+
+
+@pytest.mark.parametrize("runner", [run_pylint, run_pyreverse, run_symilar])
def test_runner_with_arguments(runner: _RunCallable, tmpdir: LocalPath) -> None:
"""Check the runners with arguments as parameter instead of sys.argv."""
filepath = os.path.abspath(__file__)
@@ -59,6 +66,17 @@ def test_runner_with_arguments(runner: _RunCallable, tmpdir: LocalPath) -> None:
assert err.value.code == 0
+def test_epylint_with_arguments(tmpdir: LocalPath) -> None:
+ """TODO: 3.0 delete with epylint."""
+ filepath = os.path.abspath(__file__)
+ testargs = [filepath]
+ with tmpdir.as_cwd():
+ with pytest.raises(SystemExit) as err:
+ with pytest.warns(DeprecationWarning):
+ run_epylint(testargs)
+ assert err.value.code == 0
+
+
def test_pylint_argument_deduplication(
tmpdir: LocalPath, tests_directory: pathlib.Path
) -> None: