summaryrefslogtreecommitdiff
path: root/tests/testutils
diff options
context:
space:
mode:
authorAndreas Finkler <3929834+DudeNr33@users.noreply.github.com>2022-05-17 13:58:36 +0200
committerGitHub <noreply@github.com>2022-05-17 13:58:36 +0200
commit4169f6bc6faab8f99a7577c4fa6912e152b72245 (patch)
tree06962dd7341c01fee787c4d712dec34ca7ff6cda /tests/testutils
parent653e87adae4a0b9c5aa204af259c1286d9e99130 (diff)
downloadpylint-git-4169f6bc6faab8f99a7577c4fa6912e152b72245.tar.gz
Run linking and diadef handling with patched `sys.path` (#6617)
* Use separate directory for pyreverse related test data
Diffstat (limited to 'tests/testutils')
-rw-r--r--tests/testutils/pyreverse_data/_not_a_functest.py0
-rw-r--r--tests/testutils/pyreverse_data/functest_with_options.py2
-rw-r--r--tests/testutils/pyreverse_data/functest_with_options.rc3
-rw-r--r--tests/testutils/pyreverse_data/functest_without_options.py2
-rw-r--r--tests/testutils/test_pyreverse_testutils.py30
5 files changed, 37 insertions, 0 deletions
diff --git a/tests/testutils/pyreverse_data/_not_a_functest.py b/tests/testutils/pyreverse_data/_not_a_functest.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/testutils/pyreverse_data/_not_a_functest.py
diff --git a/tests/testutils/pyreverse_data/functest_with_options.py b/tests/testutils/pyreverse_data/functest_with_options.py
new file mode 100644
index 000000000..b313905c8
--- /dev/null
+++ b/tests/testutils/pyreverse_data/functest_with_options.py
@@ -0,0 +1,2 @@
+class Dummy:
+ pass
diff --git a/tests/testutils/pyreverse_data/functest_with_options.rc b/tests/testutils/pyreverse_data/functest_with_options.rc
new file mode 100644
index 000000000..49e7cb889
--- /dev/null
+++ b/tests/testutils/pyreverse_data/functest_with_options.rc
@@ -0,0 +1,3 @@
+[testoptions]
+output_formats=dot,png
+command_line_args=-ASmy
diff --git a/tests/testutils/pyreverse_data/functest_without_options.py b/tests/testutils/pyreverse_data/functest_without_options.py
new file mode 100644
index 000000000..b313905c8
--- /dev/null
+++ b/tests/testutils/pyreverse_data/functest_without_options.py
@@ -0,0 +1,2 @@
+class Dummy:
+ pass
diff --git a/tests/testutils/test_pyreverse_testutils.py b/tests/testutils/test_pyreverse_testutils.py
new file mode 100644
index 000000000..95cbc239f
--- /dev/null
+++ b/tests/testutils/test_pyreverse_testutils.py
@@ -0,0 +1,30 @@
+# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
+# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
+# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+
+from pathlib import Path
+
+from pylint.testutils import pyreverse
+
+HERE = Path(__file__).parent
+DATA_DIRECTORY = HERE / "pyreverse_data"
+TEST_FILES = {
+ testfile.source.stem: testfile
+ for testfile in pyreverse.get_functional_test_files(DATA_DIRECTORY)
+}
+
+
+def test_files_with_leading_underscore_are_ignored() -> None:
+ assert "_not_a_functest" not in TEST_FILES
+
+
+def test_file_with_options() -> None:
+ test_file = TEST_FILES["functest_with_options"]
+ assert test_file.options["output_formats"] == ["dot", "png"]
+ assert test_file.options["command_line_args"] == ["-ASmy"]
+
+
+def test_file_without_options() -> None:
+ test_file = TEST_FILES["functest_without_options"]
+ assert test_file.options["output_formats"] == ["mmd"]
+ assert test_file.options["command_line_args"] == []