Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run ferc_to_sqlite and pudl_etl independent of integration tests #2825

Open
wants to merge 113 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 112 commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
6bf1115
Try etl/integraiton separation in tests.
rousik Sep 2, 2023
d89e1f4
fix some formatting in the python thingies
rousik Sep 3, 2023
3b43bef
Minor changes to the tox-pytest setup
rousik Sep 4, 2023
a8fb7dc
Comment out most things to isolate ci-integration-etl
rousik Sep 6, 2023
8587dc7
fix few things
rousik Sep 6, 2023
a5b2867
fix condarc
rousik Sep 6, 2023
4916320
install snappy before pudl
rousik Sep 6, 2023
2b1a116
Fix up integration tests, run on the large machine.
rousik Sep 6, 2023
bb623af
add alembic setup
rousik Sep 6, 2023
da07819
run conda info ahead of running the etl
rousik Sep 6, 2023
7dc86aa
Log conda env
rousik Sep 6, 2023
162f62a
Disable large runners for now
rousik Sep 6, 2023
68c6dee
fix exec shell for the action
rousik Sep 6, 2023
09fb56d
fix exec shell for the action
rousik Sep 6, 2023
f05fcd3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 6, 2023
173ad8c
Fix path to integration tests.
zaneselvans Sep 6, 2023
c9b83ab
Add concurrency to cancel previous runs
rousik Sep 6, 2023
e35efc9
Merge branch 'parallel-pytest' of github.com:catalyst-cooperative/pud…
rousik Sep 6, 2023
a81ebf0
Fix path to integration tests
rousik Sep 6, 2023
364b053
fix pytest paths
rousik Sep 6, 2023
d4b46fc
restructure etl steps
rousik Sep 6, 2023
ffd56e0
fix typo in alembic setup
rousik Sep 6, 2023
2edea32
uncomment steps and fix mamba setup
rousik Sep 6, 2023
d5fcc73
Install test dependencies with pip
zaneselvans Sep 6, 2023
4f42efa
resolve conflicts with dev branch
zaneselvans Sep 6, 2023
ac95389
Merge branch 'dev' into parallel-pytest
zaneselvans Sep 6, 2023
61bb7b6
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Sep 11, 2023
b1f3b95
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Sep 25, 2023
fb2892f
Add test deps to ci steps that use coverage.
rousik Sep 25, 2023
678d54e
I don't understand tox substitution :-/
rousik Sep 26, 2023
6ec7d99
Fix ETL command to run. Ugh.
rousik Sep 26, 2023
2f43405
Include datasette as tox dependency.
rousik Sep 26, 2023
66f5f54
Fix the input/output path override behavior when running in gha context.
rousik Sep 26, 2023
3ac2879
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Sep 26, 2023
12903a0
Merge branch 'dev' into parallel-pytest
rousik Oct 3, 2023
28af787
Rename github_ tox steps, make them fail unless GITHUB_ACTIONS env ex…
rousik Oct 18, 2023
a725c07
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Oct 18, 2023
00e41fb
Merge branch 'dev' into parallel-pytest
zaneselvans Oct 19, 2023
645ae4f
Merge branch 'dev' into parallel-pytest
zaneselvans Oct 19, 2023
051d2b1
Explicitly demand tox>=4.3.3 for the env reuse.
rousik Oct 21, 2023
58597e4
Drop usage of tox in the new ci-integration test.
rousik Oct 25, 2023
5b162bd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 25, 2023
b7afb1e
Put back diagnostic steps and install PUDL dependencies.
rousik Oct 25, 2023
e17f35c
Few cleanup tasks.
rousik Oct 25, 2023
64500b7
Fix up the coverage commands.
rousik Oct 25, 2023
3a7b30a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 25, 2023
2a9f5a2
Fix the path to etl.py.
rousik Oct 25, 2023
f226f38
Run alembic before ETL.
rousik Oct 25, 2023
583f7f8
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Oct 25, 2023
0590f29
Revert changes to other files.
rousik Oct 25, 2023
fa814ea
Also install datasette dependencies.
rousik Oct 28, 2023
c3da09e
Revert changes to .coveragerc
rousik Oct 29, 2023
0fdd73d
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Oct 29, 2023
171dab5
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Nov 1, 2023
2c96289
Merge branch 'dev' into parallel-pytest
rousik Nov 6, 2023
666f1e9
add option to pick runner when running from dispatch
rousik Nov 6, 2023
31dde43
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 6, 2023
297eca0
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Nov 6, 2023
fb30bd5
Fix workflow for runner size determination.
rousik Nov 7, 2023
6ff74f5
Run matrix of integration tests to check scaling.
rousik Nov 7, 2023
567da80
Fix integration workflow file.
rousik Nov 7, 2023
ca9854e
Drop support for matrix evaluation of ci-integration
rousik Nov 7, 2023
b08ead3
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Nov 14, 2023
a23f7eb
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Nov 27, 2023
e834f03
Update conda-lock.yml and rendered conda environment files.
rousik Nov 27, 2023
6d14c83
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Nov 27, 2023
8414ce3
Merge branch 'dev' into parallel-pytest
zaneselvans Nov 28, 2023
65aaa60
Update conda-lock.yml and rendered conda environment files.
zaneselvans Nov 28, 2023
48726c0
Replace ls -R with find -type f.
rousik Nov 27, 2023
cc1f6a9
Revert renames to be more friendly.
rousik Nov 29, 2023
14d9a4a
Fix some more code review comments.
rousik Nov 29, 2023
1c8dd9c
Fix error in call to pytest -n auto
zaneselvans Nov 29, 2023
6e4770c
Merge branch 'dev' into parallel-pytest
zaneselvans Nov 29, 2023
04812b5
Update conda-lock.yml and rendered conda environment files.
zaneselvans Nov 29, 2023
fc023db
Fail gha step if coverage fails to upload.
rousik Nov 29, 2023
7ac4fbb
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Nov 29, 2023
1ea46f5
Use specific coverage file names to aid the process.
rousik Nov 29, 2023
ba40c9b
add some debug options for coverage
rousik Dec 1, 2023
5515cbf
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Dec 1, 2023
5fa6f5a
Update conda-lock.yml and rendered conda environment files.
rousik Dec 1, 2023
9f2ad16
Checksum partial coverage files before merging.
rousik Dec 1, 2023
c039a0a
Explicitly include src and test as source directories.
rousik Dec 1, 2023
b0105f3
Use src/pudl as a source definition.
rousik Dec 2, 2023
dd6d357
Use --source=src/pudl when running coverage
rousik Dec 3, 2023
908e83c
Remove option that can't be set via cmdline.
rousik Dec 4, 2023
2fb0603
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Dec 10, 2023
bf77921
Use right parameters for coverage.run tool.
rousik Dec 10, 2023
a9f6053
Update conda-lock.yml and rendered conda environment files.
rousik Dec 10, 2023
9976578
Cast 0 xbrl workers back to None.
rousik Dec 10, 2023
87c6ab4
Merge branch 'parallel-pytest' of github.com:catalyst-cooperative/pud…
rousik Dec 10, 2023
d5c5b91
Drop COVERAGE_OPTIONS, everything is now in pyproject.toml
rousik Dec 10, 2023
a8e0eaa
Fix command for pudl_etl
rousik Dec 13, 2023
910977b
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Dec 13, 2023
c65426b
run coverage combine when building docs
rousik Dec 13, 2023
50eec4f
Use multiprocessing only when dealing with ci-integration.
rousik Dec 13, 2023
da8dbcc
Update conda-lock.yml and rendered conda environment files.
rousik Dec 13, 2023
5c9a194
Blablabla.
rousik Dec 13, 2023
72ce2f2
Update conda-lock.yml and rendered conda environment files.
rousik Dec 13, 2023
6d032f9
Try to tune coverage parameters once more.
rousik Dec 14, 2023
892adac
Update conda-lock.yml and rendered conda environment files.
rousik Dec 14, 2023
7f8619a
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Dec 14, 2023
e94e277
Reset lock files to match dev branch.
rousik Dec 14, 2023
da3b055
Merge branch 'dev' into parallel-pytest
zaneselvans Dec 15, 2023
5d49446
Merge branch 'dev' into parallel-pytest
zaneselvans Dec 15, 2023
6696f2f
Record coverage of unit and integration tests themselves
zaneselvans Dec 15, 2023
fec6061
Merge remote-tracking branch 'origin/dev' into parallel-pytest
rousik Dec 29, 2023
c201637
Merge branch 'dev' into parallel-pytest
rousik Jan 3, 2024
8ec32bb
Merge branch 'main' into parallel-pytest
zaneselvans Jan 5, 2024
e52c349
Merge remote-tracking branch 'origin/main' into parallel-pytest
rousik Jan 18, 2024
131b9fa
Make some changes as per feedback.
rousik Jan 18, 2024
d17fa54
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 18, 2024
01a5efc
Merge branch 'main' into parallel-pytest
zaneselvans Jan 19, 2024
c51d8e2
Rename glue.py unit tests so pytest picks them up.
zaneselvans Jan 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 41 additions & 46 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ on:
- opened
- synchronize
- ready_for_review
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
zaneselvans marked this conversation as resolved.
Show resolved Hide resolved

