Skip to content

test: add unit test suite and CI workflow#68

Open
adi-suresh01 wants to merge 2 commits into
facebookresearch:mainfrom
adi-suresh01:test/add-pytest-suite-and-ci
Open

test: add unit test suite and CI workflow#68
adi-suresh01 wants to merge 2 commits into
facebookresearch:mainfrom
adi-suresh01:test/add-pytest-suite-and-ci

Conversation

@adi-suresh01

Copy link
Copy Markdown

Summary

Adds the project's first automated tests and a CI workflow. The repo currently has a test extra but no tests/ directory and no CI, so regressions (including install breaks) go uncaught.

What this adds

tests/ (CPU only, no model weights, datasets, network, or the uvx/whisperx toolchain):

  • test_temporal_smoothing.py: TemporalSmoothing builds a depthwise Conv1d; the Gaussian kernel is normalized per channel and symmetric; output length is preserved; a constant signal is unchanged in the padding-free interior.
  • test_demo_utils.py: the VALID_SUFFIXES contract (expected modalities, non-empty lowercase dot-prefixed suffixes, no cross-modality overlap).
  • test_eventstransforms.py: ExtractWordsFromAudio rejects unsupported languages before any transcription subprocess, and defaults to English.

.github/workflows/ci.yml:

  • test job: pytest on Python 3.11 and 3.12.
  • lint job: black and isort (settings read from pyproject.toml), scoped to tests/ for now to avoid failing on pre-existing formatting in the package; widening is left as a follow-up.
  • permissions: contents: read, concurrency cancel-in-progress, and pip caching keyed on pyproject.toml.

Also adds [tool.pytest.ini_options] testpaths = ["tests"] so discovery is explicit.

The full pip install -e ".[test]" in the test job doubles as a clean-install smoke test for the dependency resolution fixed in #65.

Stacking note

This branch is stacked on #67 (the exca cap that repairs the clean install). Without that fix the package cannot be imported, so the suite would not run. The pyproject.toml change shown here therefore includes the one-line exca cap from #67; once #67 merges, this branch rebases onto main and that line drops out, leaving only the tests, CI, and pytest config. Please review or merge #67 first.

Verification

Local run on Python 3.12: 13 passed. black --check tests/ and isort --check-only tests/ both clean.

neuralset 0.0.2 references exca.steps.base.NoValue, which was removed in
exca 0.5.26 (the symbol moved to exca.steps.identity). neuralset 0.0.2
declares exca>=0.5.20, so a fresh install resolves exca 0.5.26 and fails
at import time:

    AttributeError: module 'exca.steps.base' has no attribute 'NoValue'
    (neuralset/events/study.py, in StudyLoader.run)

tribev2 also imports exca directly (exca.ConfDict, exca.TaskInfra) without
declaring it. This adds exca as an explicit dependency, capped to the range
that exposes the API neuralset 0.0.2 relies on (0.5.20 through 0.5.25).

Verified in a clean Python 3.12 venv: install now resolves exca 0.5.25 and
'from tribev2.demo_utils import TribeModel' imports successfully.

Closes facebookresearch#65
Adds the first tests/ for the project and a GitHub Actions workflow.

Tests (CPU only, no model weights, datasets, or network):
- TemporalSmoothing: depthwise conv shape, Gaussian kernel normalization and
  symmetry, length preservation, constant-signal invariance.
- demo_utils.VALID_SUFFIXES: modality set, non-empty lowercase dot-prefixed
  suffixes, no cross-modality overlap.
- ExtractWordsFromAudio: unsupported-language guard and default language.

CI: pytest on Python 3.11 and 3.12, plus black and isort checks scoped to
tests/ for now.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant