|
1 | 1 | import runs_on |
2 | 2 | import pytest |
3 | | -import sys |
4 | | - |
5 | | -def get_test_module(semmle_code_dir): |
6 | | - import importlib.util |
7 | | - spec = importlib.util.spec_from_file_location('test-module', semmle_code_dir / 'ql' / 'misc' / 'pytest' / 'lib' / 'query-suite-test.py') |
8 | | - mod = importlib.util.module_from_spec(spec) |
9 | | - sys.modules["test-module"] = mod |
10 | | - spec.loader.exec_module(mod) |
11 | | - return mod |
12 | | - |
| 3 | +from query_suites import * |
13 | 4 |
|
14 | 5 | well_known_query_suites = ['swift-code-quality.qls', 'swift-security-and-quality.qls', 'swift-security-extended.qls', 'swift-code-scanning.qls'] |
15 | 6 |
|
16 | 7 | @runs_on.posix |
17 | 8 | @pytest.mark.parametrize("query_suite", well_known_query_suites) |
18 | | -def test(codeql, swift, cwd, expected_files, semmle_code_dir, query_suite): |
19 | | - get_test_module(semmle_code_dir).test(codeql, cwd, expected_files, semmle_code_dir, query_suite) |
| 9 | +def test(codeql, swift, check_query_suite, query_suite): |
| 10 | + check_query_suite(query_suite) |
20 | 11 |
|
21 | 12 | @runs_on.posix |
22 | | -def test_not_included_queries(codeql, swift, cwd, expected_files, semmle_code_dir): |
23 | | - get_test_module(semmle_code_dir).test_not_included_queries(codeql, 'swift', cwd, expected_files, semmle_code_dir, well_known_query_suites) |
| 13 | +def test_not_included_queries(codeql, swift, check_queries_not_included): |
| 14 | + check_queries_not_included('swift', well_known_query_suites) |
0 commit comments