Skip to content

Commit

Permalink
Merge pull request #2 from GSA/pytest-coverage
Browse files Browse the repository at this point in the history
change project name and fix pytest coverage
Jin-Sun-tts authored Apr 13, 2023
2 parents 74e6215 + fb236cc commit 1313925
Showing 7 changed files with 115 additions and 16 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/commit.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: lint and tests
on: [push]
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
@@ -21,10 +22,14 @@ jobs:
run: poetry install

- name: Run Pytest
run: poetry run pytest
run: poetry run pytest --junitxml=pytest.xml --cov=datagovharvester | tee pytest-coverage.txt

- name: Report test coverage
uses: coroo/pytest-coverage-commentator@v1.0.2
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: pytest-coverage.txt
junitxml-path: pytest.xml
github-token: ${{ secrets.GITHUB_TOKEN }}

lint:
runs-on: ubuntu-latest
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pytest.xml
pytest-coverage.txt
.coverage
.pytest_cache
.DS_Store
File renamed without changes.
File renamed without changes.
104 changes: 95 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
[tool.poetry]
name = "datagov-harvesting-logic"
name = "datagovharvester"
version = "0.1.0"
description = ""
authors = ["Jin-Sun-tts <jin.sun@gsa.gov>"]
readme = "README.md"
packages = [{include = "demo", from = "src"}]
packages = [{include = "datagovharvester"}]

[tool.poetry.dependencies]
python = "^3.9"

[tool.poetry.group.dev.dependencies]
pytest = "^7.3.0"
ruff = "^0.0.261"
pytest-cov = "^4.0.0"

[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
4 changes: 2 additions & 2 deletions tests/test_demo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from demo import __version__
from demo.example import hello
from datagovharvester import __version__
from datagovharvester.example import hello

def test_version():
assert __version__ == "0.1.0"

1 comment on commit 1313925

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
datagovharvester
   __init__.py10100% 
   example.py944 56%
TOTAL10460% 

Tests Skipped Failures Errors Time
2 0 💤 0 ❌ 0 🔥 0.113s ⏱️

Please sign in to comment.