From ed465b391c884656aa1b6ed0c265ac3e718a6947 Mon Sep 17 00:00:00 2001 From: Marcel Telka <marcel@telka.sk> Date: Sun, 12 Nov 2023 18:36:27 +0100 Subject: [PATCH] setup.py.mk: disable all pytest plugins --- make-rules/setup.py.mk | 45 ++++++++++++++++++++++++++++++++++++++------- 1 files changed, 38 insertions(+), 7 deletions(-) diff --git a/make-rules/setup.py.mk b/make-rules/setup.py.mk index da56c3f..58050b2 100644 --- a/make-rules/setup.py.mk +++ b/make-rules/setup.py.mk @@ -411,29 +411,48 @@ # Force pytest to not use colored output so the results normalization is unaffected PYTEST_ADDOPTS += --color=no -# -# Some pytest plugins are enabled automatically and could affect test results -# or test output. In a case a component does not expect such a plugin -# installed (it is neither in REQUIRED_PACKAGES nor in TEST_REQUIRED_PACKAGES) -# we simply disable the plugin to get consistent test results. -# +# Avoid loading of unexpected pytest plugins. define disable-pytest-plugin -PYTEST_ADDOPTS += $$(if $$(filter library/python/$(2)-$$(subst .,,$$(PYTHON_VERSION)), $$(REQUIRED_PACKAGES) $$(TEST_REQUIRED_PACKAGES) $$(COMPONENT_FMRI)-$$(subst .,,$$(PYTHON_VERSION))),,-p no:$(1)) +PYTEST_ADDOPTS += $$(if $$(filter library/python/$(2)-$$(subst .,,$$(PYTHON_VERSION)), $$(REQUIRED_PACKAGES) $$(TEST_REQUIRED_PACKAGES) $$(COMPONENT_FMRI)-$$(subst .,,$$(PYTHON_VERSION))),,-p 'no:$(1)') endef +$(eval $(call disable-pytest-plugin,anyio,anyio)) $(eval $(call disable-pytest-plugin,asyncio,pytest-asyncio)) # adds line to test report header $(eval $(call disable-pytest-plugin,benchmark,pytest-benchmark)) # adds line to test report header; adds benchmark report $(eval $(call disable-pytest-plugin,black,pytest-black)) # runs extra test(s) +$(eval $(call disable-pytest-plugin,check,pytest-check)) $(eval $(call disable-pytest-plugin,checkdocs,pytest-checkdocs)) # runs extra test(s) +$(eval $(call disable-pytest-plugin,console-scripts,pytest-console-scripts)) $(eval $(call disable-pytest-plugin,cov,pytest-cov)) +$(eval $(call disable-pytest-plugin,custom_exit_code,pytest-custom-exit-code)) +$(eval $(call disable-pytest-plugin,env,pytest-env)) +$(eval $(call disable-pytest-plugin,faker,faker)) +$(eval $(call disable-pytest-plugin,flake8,pytest-flake8)) $(eval $(call disable-pytest-plugin,flaky,flaky)) +$(eval $(call disable-pytest-plugin,freezegun,pytest-freezegun)) +$(eval $(call disable-pytest-plugin,freezer,pytest-freezer)) +$(eval $(call disable-pytest-plugin,helpers_namespace,pytest-helpers-namespace)) $(eval $(call disable-pytest-plugin,hypothesispytest,hypothesis)) # adds line to test report header +$(eval $(call disable-pytest-plugin,jaraco.test.http,jaraco-test)) +$(eval $(call disable-pytest-plugin,kgb,kgb)) +$(eval $(call disable-pytest-plugin,lazy-fixture,pytest-lazy-fixture)) $(eval $(call disable-pytest-plugin,metadata,pytest-metadata)) # adds line to test report header $(eval $(call disable-pytest-plugin,mypy,pytest-mypy)) # runs extra test(s) $(eval $(call disable-pytest-plugin,perf,pytest-perf)) # https://github.com/jaraco/pytest-perf/issues/9 +$(eval $(call disable-pytest-plugin,plugin-enabled options,pytest-enabler)) +$(eval $(call disable-pytest-plugin,pytest-datadir,pytest-datadir)) $(eval $(call disable-pytest-plugin,pytest-mypy-plugins,pytest-mypy-plugins)) # could cause tests to fail +$(eval $(call disable-pytest-plugin,pytest-teamcity,teamcity-messages)) +$(eval $(call disable-pytest-plugin,pytest_expect,pytest-expect)) +$(eval $(call disable-pytest-plugin,pytest_fakefs,pyfakefs)) +$(eval $(call disable-pytest-plugin,pytest_forked,pytest-forked)) +$(eval $(call disable-pytest-plugin,pytest_httpserver,pytest-httpserver)) +$(eval $(call disable-pytest-plugin,pytest_ignore_flaky,pytest-ignore-flaky)) +$(eval $(call disable-pytest-plugin,pytest_mock,pytest-mock)) $(eval $(call disable-pytest-plugin,randomly,pytest-randomly)) # reorders tests +$(eval $(call disable-pytest-plugin,regressions,pytest-regressions)) $(eval $(call disable-pytest-plugin,relaxed,pytest-relaxed)) # runs extra test(s); produces different test report $(eval $(call disable-pytest-plugin,reporter,pytest-reporter)) # https://github.com/christiansandberg/pytest-reporter/issues/8 +$(eval $(call disable-pytest-plugin,rerunfailures,pytest-rerunfailures)) $(eval $(call disable-pytest-plugin,salt-factories,pytest-salt-factories)) # requires salt $(eval $(call disable-pytest-plugin,salt-factories-event-listener,pytest-salt-factories)) # requires salt $(eval $(call disable-pytest-plugin,salt-factories-factories,pytest-salt-factories)) # requires salt @@ -442,7 +461,19 @@ $(eval $(call disable-pytest-plugin,salt-factories-markers,pytest-salt-factories)) # requires salt $(eval $(call disable-pytest-plugin,salt-factories-sysinfo,pytest-salt-factories)) # requires salt $(eval $(call disable-pytest-plugin,salt-factories-sysstats,pytest-salt-factories)) # requires salt +$(eval $(call disable-pytest-plugin,shell-utilities,pytest-shell-utilities)) +$(eval $(call disable-pytest-plugin,skip-markers,pytest-skip-markers)) +$(eval $(call disable-pytest-plugin,socket,pytest-socket)) +$(eval $(call disable-pytest-plugin,subprocess,pytest-subprocess)) +$(eval $(call disable-pytest-plugin,subtests,pytest-subtests)) $(eval $(call disable-pytest-plugin,tempdir,pytest-tempdir)) # adds line to test report header +$(eval $(call disable-pytest-plugin,time_machine,time-machine)) +$(eval $(call disable-pytest-plugin,timeout,pytest-timeout)) +$(eval $(call disable-pytest-plugin,travis-fold,pytest-travis-fold)) +$(eval $(call disable-pytest-plugin,typeguard,typeguard)) +$(eval $(call disable-pytest-plugin,unittest_mock,backports-unittest-mock)) +$(eval $(call disable-pytest-plugin,xdist,pytest-xdist)) +$(eval $(call disable-pytest-plugin,xdist.looponfail,pytest-xdist)) $(eval $(call disable-pytest-plugin,xprocess,pytest-xprocess)) # adds a reminder line to test output # By default we are not interested in full list of test failures so exit on -- Gitblit v1.9.3