Skip to content

Commit

Permalink
Merge branch 'master' into cov-params
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault authored Feb 1, 2025
2 parents ea3a462 + d11b889 commit 3d01a6d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
42 changes: 24 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,29 @@ ifeq ($(filter $(TEST_VERBOSITY),"--capture"),)
TEST_VERBOSITY := $(TEST_VERBOSITY) --capture tee-sys
endif
endif

TEST_PROFILE ?= true
ifneq ($(filter "$(TEST_PROFILE)","true"),)
override TEST_PROFILE_ARGS = --profile --profile-svg --pstats-dir "$(REPORTS_DIR)/profiling" --durations 100
endif

TEST_XARGS ?=
override TEST_XARGS := $(TEST_VERBOSITY) $(TEST_PROFILE_ARGS) $(TEST_XARGS)

# autogen tests variants with pre-install of dependencies using the '-only' target references
TESTS := unit func cli workflow online offline no-tb14 spec coverage
TESTS := $(addprefix test-, $(TESTS))

$(TESTS): test-%: install-dev test-%-only

define run_test =
$(eval $@_PYTEST_JUNIT = --junitxml "$(REPORTS_DIR)/test-results.xml")
$(eval $@_PYTEST_CASE = $(1))
$(eval $@_PYTEST_CMD = pytest tests ${$@_PYTEST_CASE} $(TEST_XARGS) ${$@__PYTEST_JUNIT})
@echo ">" '${$@_PYTEST_CMD}'
@bash -c '${$@_PYTEST_CMD}'
endef

.PHONY: test
test: clean-test test-all ## alias for 'test-all' target

Expand All @@ -398,57 +413,48 @@ test-all: install-dev test-only ## run all tests (including long running tests)
.PHONY: test-only
test-only: mkdir-reports ## run all tests but without prior validation of installed dependencies
@echo "Running all tests (including slow and online tests)..."
@bash -c '$(CONDA_CMD) pytest tests $(TEST_VERBOSITY) $(TEST_XARGS) \
--junitxml "$(REPORTS_DIR)/test-results.xml"'
@$(call run_test,)

.PHONY: test-unit-only
test-unit-only: mkdir-reports ## run unit tests (skip long running and online tests)
@echo "Running unit tests (skip slow and online tests)..."
@bash -c '$(CONDA_CMD) pytest tests $(TEST_VERBOSITY) $(TEST_XARGS) \
-m "not slow and not online and not functional" --junitxml "$(REPORTS_DIR)/test-results.xml"'
@$(call run_test,-m "not slow and not online and not functional")

.PHONY: test-func-only
test-func-only: mkdir-reports ## run functional tests (online and usage specific)
@echo "Running functional tests..."
@bash -c '$(CONDA_CMD) pytest tests $(TEST_VERBOSITY) $(TEST_XARGS) \
-m "functional" --junitxml "$(REPORTS_DIR)/test-results.xml"'
@$(call run_test,-m "functional")

.PHONY: test-cli-only
test-cli-only: mkdir-reports ## run WeaverClient and CLI tests
@echo "Running CLI tests..."
@bash -c '$(CONDA_CMD) pytest tests $(TEST_VERBOSITY) $(TEST_XARGS) \
-m "cli" --junitxml "$(REPORTS_DIR)/test-results.xml"'
@$(call run_test,-m "cli")

.PHONY: test-workflow-only
test-workflow-only: mkdir-reports ## run EMS workflow End-2-End tests
@echo "Running workflow tests..."
@bash -c '$(CONDA_CMD) pytest tests $(TEST_VERBOSITY) $(TEST_XARGS) \
-m "workflow" --junitxml "$(REPORTS_DIR)/test-results.xml"'
@$(call run_test,-m "workflow")

.PHONY: test-online-only
test-online-only: mkdir-reports ## run online tests (running instance required)
@echo "Running online tests (running instance required)..."
@bash -c '$(CONDA_CMD) pytest tests $(TEST_VERBOSITY) $(TEST_XARGS) \
-m "online" --junitxml "$(REPORTS_DIR)/test-results.xml"'
@$(call run_test,-m "online")

.PHONY: test-offline-only
test-offline-only: mkdir-reports ## run offline tests (not marked as online)
@echo "Running offline tests (not marked as online)..."
@bash -c '$(CONDA_CMD) pytest tests $(TEST_VERBOSITY) $(TEST_XARGS) \
-m "not online" --junitxml "$(REPORTS_DIR)/test-results.xml"'
@$(call run_test,-m "not online")

.PHONY: test-no-tb14-only
test-no-tb14-only: mkdir-reports ## run all tests except ones marked for 'Testbed-14'
@echo "Running all tests except ones marked for 'Testbed-14'..."
@bash -c '$(CONDA_CMD) pytest tests $(TEST_VERBOSITY) $(TEST_XARGS) \
-m "not testbed14" --junitxml "$(REPORTS_DIR)/test-results.xml"'
@$(call run_test,-m "not testbed14")

.PHONY: test-spec-only
test-spec-only: mkdir-reports ## run tests with custom specification (pytest format) [make SPEC='<spec>' test-spec]
@echo "Running custom tests from input specification..."
@[ "${SPEC}" ] || ( echo ">> 'SPEC' is not set"; exit 1 )
@bash -c '$(CONDA_CMD) pytest tests $(TEST_VERBOSITY) $(TEST_XARGS) \
-k "${SPEC}" --junitxml "$(REPORTS_DIR)/test-results.xml"'
@$(call run_test,-k "${SPEC}")

.PHONY: test-smoke
test-smoke: docker-test ## alias to 'docker-test' executing smoke test of built docker images
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ path!=16.12.0,!=17.0.0 # patch pytest-shutil (https://github.com/man-group/pyte
pluggy>=0.7
pytest
pytest-httpserver>=1.0.7 # support werkzeug>=3
pytest-profiling
pytest-server-fixtures
#pytest-rerunfailures
pytest-retry
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ ruamel.yaml>=0.16
# force use of later mistune (https://github.com/common-workflow-language/schema_salad/pull/619#issuecomment-1346025607)
# employed by cwltool -> schema-salad -> mistune
schema-salad>=8.3.20221209165047,<9
shapely
shapely<=2.0.6 # patch fix against unresolved GEOS library (https://github.com/shapely/shapely/issues/2212)
simplejson
# urllib3 not directly required, pinned by Snyk to avoid CVE-2024-37891
# Python<3.10 error via pip, avoid endless package install lookup error with botocore
Expand Down

0 comments on commit 3d01a6d

Please sign in to comment.