Skip to content

Commit 9126e0c

Browse files
[HOTFIX] CI config changes
* CI coverage is missing doctests * manual workaround implemented * related work
1 parent 20ba9d8 commit 9126e0c

19 files changed

+70
-42
lines changed

.github/workflows/CI-MATs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
fi
5151
- id: get_env
5252
run: |
53-
ENV_VALUE=$(gh api "${{ github.event.workflow_run.artifacts_url }}" --jq '.environment')
53+
ENV_VALUE=$(gh api "${{ github.event.workflow_run.check_suite_url }}" --jq '.check_suite.pull_requests[0].head.repo.environment')
5454
if [[ -n "$ENV_VALUE" ]]; then
5555
echo "environment=$ENV_VALUE" >> "$GITHUB_OUTPUT"
5656
else

Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ ifndef PYTEST
9595
PYTEST=$(PYTHON) -m pytest --cache-clear --junitxml=test-reports/junit.xml -v --rootdir=.
9696
endif
9797

98+
ifndef DOCTEST_ARGS
99+
# Define common doctest flags
100+
DOCTEST_ARGS := --doctest-glob=**/*.py --doctest-modules
101+
endif
102+
98103
ifndef PIP_COMMON_FLAGS
99104
# Define common pip install flags
100105
PIP_COMMON_FLAGS := --use-pep517 --exists-action s --upgrade --upgrade-strategy eager
@@ -252,9 +257,21 @@ test-mat: test-mat-build test-mat-bootstrap test-mat-basic test-mat-say test-mat
252257
$(QUIET)$(WAIT) ;
253258
$(QUIET)$(DO_FAIL) ;
254259

260+
test-mat-doctests: MANIFEST.in ## Run doctests MAT category (doctests are special)
261+
$(QUIET)if [ -n "$$TESTS_USE_PYTEST" ]; then \
262+
$(ECHO) "SKIP: The target '$@' is not compatable with pytests;"; \
263+
$(ECHO) "Try 'make test-mat-doctests' instead."; \
264+
else \
265+
$(COVERAGE) run -p --source=multicast -m tests.run_selective --group mat --category doctests || DO_FAIL="exit 2" ; \
266+
$(COVERAGE) combine 2>$(ERROR_LOG_PATH) || : ; \
267+
$(COVERAGE) xml --include=* 2>$(ERROR_LOG_PATH) || : ; \
268+
fi
269+
$(QUIET)$(WAIT) ;
270+
$(QUIET)$(DO_FAIL) ;
271+
255272
test-mat-%: MANIFEST.in ## Run specific MAT category (basic|doctests|say|hear|usage|build|bootstrap)
256273
$(QUIET)if [ -n "$$TESTS_USE_PYTEST" ]; then \
257-
$(PYTEST) tests/ --verbose $(COVERAGE_ARGS) --junitxml=test-reports/junit.xml -v --rootdir=. -m "mat and $*" || DO_FAIL="exit 2" ; \
274+
$(PYTEST) $(COVERAGE_ARGS) -m "mat and $*" tests/ || DO_FAIL="exit 2" ; \
258275
else \
259276
$(COVERAGE) run -p --source=multicast -m tests.run_selective --group mat --category $*; \
260277
fi
@@ -263,7 +280,7 @@ test-mat-%: MANIFEST.in ## Run specific MAT category (basic|doctests|say|hear|us
263280

264281
test-extra: ## Run all extra tests
265282
$(QUIET)if [ -n "$$TESTS_USE_PYTEST" ]; then \
266-
$(PYTEST) tests/ --verbose $(COVERAGE_ARGS) -m "extra" || DO_FAIL="exit 2" ; \
283+
$(PYTEST) $(COVERAGE_ARGS) -m "extra" tests/ || DO_FAIL="exit 2" ; \
267284
else \
268285
$(COVERAGE) run -p --source=multicast -m tests.run_selective --group extra; \
269286
fi

pyproject.toml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,27 @@ docstring-convention = "google"
2424
testpaths = "tests"
2525
python_files = "test_*.py"
2626

27+
[tool.pytest.ini_options]
28+
minversion = "6.0"
29+
testpaths = "tests"
30+
python_files = "test_*.py"
31+
addopts = "--cache-clear --doctest-glob=**/*.py --doctest-modules"
32+
2733
[tool.pytest.markers]
2834
mat = "minimum acceptance tests"
29-
mat_basic = "basic component tests"
30-
mat_doctests = "documentation tests"
31-
mat_say = "send.py focused tests"
32-
mat_hear = "recv.py and hear.py focused tests"
33-
mat_usage = "__main__.py and API tests"
34-
mat_build = "build and packaging tests"
35-
mat_bootstrap = "init/exceptions/env/skt tests"
35+
basic = "basic component tests"
36+
doctests = "documentation tests"
37+
say = "send.py focused tests"
38+
hear = "recv.py and hear.py focused tests"
39+
usage = "__main__.py and API tests"
40+
build = "build and packaging tests"
41+
bootstrap = "init/exceptions/env/skt tests"
3642
extra = "additional important tests"
37-
extra_coverage = "coverage-focused tests"
38-
extra_linting = "linting tests"
39-
extra_security = "security tests"
43+
coverage = "coverage-focused tests"
44+
linting = "linting tests"
45+
security = "security tests"
4046
fuzzing = "fuzzing tests"
41-
fuzzing_basic = "smaller sub-set of fuzzing tests"
47+
slow = "smaller sub-set of fuzzing tests"
4248
performance = "performance and scalability tests"
4349

