From f815de74099ee3895048b7c052b2cfa94a7b6692 Mon Sep 17 00:00:00 2001 From: "Eric T. Johnson" Date: Thu, 23 Mar 2023 17:27:16 -0400 Subject: [PATCH 1/4] Add a coverage config file --- .coveragerc | 16 ++++++++++++++++ .github/workflows/pytest.yml | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 000000000..88a77c13f --- /dev/null +++ b/.coveragerc @@ -0,0 +1,16 @@ +[paths] +# files installed in */site-packages/pyro/ are equivalent to those in pyro/ +source = + pyro + */site-packages/pyro + +[run] +source = pyro +# measure the source files from the installed pyro package +source_pkgs = pyro + +[report] +# don't include the test files themselves +omit = + */tests/* + pyro/test.py diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 2fc57c3bd..58fdf1e10 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -44,4 +44,4 @@ jobs: run: python setup.py install --user - name: Run tests with pytest - run: pytest -v --cov=. --cov-config .coveragerc --nbval --ignore=docs --ignore=./pyro/multigrid/variable_coeff_elliptic.ipynb --ignore=examples/mesh --ignore=examples/multigrid --ignore=presentations + run: pytest -v --cov=pyro --nbval --ignore=docs --ignore=./pyro/multigrid/variable_coeff_elliptic.ipynb --ignore=examples/mesh --ignore=examples/multigrid --ignore=presentations From 2bbc5441c607f4866ea2b8793f2bc9e4de8d0ad8 Mon Sep 17 00:00:00 2001 From: "Eric T. Johnson" Date: Thu, 23 Mar 2023 17:27:59 -0400 Subject: [PATCH 2/4] Automatically find benchmark files in setup.py --- setup.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/setup.py b/setup.py index b90f47efd..3ee2bfc47 100644 --- a/setup.py +++ b/setup.py @@ -19,21 +19,10 @@ if not f.endswith("inputs.auto"): inputs.append(f.replace("pyro/", "")) -benchmarks = ["advection/tests/*.h5", - "advection_fv4/tests/*.h5", - "advection_nonuniform/tests/*.h5", - "advection_rk/tests/*.h5", - "compressible/tests/*.h5", - "compressible/tests/*.h5", - "compressible/tests/*.h5", - "compressible_fv4/tests/*.h5", - "compressible_rk/tests/*.h5", - "compressible_sdc/tests/*.h5", - "diffusion/tests/*.h5", - "incompressible/tests/*.h5", - "lm_atm/tests/*.h5", - "multigrid/tests/*.h5", - "swe/tests/*.h5"] +# find all of the benchmark output files +benchmarks = [] +for path in Path("pyro").glob("*/tests/*.h5"): + benchmarks.append(str(path.relative_to("pyro"))) setup(name='pyro-hydro', description='A python hydrodynamics code for teaching and prototyping', From 8d6f92ce54533b70cda02c8bf782efdfdd3cb565 Mon Sep 17 00:00:00 2001 From: "Eric T. Johnson" Date: Thu, 23 Mar 2023 18:59:11 -0400 Subject: [PATCH 3/4] Try installing with pip --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 58fdf1e10..40c51d3a2 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -41,7 +41,7 @@ jobs: pip install -r requirements.txt - name: Install pyro - run: python setup.py install --user + run: pip install . - name: Run tests with pytest run: pytest -v --cov=pyro --nbval --ignore=docs --ignore=./pyro/multigrid/variable_coeff_elliptic.ipynb --ignore=examples/mesh --ignore=examples/multigrid --ignore=presentations From b68125cd79b97121a3cf223f7f030c28842438ae Mon Sep 17 00:00:00 2001 From: "Eric T. Johnson" Date: Thu, 23 Mar 2023 19:11:27 -0400 Subject: [PATCH 4/4] Update the other workflows to install with pip --- .github/workflows/docs-test.yml | 2 +- .github/workflows/flake8.yml | 2 +- .github/workflows/gh-pages.yml | 4 ++-- .github/workflows/isort.yml | 2 +- .github/workflows/pylint.yml | 2 +- .github/workflows/regtest.yml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docs-test.yml b/.github/workflows/docs-test.yml index 557c56ee4..aa1c741b7 100644 --- a/.github/workflows/docs-test.yml +++ b/.github/workflows/docs-test.yml @@ -38,7 +38,7 @@ jobs: run: pip install -r ./requirements.txt - name: Install pyro - run: python setup.py install + run: pip install . - name: Build docs run: | diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml index 370d624e8..3b0ac8aa1 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/flake8.yml @@ -38,7 +38,7 @@ jobs: pip install flake8 - name: Install pyro - run: python setup.py install --user + run: pip install . - name: Run flake8 run: flake8 pyro diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 87f0d584a..43993e55e 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -34,7 +34,7 @@ jobs: run: pip install -r ./requirements.txt - name: Install pyro - run: python setup.py install + run: pip install . - name: Build docs run: ./deploy_docs_action.sh @@ -44,4 +44,4 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./out - keep_files: true \ No newline at end of file + keep_files: true diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml index fc3829fd4..0e2dfe500 100644 --- a/.github/workflows/isort.yml +++ b/.github/workflows/isort.yml @@ -38,7 +38,7 @@ jobs: pip install isort - name: Install pyro - run: python setup.py install --user + run: pip install . - name: Validate run: isort -c pyro diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index aa0fde889..decf637bf 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -38,7 +38,7 @@ jobs: pip install pylint - name: Install pyro - run: python setup.py install --user + run: pip install . - name: Validate run: pylint --errors-only pyro pyro/analysis diff --git a/.github/workflows/regtest.yml b/.github/workflows/regtest.yml index 48e345783..d2306713b 100644 --- a/.github/workflows/regtest.yml +++ b/.github/workflows/regtest.yml @@ -41,7 +41,7 @@ jobs: pip install -r requirements.txt - name: Install pyro - run: python setup.py install --user + run: pip install . - name: Run tests via test.py run: ./pyro/test.py