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

!include config does not work #82

Closed
nicokant opened this issue May 2, 2024 · 4 comments · Fixed by #84
Closed

!include config does not work #82

nicokant opened this issue May 2, 2024 · 4 comments · Fixed by #84

Comments

@nicokant
Copy link

nicokant commented May 2, 2024

Describe the bug
Trying to run the test on a project with split configuration does not work.

A simple test produces the following error:

 <Result expected a single document in the stream\n  in "<unicode string>", line 2, column 1:\n    !include src/includes/shared.yml\n    ^\nbut found another document\n  in "<unicode string>", line 3, column 1:\n    ---\n    ^>.exit_code

To Reproduce
at the start of your copier.yml add:

---
!include example.yml
---

then create a new example.yml with a question

Run pytest

test_file.py

def test_template_with_extra_answers(copie):
    result = copie.copy()
    assert result.exit_code == 0
@12rambau
Copy link
Owner

12rambau commented May 7, 2024

I'm simply not aware of this mechanism from copier, can you point me to a documentation so I can understand what needs to be changed from my side ?

@nicokant
Copy link
Author

nicokant commented May 7, 2024

@davidbrownell
Copy link
Contributor

davidbrownell commented Jun 23, 2024

I believe that this can be fixed by changing the call yaml.safe_load to yaml.safe_load_all at

params = yaml.safe_load(copier_yaml.read_text())
.

Additional information can be found at https://stackoverflow.com/a/14404103.

I've created the fix at Support for `copier.yaml` files that include other files by davidbrownell · Pull Request #83 · 12rambau/pytest-copie (github.com).

@12rambau
Copy link
Owner

Fixed in #84

@12rambau 12rambau linked a pull request Jun 26, 2024 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants