Skip to content

Commit

Permalink
Can you hear me now?
Browse files Browse the repository at this point in the history
  • Loading branch information
dbutenhof committed Dec 6, 2024
1 parent 713d0ec commit 9b169c1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Run Unit Test via Pytest
name: Python checks

on:
push:
branches: ["main"]
tags-ignore: ["**"]
pull_request:

env:
COVERAGE: ${{ github.workspace }}/coverage

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -24,6 +27,7 @@ jobs:
python -m pip install --upgrade pip
pip install tox>=4.19
- name: Check for lint
# Report errors but don't fail until we achieve stability!
continue-on-error: true
run: |
cd backend
Expand All @@ -32,10 +36,12 @@ jobs:
run: |
cd backend
tox -e unit
- name: Add coverage data to conversation
run: cat $COVERAGE/coverage.txt >> $GITHUB_STEP_SUMMARY
- name: Publish coverage data
uses: actions/upload-artifact@v4
with:
name: Coverage for ${{ github.event.head_commit.id }}
path: backend/.tox/unit/tmp/coverage.db
path: ${{ env.COVERAGE }}/html
if-no-files-found: warn
retention-days: 30
11 changes: 10 additions & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,17 @@ deps = [
"pytest",
"pytest-asyncio",
"pytest-cov",
"coverage",
]
set_env.COVERAGE = { replace = "env", name = "COVERAGE", default = "/var/tmp/{env:USER}" }
allowlist_externals = ["bash", "echo", "coverage"]
commands = [
["echo", "{env:COVERAGE}"],
["pip", "list"],
["pytest", "-s", "--cov-branch", "--cov=app", "tests"],
["coverage", "html", "--directory={env:COVERAGE}/html"],
["bash", "-c", "coverage report --format=markdown >{env:COVERAGE}/coverage.txt"],
]
commands = [["pip", "list"],["pytest", "-s", "--cov-report=term", "--cov-branch", "--cov-report=html:.tox/unit/tmp/coverage.db", "--cov=app", "tests"]]

[tool.tox.env.format]
description = "check code format"
Expand Down
1 change: 0 additions & 1 deletion backend/tests/test_crucible.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ async def test_metric_ids_none(self, fake_elastic):
"""A simple query for failure matching metric IDs"""

crucible = CrucibleService("TEST")
print(f"Elastic is {type(crucible.elastic).__name__}")
crucible.elastic.set_query("metric_desc", [])
with pytest.raises(HTTPException) as e:
await crucible._get_metric_ids("runid", "source::type")
Expand Down

0 comments on commit 9b169c1

Please sign in to comment.