Just: port python to new language test definition

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Paolo Tranquilli
2026-04-02 12:44:25 +02:00
parent 178169228e
commit 29e5bebbec
4 changed files with 64 additions and 1 deletions

32
python/justfile Normal file
View File

@@ -0,0 +1,32 @@
import '../lib.just'
import 'ql/justfile'
[group('build')]
build: (_build_dist "python")
# Long filename needed for extractor tests (too long for Git on Windows)
[no-cd]
@_ensure_long_filename:
#!/usr/bin/env bash
longfile="$SEMMLE_CODE/ql/python/ql/test/extractor-tests/long_path/really_rather_too_long_for_windows_path_length/with_unecessarily_longwinded_and_verbose_sub_folder/extremely_long_module_name_with_lots_of_digits_at_the_end_000000000000000000000000000000000000000000000000000000000000000000/test0000000000000000000000000000000000000000000000000000000.py"
mkdir -p "$(dirname "$longfile")"
touch "$longfile"
[group('test')]
language-tests-2 *EXTRA_ARGS: _ensure_long_filename (_language_tests (
_v2_env + ' ' + EXTRA_ARGS) source_dir()
'ql/test/library-tests'
'ql/test/query-tests'
'ql/test/extractor-tests'
'ql/test/experimental'
'ql/test/2')
[group('test')]
language-tests-3 *EXTRA_ARGS: _ensure_long_filename (_language_tests (
_v3_env + ' ' + EXTRA_ARGS) source_dir()
'ql/test/library-tests'
'ql/test/query-tests'
'ql/test/extractor-tests'
'ql/test/experimental'
'ql/test/modelling'
'ql/test/3')

12
python/ql/justfile Normal file
View File

@@ -0,0 +1,12 @@
import "../../lib.just"
[no-cd]
format *ARGS=".": (_format_ql ARGS)
consistency_queries := source_dir() / "consistency-queries"
python_version := "3"
_v2_env := "CODEQL_EXTRACTOR_PYTHON_ANALYSIS_VERSION=2 CODEQL_PYTHON_LEGACY_TEST_EXTRACTION_VERSION=2"
_v3_env := "CODEQL_PYTHON_LEGACY_TEST_EXTRACTION_VERSION=3"
_python_env := if python_version == "2" { _v2_env } else { _v3_env }

9
python/ql/test/justfile Normal file
View File

@@ -0,0 +1,9 @@
import "../justfile"
base_flags := _python_env
all_checks := default_db_checks + """\
--consistency-queries=""" + consistency_queries
[no-cd]
test *ARGS=".": (_codeql_test "python" base_flags all_checks ARGS)