Skip to content

Commit

Permalink
Merge pull request #51 from br3ndonland/drop-codecov
Browse files Browse the repository at this point in the history
Drop Codecov
  • Loading branch information
br3ndonland committed Apr 12, 2022
2 parents 455dd65 + 5143685 commit e2c8b74
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 53 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,10 @@ jobs:
esac
- name: Run pre-commit hooks
run: poetry run pre-commit run --all-files
- name: Run unit tests
run: poetry run pytest --cov-report=xml
- name: Upload test coverage report to Codecov
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
flags: unit
- name: Run tests
run: poetry run coverage run
- name: Enforce test coverage
run: poetry run coverage report
- name: Build Python package with latest Python version and publish to PyPI
if: startsWith(github.ref, 'refs/tags/') && matrix.python-version == '3.10'
run: |
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,7 @@ jobs:
esac
- name: Run pre-commit hooks
run: poetry run pre-commit run --all-files
- name: Run unit tests
run: poetry run pytest --cov-report=xml
- name: Upload test coverage report to Codecov
if: matrix.python-version == '3.10'
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
flags: unit
- name: Run tests
run: poetry run coverage run
- name: Enforce test coverage
run: poetry run coverage report
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ _Docker images and utilities to power your Python APIs and help you ship faster.
[![GitHub Container Registry](https://img.shields.io/badge/github%20container%20registry-inboard-success)](https://github.com/br3ndonland/inboard/pkgs/container/inboard)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://black.readthedocs.io/en/stable/)

[![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen?logo=pytest&logoColor=white)](https://coverage.readthedocs.io/en/latest/)
[![builds](https://github.com/br3ndonland/inboard/workflows/builds/badge.svg)](https://github.com/br3ndonland/inboard/actions)
[![hooks](https://github.com/br3ndonland/inboard/workflows/hooks/badge.svg)](https://github.com/br3ndonland/inboard/actions)
[![tests](https://github.com/br3ndonland/inboard/workflows/tests/badge.svg)](https://github.com/br3ndonland/inboard/actions)
[![codecov](https://codecov.io/gh/br3ndonland/inboard/branch/develop/graph/badge.svg)](https://codecov.io/gh/br3ndonland/inboard)

[![Mentioned in Awesome FastAPI](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/mjhea0/awesome-fastapi)

Expand Down
4 changes: 1 addition & 3 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,10 @@ As explained in the [VSCode docs](https://code.visualstudio.com/docs/containers/
- [parametrize](https://docs.pytest.org/en/latest/how-to/parametrize.html)
- [temporary directories and files (`tmp_path` and `tmp_dir`)](https://docs.pytest.org/en/latest/how-to/tmpdir.html)
- [pytest plugins](https://docs.pytest.org/en/latest/how-to/plugins.html) include:
- [pytest-cov](https://github.com/pytest-dev/pytest-cov)
- [pytest-mock](https://github.com/pytest-dev/pytest-mock)
- [pytest configuration](https://docs.pytest.org/en/latest/reference/customize.html) is in _[pyproject.toml](https://github.com/br3ndonland/inboard/blob/develop/pyproject.toml)_.
- [FastAPI testing](https://fastapi.tiangolo.com/tutorial/testing/) and [Starlette testing](https://www.starlette.io/testclient/) rely on the [Starlette `TestClient`](https://www.starlette.io/testclient/).
- Test coverage results are reported when invoking `pytest` from the command-line. To see interactive HTML coverage reports, invoke pytest with `pytest --cov-report=html`.
- Test coverage reports are generated within GitHub Actions workflows by [pytest-cov](https://github.com/pytest-dev/pytest-cov) with [coverage.py](https://github.com/nedbat/coveragepy), and uploaded to [Codecov](https://docs.codecov.io/docs) using [codecov/codecov-action](https://github.com/marketplace/actions/codecov). Codecov is then integrated into pull requests with the [Codecov GitHub app](https://github.com/marketplace/codecov).
- Test coverage reports are generated by [coverage.py](https://github.com/nedbat/coveragepy). To generate test coverage reports, first run tests with `coverage run`, then generate a report with `coverage report`. To see interactive HTML coverage reports, run `coverage html` instead of `coverage report`.

## Docker

Expand Down
5 changes: 1 addition & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ _Docker images and utilities to power your Python APIs and help you ship faster.
[![GitHub Container Registry](https://img.shields.io/badge/github%20container%20registry-inboard-success)](https://github.com/br3ndonland/inboard/pkgs/container/inboard)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://black.readthedocs.io/en/stable/)

[![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen?logo=pytest&logoColor=white)](https://coverage.readthedocs.io/en/latest/)
[![builds](https://github.com/br3ndonland/inboard/workflows/builds/badge.svg)](https://github.com/br3ndonland/inboard/actions)
[![hooks](https://github.com/br3ndonland/inboard/workflows/hooks/badge.svg)](https://github.com/br3ndonland/inboard/actions)
[![tests](https://github.com/br3ndonland/inboard/workflows/tests/badge.svg)](https://github.com/br3ndonland/inboard/actions)
[![codecov](https://codecov.io/gh/br3ndonland/inboard/branch/develop/graph/badge.svg)](https://codecov.io/gh/br3ndonland/inboard)

[![Mentioned in Awesome FastAPI](https://awesome.re/mentioned-badge-flat.svg)](https://github.com/mjhea0/awesome-fastapi)

Expand Down
21 changes: 1 addition & 20 deletions poetry.lock

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

12 changes: 10 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[tool.coverage.report]
fail_under = 100
show_missing = true

[tool.coverage.run]
command_line = "-m pytest"
source = ["inboard", "tests"]

[tool.isort]
profile = "black"
src_paths = ["inboard", "tests"]
Expand Down Expand Up @@ -44,13 +52,13 @@ starlette = {version = "^0.17", optional = true}

[tool.poetry.dev-dependencies]
black = "^22"
coverage = {version = "^6", extras = ["toml"]}
flake8 = "^4"
isort = "^5.6"
mkdocs-material = "^8"
mypy = ">0.900,<1"
pre-commit = "^2.8"
pytest = "^7"
pytest-cov = "^3"
pytest-mock = "^3.3"
pytest-timeout = "^1.4"
requests = "^2.24"
Expand All @@ -64,7 +72,7 @@ starlette = ["starlette"]
Docker = "https://github.com/br3ndonland/inboard/pkgs/container/inboard"

[tool.pytest.ini_options]
addopts = "--cov=inboard -q"
addopts = "-q"
minversion = "6.0"
testpaths = ["tests"]

Expand Down
8 changes: 4 additions & 4 deletions tests/app/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def test_get_asgi_incorrect_process_manager(
monkeypatch.setenv("WITH_RELOAD", "false")
with pytest.raises(NameError) as e:
client_asgi.get("/")
assert str(e) == "Process manager needs to be either uvicorn or gunicorn."
assert "Process manager needs to be either uvicorn or gunicorn" in str(e.value)

def test_get_root(self, client: TestClient) -> None:
"""Test a `GET` request to the root endpoint."""
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_gets_with_basic_auth_no_credentials(
"detail": "Server HTTP Basic auth credentials not set",
"error": "Incorrect username or password",
}
else:
else: # pragma: no cover
raise AssertionError("TestClient should have a FastAPI or Starlette app.")
assert error_response_json == expected_json

Expand Down Expand Up @@ -214,7 +214,7 @@ def test_gets_with_basic_auth_incorrect_credentials(
"detail": "HTTP Basic auth credentials not correct",
"error": "Incorrect username or password",
}
else:
else: # pragma: no cover
raise AssertionError("TestClient should have a FastAPI or Starlette app.")
assert error_response_json == expected_json

Expand All @@ -237,7 +237,7 @@ def test_get_status_message(
assert "FastAPI" in response_json["message"]
elif isinstance(client.app, Starlette):
assert "Starlette" in response_json["message"]
else:
else: # pragma: no cover
raise AssertionError("TestClient should have a FastAPI or Starlette app.")

def test_get_user(
Expand Down

0 comments on commit e2c8b74

Please sign in to comment.