Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 2.71 KB

File metadata and controls

62 lines (46 loc) · 2.71 KB

Testing MPGLite

This guide describes how to test MPGLite. The tests are located in the tests folder and are run using pytest.

Table of Contents

Requirements

To be able to run the tests, you need to have the pytest and mpglite installed.

Install pytest

pip install pytest

Install MPGLite as editable by running this command in the root of the repository:

pip install -e .

Tests

The tests folder includes the following files:

These test files can be run independently, but individual test functions within a file cannot. Some tests require a preceding test to be run first. Therefore, run entire test files instead of individual test functions.

Running the tests

If you want to run all the tests, simply run this command in the root of the repository:

pytest tests

To run a specific test file, simply this command in the root of the repository:

pytest tests/test_file_name.py

Troubleshooting

Terminating the tests may not end all processes using the port. This could cause some or even all of the tests to fail. In this case, run free_port.py (located in the tests folder). It kills port 8765 by default, but you can pass the port number as an argument (8888, for example).

python tests/free_port.py 8888

Automatic testing with GitHub Actions

When a commit is pushed or a new pull request is opened, the tests are run automatically with GitHub Actions on all major Python versions from 3.10 to 3.14, in an Ubuntu environment. You can view the results of the tests on the Actions page of the repository. The result of the latest tests is also shown on a badge in the README.