ImperialCollegeLondon / ImperialCollegeLondon/python-template

Test template via `pytest`

Open
#548 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
14
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Testing that the template actually works is currently a bit of a pain and has to be done manually. You have to run `cookiecutter` manually, then do whatever checks you want on top of the result (e.g. running `pre-commit`).

There are various checks we run as part of the CI workflow on templates generated with the different packaging options:

- Run `mypy`
- Run `pytest`
- Run `pre-commit`
- Run `mkdocs build --strict`
- Run `uv build`

We could make each of these separate `pytest` tests, running each of the commands with `subprocess.run`. This would make it easier to test locally and would provide other benefits (e.g. easy parameterisation).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing CI workflow and the tests around generated templates. Check how the template is rendered and how packaging options are represented, then assess separate pytest tests that invoke the listed commands with subprocess.run. Done means the generated templates can run mypy, pytest, pre-commit, mkdocs build --strict, and uv build through local tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.