Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve coverage #25

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
env_vars: PYTHON
- run: coverage report --precision=2 --fail-under=99
- run: coverage report --fail-under=99

# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
check:
Expand Down
24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,27 @@ filterwarnings = [
"ignore:The 'app' shortcut is now deprecated.*:DeprecationWarning:httpx*:",
]
DJANGO_SETTINGS_MODULE = "tests.otel_integrations.django_test_project.django_test_site.settings"

# https://coverage.readthedocs.io/en/latest/config.html#run
[tool.coverage.run]
branch = true

# https://coverage.readthedocs.io/en/latest/config.html#report
[tool.coverage.report]
skip_covered = true
show_missing = true
ignore_errors = true
precision = 2
exclude_lines = [
'def __repr__',
'pragma: no cover',
'raise NotImplementedError',
'if TYPE_CHECKING:',
'if typing.TYPE_CHECKING:',
'@overload',
'@typing.overload',
'\(Protocol\):$',
'typing.assert_never',
'assert_never',
'if __name__ == .__main__.:',
]
9 changes: 8 additions & 1 deletion tests/test_testing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

import logfire
from logfire.testing import CaptureLogfire, TestExporter
from logfire.testing import CaptureLogfire, TestExporter, TimeGenerator


def test_reset_exported_spans(exporter: TestExporter) -> None:
Expand Down Expand Up @@ -77,3 +77,10 @@ def test_capfire_fixture(capfire: CaptureLogfire) -> None:
],
},
]


def test_time_generator():
t = TimeGenerator()
assert t() == 1000000000
assert t() == 2000000000
assert repr(t) == 'TimeGenerator(ns_time=2000000000)'