Skip to content

chore: modernize tests/CI and fix cross-platform/runtime bugs#205

Open
DiogoRibeiro7 wants to merge 1 commit into
GlobalFishingWatch:masterfrom
DiogoRibeiro7:chore/repo-portability-tests
Open

chore: modernize tests/CI and fix cross-platform/runtime bugs#205
DiogoRibeiro7 wants to merge 1 commit into
GlobalFishingWatch:masterfrom
DiogoRibeiro7:chore/repo-portability-tests

Conversation

@DiogoRibeiro7

Copy link
Copy Markdown

Summary

This PR improves repository reliability and developer workflow without changing model behavior.

What changed

  • Modernized test workflow to pytest:
    • Added marker-based test taxonomy (integration, tensorflow)
    • Updated default test entrypoint (test_all) to run fast local tests
    • Added pytest.ini and test collection guards in conftest.py
  • Added CI improvements:
    • New GitHub Actions workflow for unit tests across Python versions
    • Non-blocking TensorFlow smoke job
    • Updated Travis config to use the same test entrypoint
  • Added offline, deterministic unit coverage:
    • New fixture-backed tests for metadata and feature utilities
    • New unit tests for GCSFile, metrics helpers, and config behavior
    • Added dependency-sentinel tests so marker-only runs skip cleanly
  • Fixed cross-platform/runtime bugs:
    • GCSFile now closes file handles before temp cleanup (Windows-safe)
    • Removed Unix-only/unused imports that broke test collection on Windows
    • Fixed date parsing to timezone-aware UTC and removed deprecated datetime usage
    • Replaced Python 2 StandardError usage with Python 3-safe exception handling
    • Fixed broken helper functions in feature_utilities.py (undefined vars/offset logic)
    • Fixed runtime defects in metrics modules:
      • ydump.py missing imports and helper resolution
      • compute_vessel_metrics.py undefined labels bug in weights_by_class
      • compute_fishing_metrics.py unsafe debug prints and cleanup
  • Packaging and repo hygiene:
    • Improved setup.py metadata/package discovery and dev extras
    • Added .gitignore entries for Python cache artifacts
    • Updated README with current test/marker execution guidance

Why

The repo had environment-coupled tests, legacy CI assumptions, and several latent runtime issues (including Windows-specific failures).
These changes make local development and CI predictable, improve portability, and prevent regressions through targeted tests.

Validation

  • sh ./test_all passes
  • python -m pytest -q passes/skips as expected in non-integration environments
  • Added targeted unit tests for newly fixed behavior
  • Ran lint/static checks on touched modules (targeted ruff/pyflakes)

Notes

  • TensorFlow and GCS-backed integration tests remain opt-in by design.
  • No intentional changes to model training/inference semantics.

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.

1 participant