Skip to content

Add import integration tests for built distributions #457

@R7L208

Description

@R7L208

Context

As noted by @tnixon in #453, we should be running tests against built artifacts (not just source) to catch packaging issues like missing sub-packages. The root cause of #453 was that setup.py used find_packages(include=["tempo"]) which silently excluded sub-packages (tempo.intervals, tempo.joins, etc.) from wheel builds — something unit tests against source would never catch.

This was fixed in #455 by switching to hatch build targets, but we have no regression test to prevent this from happening again.

Proposed Tests

Add an integration test suite that installs the built wheel into a clean environment and verifies:

Import patterns

# Top-level imports
import tempo
from tempo import TSDF

# Sub-package module-style imports (the pattern that broke in #453)
import tempo.intervals as t_int
import tempo.joins as t_joins

# Deep sub-package imports
from tempo.intervals.core import IntervalsDF
from tempo.intervals.overlap import detection
from tempo.joins.strategies import AsOfJoinStrategy

Package completeness

  • All __init__.py files are present and importable
  • No ModuleNotFoundError for any sub-package in the source tree
  • importlib.metadata.version("dbl-tempo") returns a valid version

Wheel contents validation

  • Inspect the built wheel to verify all expected packages are included
  • Could use zipfile to list wheel contents and assert against expected package list

Implementation Approach

  1. Add a CI step after hatch build that:
    • Creates a clean virtualenv
    • Installs the built wheel (pip install dist/*.whl)
    • Runs the import integration tests against the installed package
  2. Tests should live in a separate directory (e.g., tests/integration/) to distinguish from unit tests that run against source

References

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions