omnisealbench / tests /README.md
Mark Duppenthaler
Updated table. No more individual rows, separate tabs for leaderboard type, export tables
7f6ef8f

Unit Tests for OmniSealBench

This directory contains unit tests for the OmniSealBench application.

Setup

Before running the tests, make sure you have installed the required dependencies:

# Install pytest and other testing dependencies
pip install pytest pytest-cov

# If you're using the environment.yml file
conda env update -f backend/environment.yml

Running Tests

To run all tests:

# From the project root directory
pytest tests/

# With coverage report
pytest tests/ --cov=backend

To run a specific test file:

pytest tests/test_app.py

To run a specific test function:

pytest tests/test_app.py::test_index_route

Test Structure

  • test_app.py: Tests for the Flask application routes and helper functions
  • conftest.py: Shared pytest fixtures for all test files
  • __init__.py: Makes the tests directory a Python package for better test discovery

Mocking

The tests use unittest.mock to mock external dependencies like:

  • File operations (reading CSV files)
  • API calls (requests.get)
  • Database connections

This ensures tests are isolated and don't depend on external services.

Adding New Tests

When adding new tests:

  1. Create a new test file if testing a new module
  2. Use descriptive test function names (e.g., test_data_files_benchmark)
  3. Add docstrings to explain what each test is checking
  4. Use fixtures from conftest.py when appropriate
  5. Mock external dependencies to ensure tests are isolated