12rambau / pytest-copie

The pytest plugin for your copier templates 📒
https://pytest-copie.readthedocs.io/en/latest/
MIT License
14 stars 2 forks source link

Test pytest-copie on a demo template repo as part of test suite #54

Closed GenevieveBuckley closed 8 months ago

GenevieveBuckley commented 8 months ago

This PR adds integration tests for pytest-copie.

The current test suite includes test of the pytest-copie fixture, but currently does not check whether pytest-copie can run on a demo template repository.

This PR adds a demo_template folder to the repo, containing the files described in the user example guide at doc/usage.rst. This is then included in the pytest testpaths, so the example tests in the demo template are executed at test time.

Advantages: Future changes to pytest-copie will not cause the usage instructions to become incorrect without anyone noticing. I think it was this one that caused problems with all the assert result.projject_dir.name == "foobar" statements in the user guide, so it has happened before.

Disadvantages: There's nothing stopping someone from fixing the tests in the new demo template, but not ALSO making the same changes to doc/usage.rst. So, unless the reviewer spots this, it might still be possible for the user instructions to become inaccurate again. Hopefully this will be less likely, though.

GenevieveBuckley commented 8 months ago

Context: I felt like this would be good to have after finding a number of small problems with the example code presented in doc/usage.rst (eg: here, here, and here) that meant you could not copy-paste and run it without errors. So having a test that does execute the hello world user example seemed sensible to prevent this.

codecov[bot] commented 8 months ago

Codecov Report

Merging #54 (ebd035c) into main (c9f5e3f) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #54   +/-   ##
=======================================
  Coverage   98.59%   98.59%           
=======================================
  Files           2        2           
  Lines          71       71           
=======================================
  Hits           70       70           
  Misses          1        1