python-tooling icon indicating copy to clipboard operation
python-tooling copied to clipboard

Add regression test for generated package data

Open dstansby opened this issue 1 year ago • 0 comments

This adds a regression test for generated pacakge data. The test folder now has a data folder inside it which contains a reference copy of the generated package. This is then compared at test time to a newly generated package. Any differences are shown after the failing test with a diff that looks like:

E           RuntimeError: Non-zero diff between generated files and expected files.
E           Generated files can be found in /Users/dstansby/software/python-tooling/pytest_output/test_package_generation0/cookiecutter-test.
E
E           --- /Users/dstansby/software/python-tooling/pytest_output/test_package_generation0/cookiecutter-test/README.md
E           +++ /Users/dstansby/software/python-tooling/tests/data/test_package_generation/README.md
E           @@ -119,7 +119,7 @@
E            tox -e docs
E            ```
E            
E           -from the root of the repository. The built docs will be written to
E           +from the root of the repository. The built documentation will be written to
E            `site`.
E            
E            Alternatively to build and preview the documentation locally, in a Python

tests/test_package_generation.py:79: RuntimeError

To update the test files with an intentional change, the generated folder (which is placed inside pytest_output/) can be copied wholesale to the test data folder.

Fixes https://github.com/UCL-ARC/python-tooling/issues/329

dstansby avatar Jul 24 '24 15:07 dstansby