Testing

Shopyo uses pytest for its test suite. Quality software requires testing; don’t break the build.

Running Tests

You should run tests from the project root directory.

  • Standard run:

    $ pytest
    
  • Verbose run:

    $ pytest -v
    
  • Specific test file:

    $ pytest shopyo/api/tests/test_cli.py
    

Continuous Integration (Tox)

We use tox to verify compatibility across multiple Python versions (currently supporting 3.8 up to 3.13).

  • Run all environments:

    $ tox
    
  • Run specific environment (e.g., Python 3.11):

    $ tox -e py311
    

Coverage Reports

To assess how much of the code is covered by tests, use pytest-cov.

  1. Install requirements:

    $ pip install -r requirements/tests.txt
    
  2. Generate report:

    $ pytest --cov=shopyo
    
  3. HTML report:

    $ pytest --cov=shopyo --cov-report=html
    $ python -m http.server 8000 --directory htmlcov