To run tests for the helixml/base-images
project, follow these steps:
Prerequisites
Ensure that you have Python and the necessary testing frameworks installed. You can check if Python is installed by running:
python --version
If you do not have Python, install it from python.org.
Additionally, ensure that you have pytest
installed. You can install pytest
using pip:
pip install pytest
Cloning the Repository
Clone the repository if you haven’t done so:
git clone https://github.com/helixml/base-images.git
cd base-images
Running Tests
The tests can typically be found in a directory named tests
within the project. To execute all tests currently available in the project, use the following command:
pytest tests/
This command automatically discovers and runs all test files that follow the naming convention test_*.py
.
Running Specific Tests
If you wish to run a specific test file, provide the filename as an argument to pytest
. For example:
pytest tests/test_example.py
To run a specific test within that file, add ::
followed by the test name:
pytest tests/test_example.py::test_specific_case
Adding Verbosity
For more detailed output regarding test results, you can increase verbosity using the -v
option:
pytest -v tests/
Running Tests with Coverage
To check the code coverage while running the tests, install the pytest-cov
plugin:
pip install pytest-cov
Then run the tests with coverage tracking enabled:
pytest --cov=your_module_name tests/
Replace your_module_name
with the actual module you want to measure coverage for.
Viewing Test Results
Upon completion of the tests, you will see the results in the terminal. Successful tests will be marked as .
(dot), while failed tests will be labeled with an F
. The output will also provide detailed information regarding any assertion failures, including stack traces.
Cleaning Up After Tests
Some testing frameworks might leave temporary files or caches. If you wish to clean up after running your tests, you can manually remove any generated files or directories that are utilized for testing purposes.
This document is based on standard practices for running tests in Python projects and may vary depending on specific configurations in the helixml/base-images
repository.
Source: Internal project guidelines and community practices.