From 117c56482909cea28418773f486c6c4bc6bf6574 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Thu, 26 Nov 2020 10:17:51 +0000 Subject: [PATCH 1/7] put test_distributions in separate job --- .github/workflows/pytest.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 66474705a96..5b226d0c799 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -30,6 +30,7 @@ jobs: --ignore=pymc3/tests/test_gp.py --ignore=pymc3/tests/test_shape_handling --ignore=pymc3/tests/test_quadpotential.py + --ignore=pymc3/tests/test_distributions.py - | pymc3/tests/test_distributions_random.py pymc3/tests/test_shared.py @@ -49,6 +50,8 @@ jobs: pymc3/tests/test_variational_inference.py pymc3/tests/test_updates.py pymc3/tests/test_shape_handling.py + - | + pymc3/tests/test_distributions.py runs-on: ${{ matrix.os }} env: TEST_SUBSET: ${{ matrix.test-subset }} From a72e1f9f15d28ad0745f50cc01a8915ff1c9e2fa Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Thu, 26 Nov 2020 10:27:29 +0000 Subject: [PATCH 2/7] :art: sort --- .github/workflows/pytest.yml | 40 ++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 5b226d0c799..551bf98b2ec 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -14,42 +14,42 @@ jobs: floatx: [float32, float64] test-subset: - | - --ignore=pymc3/tests/test_examples.py - --ignore=pymc3/tests/test_distributions_random.py - --ignore=pymc3/tests/test_variational_inference.py - --ignore=pymc3/tests/test_shared.py - --ignore=pymc3/tests/test_smc.py - --ignore=pymc3/tests/test_updates.py - --ignore=pymc3/tests/test_posteriors.py - --ignore=pymc3/tests/test_sampling.py - --ignore=pymc3/tests/test_parallel_sampling.py --ignore=pymc3/tests/test_dist_math.py --ignore=pymc3/tests/test_distribution_defaults.py + --ignore=pymc3/tests/test_distributions.py + --ignore=pymc3/tests/test_distributions_random.py --ignore=pymc3/tests/test_distributions_timeseries.py - --ignore=pymc3/tests/test_random.py + --ignore=pymc3/tests/test_examples.py --ignore=pymc3/tests/test_gp.py - --ignore=pymc3/tests/test_shape_handling + --ignore=pymc3/tests/test_parallel_sampling.py + --ignore=pymc3/tests/test_posteriors.py --ignore=pymc3/tests/test_quadpotential.py - --ignore=pymc3/tests/test_distributions.py + --ignore=pymc3/tests/test_random.py + --ignore=pymc3/tests/test_sampling.py + --ignore=pymc3/tests/test_shape_handling + --ignore=pymc3/tests/test_shared.py + --ignore=pymc3/tests/test_smc.py + --ignore=pymc3/tests/test_updates.py + --ignore=pymc3/tests/test_variational_inference.py - | - pymc3/tests/test_distributions_random.py - pymc3/tests/test_shared.py - pymc3/tests/test_smc.py - pymc3/tests/test_sampling.py - pymc3/tests/test_parallel_sampling.py pymc3/tests/test_dist_math.py pymc3/tests/test_distribution_defaults.py + pymc3/tests/test_distributions_random.py pymc3/tests/test_distributions_timeseries.py + pymc3/tests/test_parallel_sampling.py pymc3/tests/test_random.py + pymc3/tests/test_sampling.py + pymc3/tests/test_shared.py + pymc3/tests/test_smc.py - | pymc3/tests/test_examples.py - pymc3/tests/test_posteriors.py pymc3/tests/test_gp.py + pymc3/tests/test_posteriors.py pymc3/tests/test_quadpotential.py - | - pymc3/tests/test_variational_inference.py - pymc3/tests/test_updates.py pymc3/tests/test_shape_handling.py + pymc3/tests/test_updates.py + pymc3/tests/test_variational_inference.py - | pymc3/tests/test_distributions.py runs-on: ${{ matrix.os }} From d37b7b7e64a87f31c6928364405cf7d00b653d63 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Thu, 26 Nov 2020 10:27:51 +0000 Subject: [PATCH 3/7] add arviz compat job --- .github/workflows/arviz_compat.yml | 45 ++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/arviz_compat.yml diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml new file mode 100644 index 00000000000..497b7d39df5 --- /dev/null +++ b/.github/workflows/arviz_compat.yml @@ -0,0 +1,45 @@ +name: arviz-compatibility + +on: + pull_request: + push: + branches: [master] + +jobs: + pytest: + strategy: + matrix: + python-version: ["3.8"] + os: [ubuntu-18.04] + floatx: [float64] + test-subset: + - pymc3/tests/test_sampling.py + runs-on: ${{ matrix.os }} + env: + TEST_SUBSET: ${{ matrix.test-subset }} + THEANO_FLAGS: floatX=${{ matrix.floatx }},gcc.cxxflags='-march=native' + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v2 + - name: Cache conda + uses: actions/cache@v1 + env: + # Increase this value to reset cache if environment-dev.yml has not changed + CACHE_NUMBER: 0 + with: + path: ~/conda_pkgs_dir + key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ + hashFiles('environment-dev.yml') }} + - uses: conda-incubator/setup-miniconda@v2 + with: + activate-environment: testenv + channel-priority: strict + environment-file: environment-dev.yml + use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + - run: | + conda activate testenv + conda remove arviz -y + pip install git+git://github.com/arviz-devs/arviz.git + python -m pytest -v --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET -n auto From 843dc554bc5b577dcd98cef43ce2747071987f76 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Thu, 26 Nov 2020 14:19:18 +0000 Subject: [PATCH 4/7] fix ignored test --- .github/workflows/pytest.yml | 4 +++- .pre-commit-config.yaml | 13 +++++++++---- scripts/check_all_tests_are_covered.py | 12 ++++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 scripts/check_all_tests_are_covered.py diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 551bf98b2ec..89b3ef09df4 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -21,12 +21,13 @@ jobs: --ignore=pymc3/tests/test_distributions_timeseries.py --ignore=pymc3/tests/test_examples.py --ignore=pymc3/tests/test_gp.py + --ignore=pymc3/tests/test_mixture.py --ignore=pymc3/tests/test_parallel_sampling.py --ignore=pymc3/tests/test_posteriors.py --ignore=pymc3/tests/test_quadpotential.py --ignore=pymc3/tests/test_random.py --ignore=pymc3/tests/test_sampling.py - --ignore=pymc3/tests/test_shape_handling + --ignore=pymc3/tests/test_shape_handling.py --ignore=pymc3/tests/test_shared.py --ignore=pymc3/tests/test_smc.py --ignore=pymc3/tests/test_updates.py @@ -44,6 +45,7 @@ jobs: - | pymc3/tests/test_examples.py pymc3/tests/test_gp.py + pymc3/tests/test_mixture.py pymc3/tests/test_posteriors.py pymc3/tests/test_quadpotential.py - | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c6ab6619493..278cac0ee76 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -31,14 +31,19 @@ repos: - repo: local hooks: - id: watermark - name: Check notebooks have watermark (see Jupyter style guide from PyMC3 Wiki) - types: [jupyter] + args: [--negate, --multiline] entry: '%load_ext watermark.*%watermark -n -u -v -iv -w' language: pygrep - args: [--negate, --multiline] minimum_pre_commit_version: 2.8.0 + name: Check notebooks have watermark (see Jupyter style guide from PyMC3 Wiki) + types: [jupyter] - id: check-toc + entry: python scripts/check_toc_is_complete.py + language: python name: Check all notebooks appear in table of contents types: [jupyter] - entry: python scripts/check_toc_is_complete.py + - id: check-no-tests-are-ignored + entry: python scripts/check_all_tests_are_covered.py + files: ^\.github/workflows/pytest\.yml$ language: python + name: Check no tests are ignored diff --git a/scripts/check_all_tests_are_covered.py b/scripts/check_all_tests_are_covered.py new file mode 100644 index 00000000000..7895c20f111 --- /dev/null +++ b/scripts/check_all_tests_are_covered.py @@ -0,0 +1,12 @@ +from pathlib import Path + +import re + +if __name__ == "__main__": + pytest_ci_job = Path(".github") / "workflows/pytest.yml" + txt = pytest_ci_job.read_text() + ignored_tests = set(re.findall(r"(?<=--ignore=)(pymc3/tests.*\.py)", txt)) + non_ignored_tests = set(re.findall(r"(?