4450
[tool.pytest.enabler.flake8]

pytest.ini

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
[pytest]
2-
addopts = --doctest-modules --cov=multicast --cov-append --cov-report=xml
2+
addopts = --cache-clear --doctest-glob=**/*.py --doctest-modules --cov=multicast --cov-append --cov-report=xml --rootdir=.
33
testpaths = tests
4+
pythonpath = multicast tests
45
python_files = test_*.py
6+
python_classes = *TestSuite
57
markers =
68
mat: minimum acceptance tests
7-
mat_basic: basic component tests
8-
mat_doctests: documentation tests
9-
mat_say: send.py focused tests
10-
mat_hear: recv.py and hear.py focused tests
11-
mat_usage: __main__.py and API tests
12-
mat_build: build and packaging tests
13-
mat_bootstrap: init/exceptions/env/skt tests
9+
basic: basic component tests
10+
doctests: documentation tests
11+
say: send.py focused tests
12+
hear: recv.py and hear.py focused tests
13+
usage: __main__.py and API tests
14+
build: build and packaging tests
15+
bootstrap: init/exceptions/env/skt tests
1416
extra: additional important tests
15-
extra_coverage: coverage-focused tests
16-
extra_linting: linting tests
17-
extra_security: security tests
17+
coverage: coverage-focused tests
18+
linting: linting tests
19+
security: security tests
1820
fuzzing: fuzzing tests
19-
fuzzing_basic: smaller sub-set of fuzzing tests
21+
slow: smaller sub-set of fuzzing tests
2022
performance: performance and scalability tests
23+
junit_logging = all

tests/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ def loadDocstringsFromModule(module: types.ModuleType) -> TestSuite:
279279

280280
try:
281281
FUZZING_TESTS = {
282-
"basic": [
282+
"slow": [
283283
test_fuzz.HypothesisTestSuite, # Assuming this exists
284284
],
285285
# Future fuzzing test categories to be added
286286
}
287287
except Exception:
288-
FUZZING_TESTS = {"basic": []}
288+
FUZZING_TESTS = {"slow": []}
289289

290290
PERFORMANCE_TESTS = {
291291
"scalability": [], # Future implementation

tests/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ pep8>=1.0
5353
pytest>=7.0, !=8.1.0
5454
# pytest-checkdocs - MIT license
5555
pytest-checkdocs>=1.2.5
56+
# pytest-doctestplus - BSD license
57+
pytest-doctestplus>=1.4.0
5658
# pytest-cov - MIT license
5759
pytest-cov>=3.0.0
5860
# pytest-enabler - MIT license

tests/test_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
raise ImportError("[CWE-758] Failed to import test context") from _cause
3636

3737

38-
@context.markWithMetaTag("mat", "mat_basic")
38+
@context.markWithMetaTag("mat", "basic")
3939
class BasicTestSuite(context.BasicUsageTestSuite):
4040
"""
4141
A test suite containing basic test cases for the multicast module.

tests/test_build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
raise ImportError("[CWE-758] Failed to import test context") from _cause
5757

5858

59-
@context.markWithMetaTag("mat", "mat_build")
59+
@context.markWithMetaTag("mat", "build")
6060
class BuildPEP517TestSuite(BasicUsageTestSuite):
6161

6262
__module__ = "tests.test_build"

tests/test_deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
raise ImportError("[CWE-440] venv Failed to import.") from _cause
4747

4848

49-
@context.markWithMetaTag("extra", "extra_coverage")
49+
@context.markWithMetaTag("extra", "coverage")
5050
class BuildRequirementsTxtTestSuite(context.BasicUsageTestSuite):
5151
"""Test cases for 'tests/requirements.txt'."""
5252

tests/test_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
raise ImportError("[CWE-758] Failed to import test context") from _cause
4747

4848

49-
@context.markWithMetaTag("mat", "mat_bootstrap")
49+
@context.markWithMetaTag("mat", "bootstrap")
5050
class ExceptionsTestSuite(BasicUsageTestSuite):
5151
"""
5252
Test suite for validating the behavior of exception classes in the multicast package.

0 commit comments

Comments
 (0)