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

CI: Add test coverage #1959

Merged
merged 7 commits into from
Aug 31, 2023
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
8 changes: 6 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ jobs:
channels: conda-forge
- name: Install Nebari
run: |
pip install .[dev]
pip install -e .[dev]
conda install --quiet --yes conda-build
- name: Test Nebari
run: |
pytest --version
pytest --ignore=tests/tests_deployment --ignore=tests/tests_e2e/playwright --ignore=tests/tests_integration
pytest --cov=src --cov-report=xml --cov-config=pyproject.toml tests/tests_unit

- name: Report Coverage
run: |
coverage report -m
25 changes: 25 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ dev = [
"pytest",
"pytest-timeout",
"pytest-playwright",
"pytest-cov",
"coverage[toml]",
"grayskull",
"build",
"jinja2",
Expand Down Expand Up @@ -115,3 +117,26 @@ extend-exclude = [
"home",
"__pycache__"
]

[tool.coverage.run]
branch = true

[tool.coverage.report]
# Regexes for lines to exclude from consideration
exclude_also = [
# Don't complain about missing debug-only code:
"def __repr__",
"if self\\.debug",

# Don't complain if tests don't hit defensive assertion code:
"raise AssertionError",
"raise NotImplementedError",

# Don't complain if non-runnable code isn't run:
"if 0:",
"if __name__ == .__main__.:",

# Don't complain about abstract methods, they aren't run:
"@(abc\\.)?abstractmethod",
]
ignore_errors = false
2 changes: 1 addition & 1 deletion src/_nebari/provider/cloud/commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def filter_by_highest_supported_k8s_version(k8s_versions_list):
filtered_k8s_versions_list = []
for k8s_version in k8s_versions_list:
version = tuple(
filter(None, re.search("(\d+)\.(\d+)(?:\.(\d+))?", k8s_version).groups())
filter(None, re.search(r"(\d+)\.(\d+)(?:\.(\d+))?", k8s_version).groups())
iameskild marked this conversation as resolved.
Show resolved Hide resolved
)
if version <= HIGHEST_SUPPORTED_K8S_VERSION:
filtered_k8s_versions_list.append(k8s_version)
Expand Down