Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: accept all alternative extentions for copier.yaml #51

Merged
merged 2 commits into from
Nov 1, 2023
Merged

Conversation

12rambau
Copy link
Owner

Fix #50

I try to detect any "copier" file with a yaml-like extension. My guess is that there should be only one so if multiple exist I take the first one.

@GenevieveBuckley do you think it's enough to solve the issue you raised?

@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

Merging #51 (44b985a) into main (60cd943) will decrease coverage by 2.60%.
Report is 2 commits behind head on main.
The diff coverage is 60.00%.

@@            Coverage Diff             @@
##             main      #51      +/-   ##
==========================================
- Coverage   98.59%   96.00%   -2.60%     
==========================================
  Files           2        2              
  Lines          71       75       +4     
==========================================
+ Hits           70       72       +2     
- Misses          1        3       +2     
Files Coverage Δ
pytest_copie/plugin.py 95.83% <60.00%> (-2.70%) ⬇️

Copy link
Contributor

@GenevieveBuckley GenevieveBuckley left a comment

Choose a reason for hiding this comment

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

This does fix the problem, thank you!

I think it would be nice to add a try/except statement around the copier_yaml line, so that we can raise a sensible error to the user, eg: "No copier.yaml configuration file found"

This is the error message that happens right now if no copier.yaml/copier.yml file is found. I think a new user would struggle to figure out what the cause of the problem was.

        # set the template dir and the associated copier.yaml file
        template_dir = template_dir or self.default_template_dir
        files = template_dir.glob("copier.*")
>       copier_yaml = next(f for f in files if f.suffix in [".yaml", ".yml"])
E       StopIteration

../../pytest-copie/pytest_copie/plugin.py:64: StopIteration
=========================== short test summary info ============================
FAILED tests/test_template.py::test_template - StopIteration

@GenevieveBuckley
Copy link
Contributor

Looks great, thank you!

@12rambau 12rambau merged commit 94ed9b0 into main Nov 1, 2023
@12rambau 12rambau deleted the extentions branch November 1, 2023 14:23
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pytest-copie does not recognise copier.yml, only copier.yaml
2 participants