Skip to content

Commit 727c9da

Browse files
authoredJul 29, 2024
[ci] fix python unit test ci (microsoft#2)
1 parent 40d759b commit 727c9da

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed
 

‎.github/workflows/python-app.yml

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a single version of Python
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
33

4-
name: Python application
4+
name: Python unit tests
55

66
on:
77
push:
@@ -28,12 +28,7 @@ jobs:
2828
python -m pip install --upgrade pip
2929
pip install flake8 pytest
3030
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31-
- name: Lint with flake8
31+
pip install .
32+
- name: Run tests
3233
run: |
33-
# stop the build if there are Python syntax errors or undefined names
34-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37-
- name: Test with pytest
38-
run: |
39-
pytest
34+
python tests/unit_tests/run.py

‎tests/unit_tests/run.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def print_colored(text, color):
1818
# Get a list of all .py files in that directory
1919
py_files = glob.glob(os.path.join(current_dir, "*.py"))
2020

21+
at_least_one_error = False
2122
# Print the list of .py files
2223
for file in py_files:
2324
filename = os.path.basename(file)
@@ -31,4 +32,7 @@ def print_colored(text, color):
3132
else:
3233
print_colored("FAILED", RED)
3334
print(result.stderr)
34-
break
35+
at_least_one_error = True
36+
37+
if at_least_one_error:
38+
exit(1)

0 commit comments

Comments
 (0)
Please sign in to comment.