mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Python: Add integration test
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
| name |
|
||||||
|
+-------------------------------+
|
||||||
|
| .hidden_file.py |
|
||||||
|
| foo.py |
|
||||||
|
| visible_file_in_hidden_dir.py |
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
| name |
|
||||||
|
+-----------------+
|
||||||
|
| .hidden_file.py |
|
||||||
|
| foo.py |
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import python
|
||||||
|
|
||||||
|
select any(File f).getShortName() as name order by name
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
print(42)
|
||||||
24
python/extractor/cli-integration-test/hidden-files/test.sh
Executable file
24
python/extractor/cli-integration-test/hidden-files/test.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -Eeuo pipefail # see https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
CODEQL=${CODEQL:-codeql}
|
||||||
|
|
||||||
|
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
cd "$SCRIPTDIR"
|
||||||
|
|
||||||
|
rm -rf db db-skipped
|
||||||
|
|
||||||
|
# Test 1: Default behavior should be to extract files in hidden directories
|
||||||
|
$CODEQL database create db --language python --source-root repo_dir/
|
||||||
|
$CODEQL query run --database db query.ql > query-default.actual
|
||||||
|
diff query-default.expected query-default.actual
|
||||||
|
|
||||||
|
# Test 2: Setting the relevant extractor option to true skips files in hidden directories
|
||||||
|
$CODEQL database create db-skipped --language python --source-root repo_dir/ --extractor-option python.skip_hidden_directories=true
|
||||||
|
$CODEQL query run --database db-skipped query.ql > query-skipped.actual
|
||||||
|
diff query-skipped.expected query-skipped.actual
|
||||||
|
|
||||||
|
rm -rf db db-skipped
|
||||||
Reference in New Issue
Block a user