Skip to content

Conversation

samcunliffe
Copy link
Member

@samcunliffe samcunliffe commented Jul 16, 2025

  • Remove tmp_path fixture from every test...
  • ...but then need to write a nested function for the fixture.
  • Also add default_config and default_config_with fixtures to help the cookiecutter generation.

In the end it doesn't actually reduce the linecount (because I had to add to the docstrings).

Remove tmp_path fixture from every test, but then need to write a nested function for the fixture. Also add a DEFAULT_CONFIG for the cookiecutter generation.
@samcunliffe samcunliffe added the enhancement New feature or request label Jul 16, 2025
@samcunliffe samcunliffe self-assigned this Jul 16, 2025
@samcunliffe samcunliffe marked this pull request as ready for review July 16, 2025 13:47
@samcunliffe samcunliffe requested a review from Copilot July 16, 2025 13:47
Copilot

This comment was marked as outdated.

@samcunliffe samcunliffe requested a review from a team July 16, 2025 13:50
Copy link
Collaborator

@matt-graham matt-graham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me - even if it doesn't reduce line count significantly, I think the avoidance of having the same setup code across multiple tests makes the tests much more readable. I've added a couple of small suggestions and a question about how we're managing imports from helpers.py module, but these are all minor and from my perpsective this looks good to merge irrespective!

samcunliffe and others added 2 commits July 18, 2025 09:26
Also add a default_config_with fixture for default plus one change (the
main use case in our parametrised tests).
Copilot

This comment was marked as resolved.

Copy link
Member

@paddyroddy paddyroddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines of code is a silly metric. This looks like a good change. Some comments though.

@matt-graham matt-graham linked an issue Jul 23, 2025 that may be closed by this pull request
samcunliffe and others added 2 commits July 23, 2025 10:22
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
Copy link
Contributor

@p-j-smith p-j-smith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this a lot, it's nice to remove some duplication. One suggestion around using indirect parameterisation

…to be used at once.

Co-authored-by: Matt Graham <matthew.m.graham@gmail.com>
Contravenes PT003 but "Explicit is better than implicit."

Co-authored-by: Paddy Roddy <patrickjamesroddy@gmail.com>
@samcunliffe samcunliffe force-pushed the sc/dry-up-test-fixtures branch from 4816a6f to 571679c Compare July 23, 2025 11:38
@samcunliffe
Copy link
Member Author

In the end, I think I prefer Matt's way. Though the implicit parameterisation does look very useful.

@samcunliffe samcunliffe requested a review from p-j-smith July 23, 2025 11:39
@samcunliffe samcunliffe merged commit f115ae7 into main Jul 23, 2025
15 checks passed
@samcunliffe samcunliffe deleted the sc/dry-up-test-fixtures branch July 23, 2025 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor generate_package fixture to avoid repetition in tests

4 participants