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

Adds testing and coverage suites #53

Merged
merged 20 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e8329e8
Adding testing and coverage functionality
CyclingNinja Feb 27, 2024
f336761
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 27, 2024
b6aadae
Update {{ cookiecutter.package_name }}/pytest.ini
CyclingNinja Feb 27, 2024
2dc738e
Update {{ cookiecutter.package_name }}/.coveragerc
CyclingNinja Feb 27, 2024
db32c9b
Update {{ cookiecutter.package_name }}/.coveragerc
CyclingNinja Feb 27, 2024
badc1b3
Attempt to fix build
Cadair Feb 28, 2024
f2659ee
Update {{ cookiecutter.package_name }}/.coveragerc
CyclingNinja Feb 29, 2024
9644ba6
Update {{ cookiecutter.package_name }}/.coveragerc
CyclingNinja Feb 29, 2024
9a163c5
Update {{ cookiecutter.package_name }}/.coveragerc
CyclingNinja Feb 29, 2024
f5ba24a
Update {{ cookiecutter.package_name }}/.coveragerc
CyclingNinja Feb 29, 2024
d3d7eed
Update {{ cookiecutter.package_name }}/pytest.ini
CyclingNinja Feb 29, 2024
91fbadb
Merge branch 'main' into pytest_org
CyclingNinja Feb 29, 2024
d0935ea
Update {{ cookiecutter.package_name }}/.coveragerc
CyclingNinja Mar 1, 2024
830d653
Cleans up .coveragerc file
CyclingNinja Mar 1, 2024
5a31b5f
Merge branch 'main' of github.com:sunpy/package-template into pytest_org
CyclingNinja Mar 1, 2024
e52e3fd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 1, 2024
2a21696
Remove unnessesary test
CyclingNinja Mar 1, 2024
e906434
Merge branch 'pytest_org' of github.com:CyclingNinja/package-template…
CyclingNinja Mar 1, 2024
5c00702
Apply suggestions from code review
Cadair Mar 1, 2024
95b84e9
Merge branch 'main' into pytest_org
Cadair Mar 1, 2024
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
11 changes: 11 additions & 0 deletions {{ cookiecutter.package_name }}/.codecov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
comment: off
coverage:
status:
project:
default:
threshold: 0.2%

codecov:
require_ci_to_pass: false
notify:
wait_for_ci: true
30 changes: 30 additions & 0 deletions {{ cookiecutter.package_name }}/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[run]
omit =
{{ cookiecutter.module_name }}/conftest.py
{{ cookiecutter.module_name }}/*setup_package*
{{ cookiecutter.module_name }}/extern/*
{{ cookiecutter.module_name }}/version*
*/{{ cookiecutter.module_name }}/conftest.py
*/{{ cookiecutter.module_name }}/*setup_package*
*/{{ cookiecutter.module_name }}/extern/*
*/{{ cookiecutter.module_name }}/version*

[report]
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about packages we have installed
except ImportError
# Don't complain if tests don't hit assertions
raise AssertionError
raise NotImplementedError
# Don't complain about script hooks
def main(.*):
# Ignore branches that don't pertain to this version of Python
pragma: py{ignore_python_version}
# Don't complain about IPython completion helper
def _ipython_key_completions_
# typing.TYPE_CHECKING is False at runtime
if TYPE_CHECKING:
# Ignore typing overloads
@overload
44 changes: 0 additions & 44 deletions {{ cookiecutter.package_name }}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,47 +61,3 @@ write_to = "{{ cookiecutter.module_name }}/_version.py"
{%- else -%}
write_to = "{{ cookiecutter.module_name }}/version.py"
{%- endif %}

[tool.pytest.ini_options]
testpaths = [
"{{ cookiecutter.module_name }}",
"docs",
]
doctest_plus = "enabled"
text_file_format = "rst"
addopts = "--doctest-rst"

[tool.coverage.run]
omit = [
"{{ cookiecutter.module_name }}/_{{ cookiecutter._parent_project }}_init*",
"{{ cookiecutter.module_name }}/conftest.py",
"{{ cookiecutter.module_name }}/*setup_package*",
"{{ cookiecutter.module_name }}/tests/*",
"{{ cookiecutter.module_name }}/*/tests/*",
"{{ cookiecutter.module_name }}/extern/*",
"{{ cookiecutter.module_name }}/version*",
"*/{{ cookiecutter.module_name }}/_{{ cookiecutter._parent_project }}_init*",
"*/{{ cookiecutter.module_name }}/conftest.py",
"*/{{ cookiecutter.module_name }}/*setup_package*",
"*/{{ cookiecutter.module_name }}/tests/*",
"*/{{ cookiecutter.module_name }}/*/tests/*",
"*/{{ cookiecutter.module_name }}/extern/*",
"*/{{ cookiecutter.module_name }}/version*",
]

[tool.coverage.report]
exclude_lines = [
# Have to re-enable the standard pragma
"pragma: no cover",
# Don't complain about packages we have installed
"except ImportError",
# Don't complain if tests don't hit assertions
"raise AssertionError",
"raise NotImplementedError",
# Don't complain about script hooks
"def main(.*):",
# Ignore branches that don't pertain to this version of Python
"pragma: py{ignore_python_version}",
# Don't complain about IPython completion helper
"def _ipython_key_completions_",
]
27 changes: 27 additions & 0 deletions {{ cookiecutter.package_name }}/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[pytest]
minversion = 7.0
testpaths =
{{ cookiecutter.module_name }}
docs
norecursedirs =
.tox
build
docs/_build
docs/generated
*.egg-info
examples
{{ cookiecutter.module_name }}/_dev
.history
{{ cookiecutter.module_name }}/extern
doctest_plus = enabled
doctest_optionflags = NORMALIZE_WHITESPACE FLOAT_CMP ELLIPSIS
text_file_format = rst
addopts = --doctest-rst -p no:unraisableexception -p no:threadexception
filterwarnings =
# Turn all warnings into errors so they do not pass silently.
error
# Do not fail on pytest config issues (i.e. missing plugins) but do show them
always::pytest.PytestConfigWarning
# A list of warnings to ignore follows. If you add to this list, you MUST
# add a comment or ideally a link to an issue that explains why the warning
# is being ignored
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,3 @@ def test_primes_c():
def test_primes():
from ..example_mod import primes
assert primes(10) == [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]


def test_deprecation():
import warnings
warnings.warn(
"This is deprecated, but shouldn't raise an exception, unless "
"enable_deprecations_as_exceptions() called from conftest.py",
DeprecationWarning)