diff --git a/.azure-pipelines/azure-pipelines-base.yml b/.azure-pipelines/azure-pipelines-base.yml index b7a2ba1ed9..888801a3a7 100644 --- a/.azure-pipelines/azure-pipelines-base.yml +++ b/.azure-pipelines/azure-pipelines-base.yml @@ -5,8 +5,6 @@ jobs: variables: - name: NUMBA_DISABLE_JIT value: 1 - - name: ARVIZ_CI_MACHINE - value: 1 timeoutInMinutes: 360 strategy: matrix: @@ -82,9 +80,15 @@ jobs: python -m pip freeze displayName: 'Print packages' + - script: | + ARVIZ_REQUIRE_ALL_DEPS=TRUE python -m pytest arviz/tests/base_tests --cov arviz --cov-report=xml + condition: and(succeeded(), eq(variables.OptionalRequirements, true)) + displayName: 'pytest (require all dependencies)' + - script: | python -m pytest arviz/tests/base_tests --cov arviz --cov-report=xml - displayName: 'pytest' + condition: and(succeeded(), eq(variables.OptionalRequirements, false)) + displayName: 'pytest (skip if dependency missing)' - script: | ls -ahl diff --git a/.azure-pipelines/azure-pipelines-external.yml b/.azure-pipelines/azure-pipelines-external.yml index b255ee8898..138ff80223 100644 --- a/.azure-pipelines/azure-pipelines-external.yml +++ b/.azure-pipelines/azure-pipelines-external.yml @@ -5,7 +5,7 @@ jobs: variables: - name: NUMBA_DISABLE_JIT value: 1 - - name: ARVIZ_CI_MACHINE + - name: ARVIZ_REQUIRE_ALL_DEPS value: 1 timeoutInMinutes: 360 strategy: diff --git a/arviz/tests/helpers.py b/arviz/tests/helpers.py index 15dbd95689..3e826b8587 100644 --- a/arviz/tests/helpers.py +++ b/arviz/tests/helpers.py @@ -620,11 +620,6 @@ def test_precompile_models(eight_schools_params, draws, chains): load_cached_models(eight_schools_params, draws, chains) -def running_on_ci() -> bool: - """Return True if running on CI machine.""" - return os.environ.get("ARVIZ_CI_MACHINE") is not None - - def importorskip( modname: str, minversion: Optional[str] = None, reason: Optional[str] = None ) -> Any: @@ -643,9 +638,9 @@ def importorskip( Example:: docutils = pytest.importorskip("docutils") """ - # ARVIZ_CI_MACHINE is True if tests run on CI, where ARVIZ_CI_MACHINE env variable exists - ARVIZ_CI_MACHINE = running_on_ci() - if not ARVIZ_CI_MACHINE: + # Unless ARVIZ_REQUIRE_ALL_DEPS is defined, tests that require a missing dependency are skipped + # if set, missing optional dependencies trigger failed tests. + if "ARVIZ_REQUIRE_ALL_DEPS" not in os.environ: return pytest.importorskip(modname=modname, minversion=minversion, reason=reason) import warnings