Skip to content

Fix test_create_table_numpy to run without pandas in the numpy: 1 CI leg - #875

Open
aayushgupta7725 wants to merge 1 commit into
simonw:mainfrom
aayushgupta7725:fix-numpy-ci-test
Open

aayushgupta7725 wants to merge 1 commit into
simonw:mainfrom
aayushgupta7725:fix-numpy-ci-test

Conversation

@aayushgupta7725

@aayushgupta7725 aayushgupta7725 commented Sep 23, 2026 •

Copy link
Copy Markdown

Fixes #872

The numpy: 1 leg of the test matrix in .github/workflows/test.yml
installs numpy but deliberately not pandas, to check numpy-only
scenarios. However, the only test meant to run there,
test_create_table_numpy, was decorated with
@pytest.mark.skipif(pd is None, ...) and built its test data via
pd.DataFrame(...).to_dict(orient="records") — so it required pandas
and was silently skipped in every numpy: 1 job, every time, since
2020.

This PR rewrites the test to build its rows directly with numpy's own
constructors (np.int8, np.uint64, np.float16, etc.), using
.item() to convert each value to a plain Python type the same way
pandas' to_dict() already does internally. This removes the pandas
dependency from the test while preserving exactly what it verifies —
that sqlite-utils can build a table and insert data originating from
various numpy dtypes.

Changes:

  • Rewrote test_create_table_numpy in tests/test_create.py to use
    numpy directly instead of pd.DataFrame
  • Changed the skipif condition from pd is None to np is None
  • Removed the now-unused import pandas as pd block from
    tests/test_create.py, since nothing else in the file references
    pd

Verified locally: with pandas uninstalled and numpy installed
(matching the numpy: 1 CI leg), the test now runs and passes rather
than being skipped.


📚 Documentation preview 📚: https://sqlite-utils--875.org.readthedocs.build/en/875/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The numpy: 1 legs of the CI matrix never run test_create_table_numpy (it needs pandas, only numpy is installed)

1 participant