pytest_copie.plugin¶
A pytest plugin to build copier project from a template.
Classes¶
Class to provide convenient access to the copier API. |
|
Holds the captured result of the copier project generation. |
Functions¶
|
Yield an instance of the |
|
Yield an instance of the |
|
Add option to the pytest command. |
|
Force the template path to be absolute to protect ourselves from fixtures that changes path. |
Module Contents¶
- class pytest_copie.plugin.Copie[source]¶
Class to provide convenient access to the copier API.
-
copy(extra_answers=
{}, template_dir=None, vcs_ref='HEAD')[source]¶ Create a copier Project from the template and return the associated
Resultobject.- Parameters:¶
- extra_answers : dict¶
extra answers to pass to the Copie object and overwrite the default ones
- template_dir : Optional[pathlib.Path]¶
the path to the template to use to create the project instead of the default “.”.
- vcs_ref : str¶
the commit hash, tag or branch to use from the template repo, for the copy
- Returns:¶
the result of the copier project generation
- Return type:¶
- git()[source]¶
A handle to allow execution of git commands during tests.
- Return type:¶
plumbum.machines.LocalCommand
-
update(result, extra_answers=
None, vcs_ref='HEAD')[source]¶ Update a copier Project from the template and return the associated
Resultobject, returns a newResult.
- default_template_dir : pathlib.Path[source]¶
The path to the default template to use to create the project.
-
copy(extra_answers=
- class pytest_copie.plugin.Result[source]¶
Holds the captured result of the copier project generation.
-
pytest_copie.plugin.copie(request, tmp_path, _copier_config_file, parent_tpl=
None)[source]¶ Yield an instance of the
Copiehelper class.The class can then be used to generate a project from a template.
- Parameters:¶
- request : Union[pytest.FixtureRequest, None]¶
the pytest request object (None when used outside of pytest)
- tmp_path : pathlib.Path¶
the temporary directory
- _copier_config_file : pathlib.Path¶
the temporary copier config file
- parent_tpl : Optional[pathlib.Path]¶
the path to the parent template directory, must be provided when used outside of pytest.
- Returns:¶
the object instance, ready to copy !
- Return type:¶
Generator
- pytest_copie.plugin.copie_session(request, tmp_path_factory, _copier_config_file)[source]¶
Yield an instance of the
Copiehelper class.The class can then be used to generate a project from a template.