Skip to content

Commit

Permalink
add CI job for running unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Randall-Scharpf committed Sep 12, 2024
1 parent 2f36579 commit 6fb76a0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
permissions:
contents: read

jobs:
unit_tests:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v3
with:
python-version: "3.6"
- run: |
python -m pip install --upgrade pip
pip install pytest
- run: |
python tools/build_unit_tests.py --run_tests
5 changes: 4 additions & 1 deletion tools/build_unit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def CYAN(text):
if args.run_tests:
pytest_directories.append(test_app_dir)

tests_passed = True
for test_app_dir in pytest_directories:
print(CYAN(f"Running pytest for {test_app_dir}..."))
subprocess.run(["python", "-m", "pytest"], cwd=test_app_dir)
if subprocess.run(["python", "-m", "pytest"], cwd=test_app_dir).returncode != 0:
tests_passed = False
exit(0 if tests_passed else 1)
2 changes: 1 addition & 1 deletion unit_tests/shared/drivers/ads1118_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import ads1118


class TestStringMethods(unittest.TestCase):
class ADS1118_Test(unittest.TestCase):

def test_parameter_validation(self):

Expand Down

0 comments on commit 6fb76a0

Please sign in to comment.