Skip to content

Commit 6f1a9d4

Browse files
authored
Merge pull request #16159 from RasmusWL/fix-integration-tests
Python: Fixup integration tests after no dep inst
2 parents 6ce38be + e9e7ccd commit 6f1a9d4

File tree

4 files changed

+49
-123
lines changed

4 files changed

+49
-123
lines changed

python/extractor/cli-integration-test/force-enable-library-extraction/disabled-test.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

python/extractor/cli-integration-test/force-enable-library-extraction/repo_dir/foo.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

python/extractor/cli-integration-test/ignore-venv/disabled-test.sh

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
set -Eeuo pipefail # see https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
4+
5+
set -x
6+
7+
CODEQL=${CODEQL:-codeql}
8+
9+
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
10+
cd "$SCRIPTDIR"
11+
12+
# start on clean slate
13+
rm -rf dbs repo_dir/venv*
14+
mkdir dbs
15+
16+
17+
# set up venvs
18+
cd repo_dir
19+
20+
# make venv with some package in it (so we show that our ignore logic is correct)
21+
python3 -m venv venv
22+
venv/bin/pip install flask
23+
24+
cd "$SCRIPTDIR"
25+
26+
export CODEQL_EXTRACTOR_PYTHON_DISABLE_AUTOMATIC_VENV_EXCLUDE=
27+
$CODEQL database create dbs/normal --language python --source-root repo_dir/
28+
29+
export CODEQL_EXTRACTOR_PYTHON_DISABLE_AUTOMATIC_VENV_EXCLUDE=1
30+
$CODEQL database create dbs/no-venv-ignore --language python --source-root repo_dir/
31+
32+
# ---
33+
34+
set +x
35+
36+
EXTRACTED_NORMAL=$(unzip -l dbs/normal/src.zip | wc -l)
37+
EXTRACTED_NO_VENV_IGNORE=$(unzip -l dbs/no-venv-ignore/src.zip | wc -l)
38+
39+
exitcode=0
40+
41+
echo "EXTRACTED_NORMAL=$EXTRACTED_NORMAL"
42+
echo "EXTRACTED_NO_VENV_IGNORE=$EXTRACTED_NO_VENV_IGNORE"
43+
44+
if [[ ! $EXTRACTED_NORMAL -lt $EXTRACTED_NO_VENV_IGNORE ]]; then
45+
echo "ERROR: EXTRACTED_NORMAL not smaller EXTRACTED_NO_VENV_IGNORE"
46+
exitcode=1
47+
fi
48+
49+
exit $exitcode

0 commit comments

Comments
 (0)