Skip to content

Commit fc6e953

Browse files
authored
Streamlined coverage processing and versions (#2084)
Signed-off-by: Andreas Maier <maiera@de.ibm.com>
1 parent 8ab56a6 commit fc6e953

3 files changed

Lines changed: 16 additions & 25 deletions

File tree

Makefile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,6 @@ test_common_py_files := \
220220
# Directory for .done files
221221
done_dir := done
222222

223-
# Determine whether pytest has the --no-print-logs option.
224-
pytest_no_log_opt := $(shell pytest --help 2>/dev/null |grep '\--no-print-logs' >/dev/null; if [ $$? -eq 0 ]; then echo '--no-print-logs'; else echo ''; fi)
225-
226223
# Flake8 config file
227224
flake8_rc_file := .flake8
228225

@@ -256,10 +253,11 @@ check_py_files := \
256253
# Packages whose dependencies are checked using pip-missing-reqs
257254
check_reqs_packages := pip_check_reqs virtualenv tox pipdeptree build pytest coverage coveralls flake8 ruff pylint jupyter notebook safety bandit towncrier sphinx
258255

256+
pytest_general_opts := -s --color=yes
259257
ifdef TESTCASES
260-
pytest_opts := $(TESTOPTS) -k '$(TESTCASES)'
258+
pytest_test_opts := $(TESTOPTS) -k '$(TESTCASES)'
261259
else
262-
pytest_opts := $(TESTOPTS)
260+
pytest_test_opts := $(TESTOPTS)
263261
endif
264262

265263
coverage_config_file := .coveragerc
@@ -692,13 +690,13 @@ endif
692690

693691
.PHONY: unittest
694692
unittest: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done $(package_py_files) $(test_unit_py_files) $(test_common_py_files) $(coverage_config_file)
695-
bash -c "PYTHONPATH=. coverage run --append -m pytest --color=yes $(pytest_no_log_opt) -s $(pytest_opts) $(test_dir)/unit"
693+
bash -c "PYTHONPATH=. coverage run --append -m pytest $(pytest_general_opts) $(pytest_test_opts) $(test_dir)/unit"
696694
coverage html
697695
@echo "Makefile: $@ done."
698696

699697
.PHONY: functiontest
700698
functiontest: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done $(package_py_files) $(test_function_py_files) $(test_function_yaml_files) $(test_common_py_files) $(coverage_config_file)
701-
bash -c "PYTHONPATH=. coverage run --append -m pytest --color=yes $(pytest_no_log_opt) -s $(pytest_opts) $(test_dir)/function"
699+
bash -c "PYTHONPATH=. coverage run --append -m pytest $(pytest_general_opts) $(pytest_test_opts) $(test_dir)/function"
702700
coverage html
703701
@echo "Makefile: $@ done."
704702

@@ -717,14 +715,14 @@ endif
717715

718716
.PHONY: end2end
719717
end2end: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done $(package_py_files) $(test_end2end_py_files) $(test_common_py_files) $(coverage_config_file)
720-
bash -c "PYTHONPATH=. TESTEND2END_LOAD=true coverage run --append -m pytest --color=yes $(pytest_no_log_opt) -v -s -m 'not check_hmcs' $(pytest_opts) $(test_dir)/end2end"
718+
bash -c "PYTHONPATH=. TESTEND2END_LOAD=true coverage run --append -m pytest -v -m 'not check_hmcs' $(pytest_general_opts) $(pytest_test_opts) $(test_dir)/end2end"
721719
coverage html
722720
@echo "Makefile: $@ done."
723721

724722
# TODO: Enable rc checking again once the remaining issues are resolved
725723
.PHONY: end2end_mocked
726724
end2end_mocked: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done $(package_py_files) $(test_end2end_py_files) $(test_common_py_files) $(coverage_config_file) tests/end2end/mocked_inventory.yaml tests/end2end/mocked_vault.yaml tests/end2end/mocked_hmc_z16.yaml
727-
bash -c "PYTHONPATH=. TESTEND2END_LOAD=true TESTINVENTORY=tests/end2end/mocked_inventory.yaml TESTVAULT=tests/end2end/mocked_vault.yaml coverage run --append -m pytest --color=yes $(pytest_no_log_opt) -v -s -m 'not check_hmcs' $(pytest_opts) $(test_dir)/end2end"
725+
bash -c "PYTHONPATH=. TESTEND2END_LOAD=true TESTINVENTORY=tests/end2end/mocked_inventory.yaml TESTVAULT=tests/end2end/mocked_vault.yaml coverage run --append -m pytest -v -m 'not check_hmcs' $(pytest_general_opts) $(pytest_test_opts) $(test_dir)/end2end"
728726
coverage html
729727
@echo "Makefile: $@ done."
730728

@@ -750,5 +748,5 @@ end2end_show:
750748
.PHONY: end2end_check
751749
end2end_check: $(done_dir)/develop_$(pymn)_$(PACKAGE_LEVEL).done $(package_py_files) $(test_end2end_py_files) $(test_common_py_files) $(coverage_config_file)
752750
-$(call RMDIR_R_FUNC,htmlcov.end2end)
753-
bash -c "TESTEND2END_LOAD=true TESTCASES=test_hmcdef_check_all_hmcs coverage run --append -m pytest --color=yes $(pytest_no_log_opt) -v -s -m check_hmcs $(pytest_opts) $(test_dir)/end2end"
751+
bash -c "TESTEND2END_LOAD=true TESTCASES=test_hmcdef_check_all_hmcs coverage run --append -m pytest -v -m check_hmcs $(pytest_general_opts) $(pytest_test_opts) $(test_dir)/end2end"
754752
@echo "Makefile: $@ done."

dev-requirements.txt

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,11 @@ pluggy>=1.5.0
4646
# decorator: covered in requirements.txt
4747

4848
# Coverage reporting (no imports, invoked via coveralls script):
49-
# coveralls versions 4.0.0/4.0.1 have increased their pinning of coverage to <8,
50-
# but they have also added a constraint for Python to <3.13. Due to that
51-
# Python pinning, we need to use the older coverage and coveralls versions on
52-
# Python>=3.13.
53-
# Note: The earlier repetition of pinnings to avoid pip backtracking no longer
54-
# seems to be needed.
55-
coverage>=7.8.0,<8.0; python_version <= '3.12'
56-
coverage>=6.5.0,<7.0; python_version >= '3.13'
57-
coveralls>=4.0.1; python_version <= '3.12'
58-
coveralls>=3.3.0; python_version >= '3.13'
59-
# PyYAML: covered in direct deps for development
49+
# coveralls versions 4.0.0/4.0.1 require Python>=3.8 and pin Python<=3.12.
50+
# coveralls version 4.0.2 requires Python>=3.10 and no longer pins to a Python 3.x version.
51+
coverage>=7.8.0
52+
coveralls>=4.0.1; python_version == '3.9'
53+
coveralls>=4.0.2; python_version >= '3.10'
6054

6155
# Safety CI by pyup.io
6256
# safety 3.6.1 fixes the issue with typer >=0.17.0, see https://github.com/pyupio/safety/issues/778

minimum-constraints-develop.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ rfc3986-validator==0.1.1
3939
# decorator: covered in direct deps for installation
4040

4141
# Coverage reporting (no imports, invoked via coveralls script):
42-
coverage==7.8.0; python_version <= '3.12'
43-
coverage==6.5.0; python_version >= '3.13'
44-
coveralls==4.0.1; python_version <= '3.12'
45-
coveralls==3.3.0; python_version >= '3.13'
42+
coverage==7.8.0
43+
coveralls==4.0.1; python_version == '3.9'
44+
coveralls==4.0.2; python_version >= '3.10'
4645

4746
# Safety CI by pyup.io
4847
safety==3.6.2

0 commit comments

Comments
 (0)