This project contains a suite of tests for various Matplotlib plotting functions. It is designed to help you verify the correctness of plots and generate test reports.
requirements.txt— Python dependenciestests/— Test files for different plot typesreport.html— HTML test report (generated after running tests)htmlcov/— Coverage reports (if generated)assets/— Static assets (e.g., CSS)
git clone https://github.com/34wizrd/test-matplotlib.git
cd matplotlib-testingWindows (PowerShell):
python -m venv env
.\env\Scripts\Activate.ps1macOS/Linux:
python3 -m venv env
source env/bin/activatepip install -r requirements.txtpytestpytest tests/test_bar.pypytest tests/test_bar.py::test_function_nameAfter running your tests with pytest, you can generate a coverage report to see how much of your code is covered by tests:
pytest --cov=.-
This will display a coverage summary in the terminal.
-
To generate an HTML coverage report, run:
pytest --cov=. --cov-report=html
-
The HTML coverage report will be available in the
htmlcov/directory. Openhtmlcov/index.htmlin your browser to view detailed coverage information.
You can also generate a detailed HTML test report using the pytest-html plugin. After running your tests, run:
pytest --html=report.html- This will create a
report.htmlfile in the project root. - To open the report:
- Double-click
report.htmlto open it in your web browser, or - Right-click the file and select "Open with" → your preferred browser.
- Double-click
- For more advanced pytest options, see the pytest documentation.
If you encounter any issues, please check your Python version and ensure all dependencies are installed correctly.