Repository navigation
test: Run the exporters in CI instead of skipping them - #87
Merged
Merged
Conversation
The pandas and pyarrow exporters are a documented feature and CI never ran a
line of them. It installed the wheel with no extras, so the tests that needed
those packages skipped, and the report said "194 passed, 2 skipped" without
saying that two of the four export formats were untested.
Install the wheel as `<wheel>[export]`, which takes the extra's contents from
pyproject.toml rather than repeating pandas and pyarrow here, and assert
afterwards that both imported. A skip is the failure mode this is meant to
remove, so it should not be able to come back quietly.
The tests needed work first. Every one of them was wrapped in
try:
from pyetwkit.export import to_csv
...
except ImportError:
pytest.skip("pyetwkit.export module not available")
which is wrong twice over. The module always imports -- pandas and pyarrow are
imported inside the functions that need them -- so eight of the ten guards
could only ever have fired on a genuine ImportError from inside the exporters,
reporting a broken module as an absent optional dependency. That is the same
shape as #77, where a wrong import name skipped 112 tests for months.
Decide once, up front, whether each optional dependency is installed, and mark
only the tests that actually need one. Everything else now asserts. With the
extra installed all eighteen run; without it, twelve still run and the six that
skip say which package is missing and how to get it, rather than claiming the
module is unavailable.
Also added round trips for parquet and arrow. Both had only a `callable()`
check, so installing pyarrow in CI would otherwise have bought nothing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HhPcm483PrDmuQEUSALBFn
This was referenced Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The exporters are a documented feature and CI has never run a line of them. It installs the wheel with no extras, so the tests needing pandas or pyarrow skipped, and the report read
194 passed, 2 skippedwithout mentioning that two of the four export formats were untested.Left over from #82.
Changes
<wheel>[export]intest-python, so the extra's contents stay defined inpyproject.tomlalone rather than being repeated in the workflow.pandasandpyarrowimported. A skip is the failure mode this removes; it should not be able to come back quietly.test_export.pyso the guards mean what they say.Related Issue
Follow-up from #82; no separate issue.
Why the tests needed work first
Every test in the file was wrapped in:
That is wrong twice over.
pyetwkit.exportalways imports — pandas and pyarrow are imported inside the functions that need them — so eight of the ten guards could only ever have fired on a genuineImportErrorraised inside the exporters, reporting a broken module as an absent optional dependency. Same shape as #77, where a wrong import name kept 112 tests skipped for months.Now the presence of each optional dependency is decided once, up front, and only the tests that actually need one are marked. Everything else asserts.
Also worth noting
to_csvgoes throughto_dataframe, so it needs pandas too — which is why the second skip was inTestToCSVrather than somewhere obvious.Test Plan
Added/Modified Tests
test_export.pygoes from 12 tests to 18: JSON/JSONL round trips, a DataFrame content check, a CSV content check, and parquet/arrow round trips. Both parquet and arrow previously had only acallable()check, so installing pyarrow in CI would otherwise have bought nothing.Test Results
With the extra, in a clean venv from the built wheel:
Without it, in the same venv before the extra was added — the point being that the twelve which do not need pandas now run rather than skipping, and the six that do skip say what is missing:
Full suite locally:
CI should now report zero skips for this file.
Checklist
Additional Notes
<wheel>[export]was verified against a real wheel rather than assumed; pip and uv both accept extras on a direct wheel path.This adds pandas and pyarrow to five matrix entries, which is not free. If the download time is unwelcome, the alternative is a single job that installs the extra and runs only
tests/test_export.py, leaving the matrix as it is — worth saying so you can choose, though I would rather the exporters were covered on every supported Python than on one.Independent of this:
dashboardandotlpare extras too, and their tests may have the same shape. I have not looked; happy to if you want it.🤖 Generated with Claude Code
https://claude.ai/code/session_01HhPcm483PrDmuQEUSALBFn