Follow the steps below to effectively run the tests for the helixml/aispec project. This guide assumes that you have the necessary environment set up and dependencies installed.

Step 1: Clone the Repository

First, ensure you have the repository cloned onto your local machine. Use the command below to clone the repository:

git clone https://github.com/helixml/aispec.git

Navigate into the cloned directory:

cd aispec

Step 2: Set Up Environment

Verify that all the necessary dependencies are installed. The project should include a requirements.txt file for Python dependencies. Install the required packages using:

pip install -r requirements.txt

Ensure that any additional tools or dependencies specified in the documentation are also installed.

Step 3: Locate Test Files

Identify where the test files are located within the project. Typically, they are found in a tests directory or similar. You can list the contents to confirm the files are there:

ls tests/

This should show Python files starting with test_, which contain your test cases.

Step 4: Running Tests with pytest

The recommended testing framework for this project is pytest. If you do not have it installed, install pytest using pip:

pip install pytest

Run the tests using the following command:

pytest tests/

This command will discover and run all the tests located in the tests directory, providing a detailed output on passed and failed tests.

Step 5: Running Specific Tests

If you need to run a specific test file, use:

pytest tests/test_specific.py

Replace test_specific.py with the name of the test file you wish to run. To run a specific test function within a test file, you can specify the function name:

pytest tests/test_specific.py::test_function_name

Replace test_function_name with the actual name of the test function.

Step 6: Generating a Test Report

To generate a detailed test report, use the --html option to create an HTML report of the test results:

pytest tests/ --html=report.html

After running this command, open report.html in any web browser to view the formatted report.

Step 7: Verifying Test Coverage (Optional)

If you want to check the code coverage of your tests, ensure you have the pytest-cov plugin installed. You can add it to your environment with:

pip install pytest-cov

Then run the tests with coverage measurement:

pytest --cov=your_source_directory tests/

Replace your_source_directory with the path to the source files you want to track for coverage.

Step 8: Continuous Integration (If Applicable)

If your project uses Continuous Integration (CI), ensure that tests are integrated into the CI configuration. This typically involves including the pytest command in your CI scripts.

By following the steps above, you can efficiently run and manage tests for the helixml/aispec project.

Source: helixml/aispec documentation.