Skip to content

Commit

Permalink
[ci] fix python unit test ci (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
lalo authored Jul 29, 2024
1 parent 40d759b commit 727c9da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application
name: Python unit tests

on:
push:
Expand All @@ -28,12 +28,7 @@ jobs:
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
pip install .
- name: Run tests
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
python tests/unit_tests/run.py
6 changes: 5 additions & 1 deletion tests/unit_tests/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def print_colored(text, color):
# Get a list of all .py files in that directory
py_files = glob.glob(os.path.join(current_dir, "*.py"))

at_least_one_error = False
# Print the list of .py files
for file in py_files:
filename = os.path.basename(file)
Expand All @@ -31,4 +32,7 @@ def print_colored(text, color):
else:
print_colored("FAILED", RED)
print(result.stderr)
break
at_least_one_error = True

if at_least_one_error:
exit(1)

0 comments on commit 727c9da

Please sign in to comment.