env:
PUDL_OUTPUT: /home/runner/pudl-work/output/
PUDL_INPUT: /home/runner/pudl-work/input/
DAGSTER_HOME: /home/runner/pudl-work/dagster_home/
ETL_CONFIG: src/pudl/package_data/settings/etl_fast.yml
ETL_COMMANDLINE_OPTIONS: --gcs-cache-path=gs://zenodo-cache.catalyst.coop

jobs:
ci-docs:
Expand Down Expand Up @@ -64,7 +69,6 @@ jobs:
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -105,31 +109,31 @@ jobs:
path: coverage.xml

ci-integration:
runs-on:
group: large-runner-group
labels: ubuntu-22.04-4core
needs:
- ci-unit
zaneselvans marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-22.04-4core
if: github.event.pull_request.draft == false
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
Comment on lines -115 to -116
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we want fail-fast enabled, given that we've already the dependency above specified? I think this would mean that if the docs build fails, the unit and integration tests would be canceled, right?

defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Install Conda environment using mamba
- name: Install conda-lock environment with micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: environments/conda-lock.yml
environment-name: pudl-dev
cache-environment: true

- name: Install PUDL and its dependencies
run: pip install --no-deps --no-cache-dir .

- name: Log environment details
run: |
conda info
Expand Down Expand Up @@ -169,22 +173,41 @@ jobs:
workload_identity_provider: "projects/345950277072/locations/global/workloadIdentityPools/gh-actions-pool/providers/gh-actions-provider"
service_account: "tox-pytest-github-action@catalyst-cooperative-pudl.iam.gserviceaccount.com"

