From 2ea43a4cdfbffaaaef2bd259ffc2df253bb0bb64 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Tue, 16 Jan 2024 10:59:54 +0100 Subject: [PATCH] add test for skip_file --- tests/data/lint_skip_list.txt | 4 ++++ tests/test_lint.py | 6 ++++++ 2 files changed, 10 insertions(+) create mode 100644 tests/data/lint_skip_list.txt diff --git a/tests/data/lint_skip_list.txt b/tests/data/lint_skip_list.txt new file mode 100644 index 000000000..acfa09ee5 --- /dev/null +++ b/tests/data/lint_skip_list.txt @@ -0,0 +1,4 @@ +# check that comments work +xml_order +# check the white spaces are ignored + citations diff --git a/tests/test_lint.py b/tests/test_lint.py index dc8ec9aff..3f5542f12 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -5,6 +5,7 @@ CliTestCase, PROJECT_TEMPLATES_DIR, skip_if_environ, + TEST_DATA_DIR, TEST_REPOS_DIR, TEST_TOOLS_DIR, ) @@ -61,6 +62,11 @@ def test_skips(self): lint_cmd = ["lint", "--skip", "xml_order, citations", fail_citation] self._check_exit_code(lint_cmd, exit_code=0) + # Check skip_file (containing the same skips) + skip_file = os.path.join(TEST_TOOLS_DIR, "lint_skip_list.txt") + lint_cmd = ["lint", "--skip_file", skip_file, fail_citation] + self._check_exit_code(lint_cmd, exit_code=0) + def test_recursive(self): nested_dir = os.path.join(TEST_REPOS_DIR, "multi_repos_nested")