From 751a9567d9ffbf2ca7de1535d7240ceff1fb3783 Mon Sep 17 00:00:00 2001 From: janosch Date: Wed, 27 Nov 2024 15:28:35 +0000 Subject: [PATCH 1/9] debugging broken unit test workflows --- .github/workflows/unit-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 23bddfb94b..64ed7b1488 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -13,6 +13,8 @@ jobs: os: [ubuntu-20.04, ubuntu-22.04] python-version: ['3.9', '3.10'] steps: + - name: Clean virtualenv + run: rm -rf /home/runner/.local/share/virtualenvs/timesketch-* - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 @@ -25,6 +27,8 @@ jobs: pipenv install -r test_requirements.txt - name: Run unit tests run: | + pipenv --venv + pipenv run pip freeze | grep pytest pipenv run python run_tests.py # Frontend tests (VueJS) From 97dfe2fcbd970004a607fcf57e42d4b38c93a648 Mon Sep 17 00:00:00 2001 From: janosch Date: Wed, 27 Nov 2024 15:40:40 +0000 Subject: [PATCH 2/9] testing newer pytest version --- .github/workflows/unit-tests.yml | 1 - test_requirements.txt | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 64ed7b1488..e77afef728 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -27,7 +27,6 @@ jobs: pipenv install -r test_requirements.txt - name: Run unit tests run: | - pipenv --venv pipenv run pip freeze | grep pytest pipenv run python run_tests.py diff --git a/test_requirements.txt b/test_requirements.txt index 9e2a92e6ce..f3f2fef9d7 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,6 +1,6 @@ Flask-Testing >= 0.6.2 mock >= 2.0.0 -pytest==7.1.3 +pytest==8.3.3 pbr >= 4.2.0 beautifulsoup4 >= 4.8.2 coverage >= 5.0.2 From faabc6ee3a716e00fc74e2a414343e516dad4548 Mon Sep 17 00:00:00 2001 From: janosch Date: Wed, 27 Nov 2024 15:46:15 +0000 Subject: [PATCH 3/9] test updated run_test script --- run_tests.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/run_tests.py b/run_tests.py index 7aa9f60148..5223887bb3 100755 --- a/run_tests.py +++ b/run_tests.py @@ -5,8 +5,7 @@ def run_python_tests(): subprocess.check_call( - "python3 -m pytest timesketch/ api_client/", - shell=True, + ["pipenv", "run", "pytest", "timesketch/", "api_client/"] ) From 60a9860b4fc59bddae73b86ee197ce5d4e045815 Mon Sep 17 00:00:00 2001 From: janosch Date: Wed, 27 Nov 2024 15:46:30 +0000 Subject: [PATCH 4/9] remove workflow step --- .github/workflows/unit-tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index e77afef728..ae183f6888 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -13,8 +13,6 @@ jobs: os: [ubuntu-20.04, ubuntu-22.04] python-version: ['3.9', '3.10'] steps: - - name: Clean virtualenv - run: rm -rf /home/runner/.local/share/virtualenvs/timesketch-* - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 From c09807aa80658f29c6d7ec4de1f447cd48a4d3f8 Mon Sep 17 00:00:00 2001 From: janosch Date: Wed, 27 Nov 2024 15:48:44 +0000 Subject: [PATCH 5/9] fix run step --- .github/workflows/unit-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index ae183f6888..23bddfb94b 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -25,7 +25,6 @@ jobs: pipenv install -r test_requirements.txt - name: Run unit tests run: | - pipenv run pip freeze | grep pytest pipenv run python run_tests.py # Frontend tests (VueJS) From 8ba35014fdf551f440cbb2f0e8978df06b1c558c Mon Sep 17 00:00:00 2001 From: janosch Date: Wed, 27 Nov 2024 15:56:48 +0000 Subject: [PATCH 6/9] testing --- .github/workflows/unit-tests.yml | 2 ++ requirements.txt | 1 + run_tests.py | 5 +---- test_requirements.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 23bddfb94b..7b2b12b872 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -23,6 +23,8 @@ jobs: pip install pipenv pipenv install -d pipenv install -r test_requirements.txt + - name: Check pytest installation + run: pipenv run pip show pytest - name: Run unit tests run: | pipenv run python run_tests.py diff --git a/requirements.txt b/requirements.txt index 8f1fcafddd..7368ce7335 100644 --- a/requirements.txt +++ b/requirements.txt @@ -38,3 +38,4 @@ prometheus-flask-exporter==0.22.4 decorator==5.0.5 geoip2==4.8.0 jsonschema==4.17.3 +pytest==7.1.3 diff --git a/run_tests.py b/run_tests.py index 5223887bb3..72162970c7 100755 --- a/run_tests.py +++ b/run_tests.py @@ -2,15 +2,12 @@ """Main entry point for running tests.""" import subprocess - def run_python_tests(): subprocess.check_call( - ["pipenv", "run", "pytest", "timesketch/", "api_client/"] + ["pytest", "timesketch/", "api_client/"] ) - def main(): run_python_tests() - main() diff --git a/test_requirements.txt b/test_requirements.txt index f3f2fef9d7..9e2a92e6ce 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,6 +1,6 @@ Flask-Testing >= 0.6.2 mock >= 2.0.0 -pytest==8.3.3 +pytest==7.1.3 pbr >= 4.2.0 beautifulsoup4 >= 4.8.2 coverage >= 5.0.2 From 7e96ce80f071f78ae6c8524f7265bea9b4626537 Mon Sep 17 00:00:00 2001 From: janosch Date: Wed, 27 Nov 2024 16:05:53 +0000 Subject: [PATCH 7/9] testing --- .github/workflows/unit-tests.yml | 6 +++--- requirements.txt | 1 - run_tests.py | 7 ++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 7b2b12b872..e637c97b1c 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -22,12 +22,12 @@ jobs: run: | pip install pipenv pipenv install -d - pipenv install -r test_requirements.txt + pipenv install -r test_requirements.txt --dev - name: Check pytest installation - run: pipenv run pip show pytest + run: pipenv run pip3 show pytest - name: Run unit tests run: | - pipenv run python run_tests.py + pipenv run python3 run_tests.py # Frontend tests (VueJS) VueJS: diff --git a/requirements.txt b/requirements.txt index 7368ce7335..8f1fcafddd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -38,4 +38,3 @@ prometheus-flask-exporter==0.22.4 decorator==5.0.5 geoip2==4.8.0 jsonschema==4.17.3 -pytest==7.1.3 diff --git a/run_tests.py b/run_tests.py index 72162970c7..1a7a3035a3 100755 --- a/run_tests.py +++ b/run_tests.py @@ -2,12 +2,13 @@ """Main entry point for running tests.""" import subprocess + def run_python_tests(): - subprocess.check_call( - ["pytest", "timesketch/", "api_client/"] - ) + subprocess.check_call(["python3", "-m", "pytest", "timesketch/", "api_client/"]) + def main(): run_python_tests() + main() From d658259f66385db9fa159feacf35c3f859dc35c7 Mon Sep 17 00:00:00 2001 From: janosch Date: Wed, 27 Nov 2024 16:16:16 +0000 Subject: [PATCH 8/9] testing --- .github/workflows/unit-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index e637c97b1c..9e534c7878 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -22,9 +22,10 @@ jobs: run: | pip install pipenv pipenv install -d + rm requirements.txt pipenv install -r test_requirements.txt --dev - name: Check pytest installation - run: pipenv run pip3 show pytest + run: pipenv run pip show pytest - name: Run unit tests run: | pipenv run python3 run_tests.py From e3525c15edb222d50e9eb0c12eab36197564d3c9 Mon Sep 17 00:00:00 2001 From: janosch Date: Wed, 27 Nov 2024 16:23:20 +0000 Subject: [PATCH 9/9] testing --- .github/workflows/unit-tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 9e534c7878..7252365cd8 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -22,8 +22,7 @@ jobs: run: | pip install pipenv pipenv install -d - rm requirements.txt - pipenv install -r test_requirements.txt --dev + pipenv run pip install -r test_requirements.txt - name: Check pytest installation run: pipenv run pip show pytest - name: Run unit tests