- name: Run integration tests, trying to use GCS cache if possible
- name: Run ferc_to_sqlite
env:
COVERAGE_FILE: .coverage.ferc_to_sqlite
run: |
pip install --no-deps --editable .
pudl_datastore --dataset epacems --partition year_quarter=2022q1
make pytest-integration

coverage run --concurrency=multiprocessing \
src/pudl/ferc_to_sqlite/cli.py --clobber ${{ env.ETL_COMMANDLINE_OPTIONS }} ${{ env.ETL_CONFIG }}
- name: Run pudl_etl
env:
COVERAGE_FILE: .coverage.pudl_etl
run: |
alembic upgrade head
coverage run --concurrency=multiprocessing \
src/pudl/etl/cli.py ${{ env.ETL_COMMANDLINE_OPTIONS }} ${{ env.ETL_CONFIG }}
- name: Run integration tests
env:
COVERAGE_FILE: .coverage.pytest
run: |
coverage run --concurrency=multiprocessing \
-m pytest -n auto --live-dbs test/integration
- name: Checksum coverage files
run: ls .coverage* | xargs md5sum | sort
zaneselvans marked this conversation as resolved.
Show resolved Hide resolved
- name: Generate coverage
run: |
coverage --version
coverage combine
zaneselvans marked this conversation as resolved.
Show resolved Hide resolved
coverage xml
coverage report
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-integration
path: coverage.xml

- name: Log post-test Zenodo datastore contents
run: find ${{ env.PUDL_INPUT }}

ci-coverage:
name: Upload coverage to CodeCov
runs-on: ubuntu-latest
needs:
- ci-docs
Expand All @@ -198,37 +221,9 @@ jobs:
with:
path: coverage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use path: coverage here but when we're uploading the artifact above we use path: coverage.xml?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this is a bit of confusing api. When uploading artifacts, path tells you what files/directories you want to upload, and optionally you can give them name to uniquely idenfiy them. When you're downloading artifacts, path tells you where to download things. You can either pick specific artifact names to download, or you can just download everything (which is happening here). What happens is that you'll end up with coverage/coverage-unit/coverage.xml, coverage/coverage-integration/coverage.xml and so on.

- name: List downloaded files
run: |
ls -R
run: find -type f
- name: Upload test coverage report to CodeCov
uses: codecov/codecov-action@v3
with:
directory: coverage

ci-notify:
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- ci-docs
- ci-unit
- ci-integration
steps:
- name: Inform the Codemonkeys
uses: 8398a7/action-slack@v3
continue-on-error: true
with:
status: custom
fields: workflow,job,commit,repo,ref,author,took
custom_payload: |
{
username: 'action-slack',
icon_emoji: ':octocat:',
attachments: [{
color: '${{ needs.ci-test.result }}' === 'success' ? 'good' : '${{ needs.ci-test.result }}' === 'failure' ? 'danger' : 'warning',
text: `${process.env.AS_REPO}@${process.env.AS_REF}\n ${process.env.AS_WORKFLOW} (${process.env.AS_COMMIT})\n by ${process.env.AS_AUTHOR}\n Status: ${{ needs.ci-test.result }}`,
}]
}
env:
GITHUB_TOKEN: ${{ github.token }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
MATRIX_CONTEXT: ${{ toJson(matrix) }} # required
fail_ci_if_error: true
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ docs-clean:
docs-build: docs-clean
doc8 docs/ README.rst
coverage run ${covargs} -- ${CONDA_PREFIX}/bin/sphinx-build -W -b html docs docs/_build/html
coverage combine
coverage xml

########################################################################################
Expand Down
21 changes: 20 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,30 @@ curl = ">=8.4.0"

[tool.coverage.run]
# See note above on need to specify separate sources for pytest-coverage and coverage.
source = ["src/pudl/", "test/integration/", "test/unit/"]
include = [
"src/pudl/**",
"test/integration/**",
"test/unit/**",
"*/site-packages/pudl/**",
]
omit = [
# Never hit by integration tests:
"src/pudl/validate.py",
]
sigterm = true
concurrency=["multiprocessing"]
debug = ["config", "trace"]

[tool.coverage.paths]
# When running pudl tools installed with pip, the sources are imported
# from package-data/pudl directory. The following maps this to raw
# source files.
pudl_sources = [
"src/pudl/",
"*/site-packages/pudl/",
"test/unit",
"test/integration",
]
Comment on lines -313 to +336
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm re-running the CodeCov tests now, but it seems like something has changed that's reducing the test coverage by a few hundred lines / a couple of percent, and I don't understand what it is.

Looking at the indirect coverage changes some differences make sense, like increased coverage for the ferc_to_sqlite and pudl_etl CLIs, but there's also substantial apparent losses of coverage in modules related to the FERC-EIA record linkage, and the pudltabl output module which don't make sense.

If I run

make pytest-coverage

locally I get overall coverage of 92.8% which is comparable to the coverage on main

Name                                                           Stmts   Miss  Cover
----------------------------------------------------------------------------------
src/pudl/__init__.py                                              14      0 100.0%
src/pudl/analysis/__init__.py                                      1      0 100.0%
src/pudl/analysis/fuel_by_plant.py                                37      0 100.0%
src/pudl/analysis/record_linkage/__init__.py                       1      0 100.0%
src/pudl/convert/__init__.py                                       1      0 100.0%
src/pudl/etl/__init__.py                                          22      0 100.0%
src/pudl/etl/eia_bulk_elec_assets.py                               9      0 100.0%
src/pudl/etl/epacems_assets.py                                    54      0 100.0%
src/pudl/etl/static_assets.py                                     24      0 100.0%
src/pudl/extract/__init__.py                                       1      0 100.0%
src/pudl/extract/csv.py                                           29      0 100.0%
src/pudl/extract/eia176.py                                         9      0 100.0%
src/pudl/extract/eia860.py                                        40      0 100.0%
src/pudl/extract/eia860m.py                                       30      0 100.0%
src/pudl/extract/eia923.py                                        51      0 100.0%
src/pudl/extract/eia_bulk_elec.py                                 46      0 100.0%
src/pudl/extract/epacems.py                                       47      0 100.0%
src/pudl/extract/ferc.py                                          14      0 100.0%
src/pudl/extract/ferc2.py                                         21      0 100.0%
src/pudl/extract/ferc6.py                                         15      0 100.0%
src/pudl/extract/ferc60.py                                        15      0 100.0%
src/pudl/extract/ferc714.py                                       21      0 100.0%
src/pudl/ferc_to_sqlite/__init__.py                               24      0 100.0%
src/pudl/glue/__init__.py                                          1      0 100.0%
src/pudl/metadata/__init__.py                                      1      0 100.0%
src/pudl/metadata/codes.py                                         5      0 100.0%
src/pudl/metadata/constants.py                                    21      0 100.0%
src/pudl/metadata/dfs.py                                          12      0 100.0%
src/pudl/metadata/enums.py                                        21      0 100.0%
src/pudl/metadata/fields.py                                       25      0 100.0%
src/pudl/metadata/labels.py                                       12      0 100.0%
src/pudl/metadata/resources/__init__.py                           12      0 100.0%
src/pudl/metadata/resources/allocate_gen_fuel.py                   4      0 100.0%
src/pudl/metadata/resources/eia.py                                 4      0 100.0%
src/pudl/metadata/resources/eia860.py                              3      0 100.0%
src/pudl/metadata/resources/eia861.py                              2      0 100.0%
src/pudl/metadata/resources/eia923.py                              4      0 100.0%
src/pudl/metadata/resources/eia_bulk_elec.py                       2      0 100.0%
src/pudl/metadata/resources/epacems.py                             3      0 100.0%
src/pudl/metadata/resources/ferc1.py                               4      0 100.0%
src/pudl/metadata/resources/ferc1_eia_record_linkage.py            3      0 100.0%
src/pudl/metadata/resources/ferc714.py                             3      0 100.0%
src/pudl/metadata/resources/glue.py                                3      0 100.0%
src/pudl/metadata/resources/mcoe.py                                4      0 100.0%
src/pudl/metadata/resources/pudl.py                                3      0 100.0%
src/pudl/metadata/sources.py                                       5      0 100.0%
src/pudl/output/__init__.py                                        1      0 100.0%
src/pudl/output/eia860.py                                         19      0 100.0%
src/pudl/output/eia_bulk_elec.py                                  14      0 100.0%
src/pudl/output/sql/helpers.py                                    12      0 100.0%
src/pudl/resources.py                                             17      0 100.0%
src/pudl/transform/__init__.py                                     1      0 100.0%
src/pudl/transform/eia_bulk_elec.py                               26      0 100.0%
src/pudl/transform/ferc714.py                                     76      0 100.0%
src/pudl/transform/params/__init__.py                              1      0 100.0%
src/pudl/transform/params/ferc1.py                                67      0 100.0%
src/pudl/workspace/__init__.py                                     1      0 100.0%
test/integration/console_scripts_test.py                          23      0 100.0%
test/integration/datasette_metadata_test.py                       22      0 100.0%
test/integration/etl_test.py                                      76      0 100.0%
test/integration/ferc1_eia_train_test.py                          30      0 100.0%
test/integration/ferc_dbf_extract_test.py                         38      0 100.0%
test/integration/zenodo_datapackage_test.py                       11      0 100.0%
test/unit/analysis/plant_parts_eia_test.py                        48      0 100.0%
test/unit/analysis/spatial_test.py                                67      0 100.0%
test/unit/analysis/state_demand_test.py                            8      0 100.0%
test/unit/analysis/timeseries_cleaning_test.py                    32      0 100.0%
test/unit/console_scripts_test.py                                 10      0 100.0%
test/unit/extract/csv_test.py                                     37      0 100.0%
test/unit/extract/eia_bulk_elec_test.py                           42      0 100.0%
test/unit/extract/xbrl_test.py                                    74      0 100.0%
test/unit/helpers_test.py                                        135      0 100.0%
test/unit/output/epacems_test.py                                   7      0 100.0%
test/unit/output/ferc1_test.py                                     9      0 100.0%
test/unit/transform/classes_test.py                              218      0 100.0%
test/unit/transform/eia923_test.py                                12      0 100.0%
test/unit/transform/eia_bulk_elec_test.py                         18      0 100.0%
test/unit/transform/epacems_test.py                                8      0 100.0%
test/unit/transform/ferc1_test.py                                133      0 100.0%
test/unit/transform/glue_test.py                                  11      0 100.0%
test/unit/workspace/datastore_test.py                             82      0 100.0%
test/unit/workspace/resource_cache_test.py                       140      0 100.0%
src/pudl/extract/eia861.py                                        36      1  97.2%
src/pudl/extract/ferc1.py                                        113      1  99.1%
test/integration/epacems_test.py                                  39      1  97.4%
test/integration/output_test.py                                   69      1  98.6%
test/unit/settings_test.py                                       145      1  99.3%
src/pudl/__main__.py                                               2      2   0.0%
src/pudl/analysis/mcoe.py                                         78      2  97.4%
src/pudl/analysis/record_linkage/classify_plants_ferc1.py         31      2  93.5%
src/pudl/etl/glue_assets.py                                      112      2  98.2%
src/pudl/glue/ferc1_eia.py                                       135      2  98.5%
src/pudl/output/censusdp1tract.py                                 28      2  92.9%
src/pudl/output/eia923.py                                         93      2  97.8%
src/pudl/workspace/setup.py                                       43      2  95.3%
test/unit/analysis/allocate_gen_fuel_test.py                      96      2  97.9%
test/unit/extract/excel_test.py                                   49      2  95.9%
test/unit/harvest_test.py                                         59      2  96.6%
test/unit/metadata_test.py                                        56      2  96.4%
src/pudl/extract/xbrl.py                                          52      3  94.2%
src/pudl/logging_helpers.py                                       15      3  80.0%
src/pudl/output/epacems.py                                        29      3  89.7%
src/pudl/settings.py                                             253      3  98.8%
src/pudl/transform/epacems.py                                     34      3  91.2%
test/integration/record_linkage_test.py                           72      3  95.8%
src/pudl/convert/censusdp1tract_to_sqlite.py                      35      4  88.6%
src/pudl/metadata/helpers.py                                     187      4  97.9%
test/integration/glue_test.py                                     42      4  90.5%
test/unit/glue.py                                                  7      4  42.9%
src/pudl/output/ferc714.py                                       150      5  96.7%
test/integration/jupyter_notebooks_test.py                        13      5  61.5%
src/pudl/analysis/record_linkage/embed_dataframe.py              124      6  95.2%
src/pudl/analysis/record_linkage/eia_ferc1_record_linkage.py     218      7  96.8%
src/pudl/convert/metadata_to_rst.py                               21      7  66.7%
src/pudl/analysis/spatial.py                                     112      8  92.9%
src/pudl/etl/check_foreign_keys.py                                20      8  60.0%
src/pudl/extract/excel.py                                        167      8  95.2%
src/pudl/transform/eia.py                                        300      8  97.3%
src/pudl/analysis/plant_parts_eia.py                             260      9  96.5%
src/pudl/workspace/resource_cache.py                             124      9  92.7%
src/pudl/transform/eia861.py                                     398     10  97.5%
test/unit/io_managers_test.py                                    206     10  95.1%
src/pudl/output/pudltabl.py                                       98     11  88.8%
src/pudl/analysis/epacamd_eia.py                                  18     12  33.3%
src/pudl/analysis/record_linkage/link_cross_year.py              106     12  88.7%
src/pudl/analysis/record_linkage/name_cleaner.py                  90     12  86.7%
src/pudl/analysis/allocate_gen_fuel.py                           323     13  96.0%
src/pudl/analysis/state_demand.py                                146     15  89.7%
src/pudl/ferc_to_sqlite/cli.py                                    44     15  65.9%
src/pudl/transform/classes.py                                    394     21  94.7%
src/pudl/etl/cli.py                                               48     22  54.2%
src/pudl/transform/eia860.py                                     205     23  88.8%
src/pudl/extract/dbf.py                                          258     25  90.3%
src/pudl/workspace/datastore.py                                  298     25  91.6%
src/pudl/io_managers.py                                          268     26  90.3%
src/pudl/analysis/service_territory.py                           123     31  74.8%
src/pudl/transform/eia923.py                                     231     34  85.3%
src/pudl/analysis/timeseries_cleaning.py                         460     44  90.4%
src/pudl/helpers.py                                              407     53  87.0%
src/pudl/output/ferc1.py                                         632     66  89.6%
src/pudl/transform/ferc1.py                                     1545     68  95.6%
src/pudl/output/eia.py                                           176     72  59.1%
src/pudl/analysis/record_linkage/eia_ferc1_train.py              172     79  54.1%
src/pudl/metadata/classes.py                                     798    101  87.3%
----------------------------------------------------------------------------------
TOTAL                                                          13072    943  92.8%
  • test/unit/glue.py needs to be renamed so pytest collects tests from it, but that's not a new thing.
  • test/integration/console_scripts_test.py doesn't get hit all in the CodeCov report but has 100% coverage if I run locally.
  • src/pudl/analysis/record_linkage/eia_ferc1_train.py coverage is dramatically lower in CodeCov than locally.
  • src/pudl/analysis/service_territory.py is also significantly lower. My guess is this is related to the scripts not getting tested?
  • src/pudl/output/pudltabl.py is basically not getting hit at all in CodeCov which makes no sense to me, since the PudlTabl objects are used all over the place in the tests and have 88.8% coverage when run locally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for delays, life has been busy. I will try to follow up on these in the coming week and try to figure out what is going on here. The fact that coverage is so brittle and it is so hard to figure out why it fluctuates so much is very discouraging; it shouldn't be that hard :-/


[tool.coverage.report]
precision = 1
Expand Down
2 changes: 2 additions & 0 deletions src/pudl/extract/xbrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def xbrl2sqlite(context) -> None:
clobber = context.op_config["clobber"]
batch_size = context.op_config["batch_size"]
workers = context.op_config["workers"]
if workers == 0:
workers = None
ferc_to_sqlite_settings = context.resources.ferc_to_sqlite_settings
datastore = context.resources.datastore
datastore = FercXbrlDatastore(datastore)
Expand Down
Loading