poetry run pytest copier tests ============================= test session starts ============================= platform win32 -- Python 3.6.8, pytest-5.4.3, py-1.8.2, pluggy-0.13.1 rootdir: C:\Users\user\copier plugins: cov-2.10.0, forked-1.1.3, timeout-1.4.1, xdist-1.32.0 collected 113 items tests\test_answersfile.py .. [ 1%] tests\test_cleanup.py .. [ 3%] tests\test_cli.py .. [ 5%] tests\test_complex_questions.py .... [ 8%] tests\test_config.py ...F............................ [ 37%] tests\test_copy.py .FFFFFF..FFFFFF. [ 51%] tests\test_demo_update_tasks.py F [ 52%] tests\test_exclude.py .. [ 53%] tests\test_extra_paths.py .... [ 57%] tests\test_migrations.py FF [ 59%] tests\test_minimum_version.py .... [ 62%] tests\test_normal_jinja2.py . [ 63%] tests\test_output.py FFFFF [ 68%] tests\test_prompt.py FFF [ 70%] tests\test_subdirectory.py ..FFF [ 75%] tests\test_tasks.py F. [ 76%] tests\test_templated_prompt.py ............. [ 88%] tests\test_tools.py ......... [ 96%] tests\test_updatediff.py FF [ 98%] tests\test_vcs.py FF [100%] ================================== FAILURES =================================== ______________________________ test_invalid_yaml ______________________________ capsys = <_pytest.capture.CaptureFixture object at 0x000001F82B8625C0> def test_invalid_yaml(capsys): conf_path = Path("tests/demo_invalid/copier.yml") with pytest.raises(InvalidConfigFileError): load_yaml_data(conf_path) out, _ = capsys.readouterr() > assert re.search(r"INVALID.*tests/demo_invalid/copier\.yml", out) E assert None E + where None = ('INVALID.*tests/demo_invalid/copier\\.yml', "\n\x1b[31m\x1b[1mINVALID CONFIG FILE\x1b[39m\x1b[0m tests\\demo_invalid\\copier.yml\n------------------------------------------\n(WindowsPath('tests/demo_invalid/copier.yml'), False)\n------------------------------------------\n") E + where = re.search tests\test_config.py:52: AssertionError __________________________________ test_copy __________________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_copy0') def test_copy(tmp_path): > render(tmp_path) tests\test_copy.py:20: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. _______________________________ test_copy_repo ________________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_copy_repo0') def test_copy_repo(tmp_path): copier.copy( "gh:copier-org/copier.git", tmp_path, vcs_ref="HEAD", quiet=True, > exclude=["*", "!README.*"], ) tests\test_copy.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.9kpeguda\\.git\\objects\\pack' onerror = .onerror at 0x000001F82B931BF8> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.9kpeguda\\.git\\objects\\pack\\pack-ad21e377bf323a731ceb92acc46d87aa4550aa15.idx' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ____________________________ test_default_exclude _____________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_default_exclude0') def test_default_exclude(tmp_path): > render(tmp_path) tests\test_copy.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. ______________________________ test_include_file ______________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_include_file0') def test_include_file(tmp_path): > render(tmp_path, exclude=["!.svn"]) tests\test_copy.py:71: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. ____________________________ test_include_pattern _____________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_include_pattern0') def test_include_pattern(tmp_path): > render(tmp_path, exclude=["!.*"]) tests\test_copy.py:76: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. ______________________________ test_exclude_file ______________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_exclude_file0') def test_exclude_file(tmp_path): > render(tmp_path, exclude=["mañana.txt"]) tests\test_copy.py:81: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. _____________________________ test_config_exclude _____________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_config_exclude0') monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x000001F82B933C18> def test_config_exclude(tmp_path, monkeypatch): def fake_data(*_args, **_kwargs): return {"_exclude": ["*.txt"]} monkeypatch.setattr(copier.config.factory, "load_config_data", fake_data) > copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, quiet=True) tests\test_copy.py:120: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. _______________________ test_config_exclude_overridden ________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_config_exclude_overridden0') def test_config_exclude_overridden(tmp_path): def fake_data(*_args, **_kwargs): return {"_exclude": ["*.txt"]} > copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, quiet=True, exclude=[]) tests\test_copy.py:128: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. _____________________________ test_config_include _____________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_config_include0') monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x000001F82BAEAD68> def test_config_include(tmp_path, monkeypatch): def fake_data(*_args, **_kwargs): return {"_exclude": ["!.svn"]} monkeypatch.setattr(copier.config.factory, "load_config_data", fake_data) > copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, quiet=True) tests\test_copy.py:137: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. ______________________________ test_skip_option _______________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_skip_option0') def test_skip_option(tmp_path): > render(tmp_path) tests\test_copy.py:142: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. ______________________________ test_force_option ______________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_force_option0') def test_force_option(tmp_path): > render(tmp_path) tests\test_copy.py:151: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. _____________________________ test_pretend_option _____________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_pretend_option0') def test_pretend_option(tmp_path): > render(tmp_path, pretend=True) tests\test_copy.py:160: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. ______________________________ test_update_tasks ______________________________ tmpdir = local('C:\\Users\\user\\AppData\\Local\\Temp\\1\\pytest-of-user\\pytest-1\\test_update_tasks0') def test_update_tasks(tmpdir): """Test that updating a template runs tasks from the expected version.""" tmp_path = tmpdir / "tmp_path" # Copy the 1st version copy( > str(REPO_BUNDLE_PATH), tmp_path, force=True, vcs_ref="v1", ) tests\test_demo_update_tasks.py:18: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.du08s5pi\\.git\\objects\\pack' onerror = .onerror at 0x000001F82B8C1840> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.du08s5pi\\.git\\objects\\pack\\pack-70a1f508c11b752fb1f2347aa9cf3d30a0f3ae2c.idx' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- create .copier-answers.yml create v1.txt file only in v1 ---------------------------- Captured stderr call ----------------------------- > Running task 1 of 1: cat v1.txt __________________________ test_migrations_and_tasks __________________________ src_path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\pytest-of-user\\pytest-1\\test_migrations_and_tasks0\\src' dst_path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\pytest-of-user\\pytest-1\\test_migrations_and_tasks0\\tmp_path' data = None def copy( src_path: OptStr = None, dst_path: StrOrPath = ".", data: AnyByStrDict = None, *, answers_file: OptStr = None, exclude: OptStrSeq = None, skip_if_exists: OptStrSeq = None, tasks: OptStrSeq = None, envops: AnyByStrDict = None, extra_paths: OptStrSeq = None, pretend: OptBool = False, force: OptBool = False, skip: OptBool = False, quiet: OptBool = False, cleanup_on_error: OptBool = True, vcs_ref: OptStr = None, only_diff: OptBool = True, subdirectory: OptStr = None, ) -> None: """ Uses the template in src_path to generate a new project at dst_path. Arguments: - src_path (str): Absolute path to the project skeleton. May be a version control system URL. If `None`, it will be taken from `dst_path/answers_file` or fail. - dst_path (str): Absolute path to where to render the skeleton - data (dict): Optional. Data to be passed to the templates in addtion to the user data from a `copier.json`. - answers_file (str): Path where to obtain the answers recorded from the last update. The path must be relative to `dst_path`. - exclude (list): A list of names or gitignore-style patterns matching files or folders that must not be copied. - skip_if_exists (list): A list of names or gitignore-style patterns matching files or folders, that are skipped if another with the same name already exists in the destination folder. (It only makes sense if you are copying to a folder that already exists). - tasks (list): Optional lists of commands to run in order after finishing the copy. Like in the templates files, you can use variables on the commands that will be replaced by the real values before running the command. If one of the commands fail, the rest of them will not run. - envops (dict): Extra options for the Jinja template environment. - extra_paths (list): Optional. Additional paths, outside the `src_path`, from where to search for templates. This is intended to be used with shared parent templates, files with macros, etc. outside the copied project skeleton. - pretend (bool): Run but do not make any changes - force (bool): Overwrite files that already exist, without asking - skip (bool): Skip files that already exist, without asking - quiet (bool): Suppress the status output - cleanup_on_error (bool): Remove the destination folder if the copy process or one of the tasks fail. - vcs_ref (str): VCS reference to checkout in the template. - only_diff (bool): Try to update only the template diff. - subdirectory (str): Specify a subdirectory to use when generating the project. """ conf = make_config(**locals()) is_update = conf.original_src_path != conf.src_path and vcs.is_git_repo_root( conf.src_path ) do_diff_update = ( conf.only_diff and is_update and conf.old_commit and vcs.is_git_repo_root(Path(conf.dst_path)) ) try: if do_diff_update: update_diff(conf=conf) else: > copy_local(conf=conf) copier\main.py:142: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ conf = ConfigData(src_path=WindowsPath('C:/Users/user/AppData/Local/Temp/1/copier.vcs.clone.ga7flwwd'), subdirectory=None..._asking_user={}, data_from_answers_file={}, data_from_template_defaults={'_folder_name': 'tmp_path'}, _data_mutable={}) def copy_local(conf: ConfigData) -> None: must_filter = create_path_filter(conf.exclude) render = Renderer(conf) skip_patterns = [render.string(pattern) for pattern in conf.skip_if_exists] must_skip = create_path_filter(skip_patterns) if not conf.quiet: print("") # padding space folder: StrOrPath rel_folder: StrOrPath src_path = conf.src_path if conf.subdirectory is not None: src_path /= conf.subdirectory for folder, sub_dirs, files in os.walk(src_path): rel_folder = str(folder).replace(str(src_path), "", 1).lstrip(os.path.sep) rel_folder = render.string(rel_folder) rel_folder = str(rel_folder).replace("." + os.path.sep, ".", 1) if must_filter(rel_folder): # Folder is excluded, so stop walking it sub_dirs[:] = [] continue folder = Path(folder) rel_folder = Path(rel_folder) render_folder(rel_folder, conf) source_paths = get_source_paths( conf, folder, rel_folder, files, render, must_filter ) for source_path, rel_path in source_paths: render_file(conf, rel_path, source_path, render, must_skip) if not conf.quiet: print("") # padding space run_tasks( > conf, render, [{"task": t, "extra_env": {"STAGE": "task"}} for t in conf.tasks] ) copier\main.py:196: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ conf = ConfigData(src_path=WindowsPath('C:/Users/user/AppData/Local/Temp/1/copier.vcs.clone.ga7flwwd'), subdirectory=None..._asking_user={}, data_from_answers_file={}, data_from_template_defaults={'_folder_name': 'tmp_path'}, _data_mutable={}) render = tasks = [{'extra_env': {'STAGE': 'task'}, 'task': "[[ _copier_conf.src_path / 'tasks.sh' ]] 1"}, {'extra_env': {'STAGE': 'task'}, 'task': ["[[ _copier_conf.src_path / 'tasks.sh' ]]", '2']}] def run_tasks(conf: ConfigData, render: Renderer, tasks: Sequence[Dict]) -> None: for i, task in enumerate(tasks): task_cmd = task["task"] use_shell = isinstance(task_cmd, str) if use_shell: task_cmd = render.string(task_cmd) else: task_cmd = [render.string(part) for part in task_cmd] if not conf.quiet: print( colors.info | f" > Running task {i + 1} of {len(tasks)}: {task_cmd}", file=sys.stderr, ) with local.cwd(conf.dst_path), local.env(**task.get("extra_env", {})): > subprocess.run(task_cmd, shell=use_shell, check=True, env=local.env) copier\main.py:377: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ input = None, timeout = None, check = True popenargs = (['C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.ga7flwwd\\tasks.sh', '2'],) kwargs = {'env': , 'shell': False} def run(*popenargs, input=None, timeout=None, check=False, **kwargs): """Run command with arguments and return a CompletedProcess instance. The returned instance will have attributes args, returncode, stdout and stderr. By default, stdout and stderr are not captured, and those attributes will be None. Pass stdout=PIPE and/or stderr=PIPE in order to capture them. If check is True and the exit code was non-zero, it raises a CalledProcessError. The CalledProcessError object will have the return code in the returncode attribute, and output & stderr attributes if those streams were captured. If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised. There is an optional argument "input", allowing you to pass a string to the subprocess's stdin. If you use this argument you may not also use the Popen constructor's "stdin" argument, as it will be used internally. The other arguments are the same as for the Popen constructor. If universal_newlines=True is passed, the "input" argument must be a string and stdout/stderr in the returned object will be strings rather than bytes. """ if input is not None: if 'stdin' in kwargs: raise ValueError('stdin and input arguments may not both be used.') kwargs['stdin'] = PIPE > with Popen(*popenargs, **kwargs) as process: ..\AppData\Local\Programs\Python\Python36\Lib\subprocess.py:423: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.ga7flwwd\\tasks.sh', '2'] bufsize = -1, executable = None, stdin = None, stdout = None, stderr = None preexec_fn = None, close_fds = True, shell = False, cwd = None env = universal_newlines = False, startupinfo = None, creationflags = 0 restore_signals = True, start_new_session = False, pass_fds = () def __init__(self, args, bufsize=-1, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=_PLATFORM_DEFAULT_CLOSE_FDS, shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, creationflags=0, restore_signals=True, start_new_session=False, pass_fds=(), *, encoding=None, errors=None): """Create new Popen instance.""" _cleanup() # Held while anything is calling waitpid before returncode has been # updated to prevent clobbering returncode if wait() or poll() are # called from multiple threads at once. After acquiring the lock, # code must re-check self.returncode to see if another thread just # finished a waitpid() call. self._waitpid_lock = threading.Lock() self._input = None self._communication_started = False if bufsize is None: bufsize = -1 # Restore default if not isinstance(bufsize, int): raise TypeError("bufsize must be an integer") if _mswindows: if preexec_fn is not None: raise ValueError("preexec_fn is not supported on Windows " "platforms") any_stdio_set = (stdin is not None or stdout is not None or stderr is not None) if close_fds is _PLATFORM_DEFAULT_CLOSE_FDS: if any_stdio_set: close_fds = False else: close_fds = True elif close_fds and any_stdio_set: raise ValueError( "close_fds is not supported on Windows platforms" " if you redirect stdin/stdout/stderr") else: # POSIX if close_fds is _PLATFORM_DEFAULT_CLOSE_FDS: close_fds = True if pass_fds and not close_fds: warnings.warn("pass_fds overriding close_fds.", RuntimeWarning) close_fds = True if startupinfo is not None: raise ValueError("startupinfo is only supported on Windows " "platforms") if creationflags != 0: raise ValueError("creationflags is only supported on Windows " "platforms") self.args = args self.stdin = None self.stdout = None self.stderr = None self.pid = None self.returncode = None self.universal_newlines = universal_newlines self.encoding = encoding self.errors = errors # Input and output objects. The general principle is like # this: # # Parent Child # ------ ----- # p2cwrite ---stdin---> p2cread # c2pread <--stdout--- c2pwrite # errread <--stderr--- errwrite # # On POSIX, the child objects are file descriptors. On # Windows, these are Windows file handles. The parent objects # are file descriptors on both platforms. The parent objects # are -1 when not using PIPEs. The child objects are -1 # when not redirecting. (p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) = self._get_handles(stdin, stdout, stderr) # We wrap OS handles *before* launching the child, otherwise a # quickly terminating child could make our fds unwrappable # (see #8458). if _mswindows: if p2cwrite != -1: p2cwrite = msvcrt.open_osfhandle(p2cwrite.Detach(), 0) if c2pread != -1: c2pread = msvcrt.open_osfhandle(c2pread.Detach(), 0) if errread != -1: errread = msvcrt.open_osfhandle(errread.Detach(), 0) text_mode = encoding or errors or universal_newlines self._closed_child_pipe_fds = False try: if p2cwrite != -1: self.stdin = io.open(p2cwrite, 'wb', bufsize) if text_mode: self.stdin = io.TextIOWrapper(self.stdin, write_through=True, line_buffering=(bufsize == 1), encoding=encoding, errors=errors) if c2pread != -1: self.stdout = io.open(c2pread, 'rb', bufsize) if text_mode: self.stdout = io.TextIOWrapper(self.stdout, encoding=encoding, errors=errors) if errread != -1: self.stderr = io.open(errread, 'rb', bufsize) if text_mode: self.stderr = io.TextIOWrapper(self.stderr, encoding=encoding, errors=errors) self._execute_child(args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, > restore_signals, start_new_session) ..\AppData\Local\Programs\Python\Python36\Lib\subprocess.py:729: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.ga7flwwd\\tasks.sh 2' executable = None, preexec_fn = None, close_fds = True, pass_fds = () cwd = None, env = startupinfo = creationflags = 0, shell = False, p2cread = -1, p2cwrite = -1, c2pread = -1 c2pwrite = -1, errread = -1, errwrite = -1, unused_restore_signals = True unused_start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, unused_restore_signals, unused_start_new_session): """Execute program (MS Windows version)""" assert not pass_fds, "pass_fds not supported on Windows." if not isinstance(args, str): args = list2cmdline(args) # Process startup details if startupinfo is None: startupinfo = STARTUPINFO() if -1 not in (p2cread, c2pwrite, errwrite): startupinfo.dwFlags |= _winapi.STARTF_USESTDHANDLES startupinfo.hStdInput = p2cread startupinfo.hStdOutput = c2pwrite startupinfo.hStdError = errwrite if shell: startupinfo.dwFlags |= _winapi.STARTF_USESHOWWINDOW startupinfo.wShowWindow = _winapi.SW_HIDE comspec = os.environ.get("COMSPEC", "cmd.exe") args = '{} /c "{}"'.format (comspec, args) # Start the process try: hp, ht, pid, tid = _winapi.CreateProcess(executable, args, # no special security None, None, int(not close_fds), creationflags, env, os.fspath(cwd) if cwd is not None else None, > startupinfo) E OSError: [WinError 193] %1 n’est pas une application Win32 valide ..\AppData\Local\Programs\Python\Python36\Lib\subprocess.py:1017: OSError During handling of the above exception, another exception occurred: tmpdir = local('C:\\Users\\user\\AppData\\Local\\Temp\\1\\pytest-of-user\\pytest-1\\test_migrations_and_tasks0') def test_migrations_and_tasks(tmpdir: py.path.local): """Check migrations and tasks are run properly.""" # Convert demo_migrations in a git repository with 2 versions git_src, tmp_path = tmpdir / "src", tmpdir / "tmp_path" copytree(SRC, git_src) with local.cwd(git_src): git("init") git("config", "user.name", "Copier Test") git("config", "user.email", "test@copier") git("add", ".") git("commit", "-m1") git("tag", "v1.0.0") git("commit", "--allow-empty", "-m2") git("tag", "v2.0") # Copy it in v1 > copy(src_path=str(git_src), dst_path=str(tmp_path), vcs_ref="v1.0.0") tests\test_migrations.py:32: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.ga7flwwd\\.git\\objects\\0e' onerror = .onerror at 0x000001F82B945488> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.ga7flwwd\\.git\\objects\\0e\\92118043fe6fb317c5d9a76df346fa8d39ca74' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- create copier.yaml create delete-in-migration-v2.txt create delete-in-tasks.txt create .copier-answers.yml Something went wrong. Removing destination folder. ---------------------------- Captured stderr call ----------------------------- > Running task 1 of 2: C:\Users\user\AppData\Local\Temp\1\copier.vcs.clone.ga7flwwd\tasks.sh 1 > Running task 2 of 2: ['C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.ga7flwwd\\tasks.sh', '2'] _____________________ test_pre_migration_modifies_answers _____________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1')) def test_pre_migration_modifies_answers(tmp_path_factory): """Test support for answers modifications in pre-migrations.""" template = tmp_path_factory.mktemp("template") subproject = tmp_path_factory.mktemp("subproject") # v1 of template asks for a favourite song and writes it to songs.yaml with local.cwd(template): build_file_tree( { "[[ _copier_conf.answers_file ]].tmpl": "[[ _copier_answers|to_nice_yaml ]]", "copier.yml": """\ best_song: la vie en rose """, "songs.yaml.tmpl": "- [[ best_song ]]", } ) git("init") git("add", ".") git("commit", "-m1") git("tag", "v1") # User copies v1 template into subproject with local.cwd(subproject): > copy(src_path=str(template), force=True) tests\test_migrations.py:84: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.ui5mgkir\\.git\\objects\\11' onerror = .onerror at 0x000001F82B988E18> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.ui5mgkir\\.git\\objects\\11\\975b5af23cdaf9c47adbc1c77929d2434998ce' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- create songs.yaml create .copier-answers.yml _________________________________ test_output _________________________________ capsys = <_pytest.capture.CaptureFixture object at 0x000001F82B9B25C0> tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_output0') def test_output(capsys, tmp_path): > render(tmp_path, quiet=False) tests\test_output.py:7: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- create .gitignore create aaaa.txt create config.py create pyproject.toml create README.txt create py3_only.py create awesome.txt create doc\ create doc\manana.txt create doc\mañana.txt create doc\mañana.txt create doc\images\ create doc\images\nslogo.gif Something went wrong. Removing destination folder. _____________________________ test_output_pretend _____________________________ capsys = <_pytest.capture.CaptureFixture object at 0x000001F82B9B0E48> tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_output_pretend0') def test_output_pretend(capsys, tmp_path): > render(tmp_path, quiet=False, pretend=True) tests\test_output.py:15: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- create .gitignore create aaaa.txt create config.py create pyproject.toml create README.txt create py3_only.py create awesome.txt create doc\ create doc\manana.txt create doc\mañana.txt create doc\mañana.txt create doc\images\ create doc\images\nslogo.gif Something went wrong. Removing destination folder. ______________________________ test_output_force ______________________________ capsys = <_pytest.capture.CaptureFixture object at 0x000001F82B8F7B00> tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_output_force0') def test_output_force(capsys, tmp_path): > render(tmp_path) tests\test_output.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. ______________________________ test_output_skip _______________________________ capsys = <_pytest.capture.CaptureFixture object at 0x000001F82B8FED30> tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_output_skip0') def test_output_skip(capsys, tmp_path): > render(tmp_path) tests\test_output.py:34: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. ______________________________ test_output_quiet ______________________________ capsys = <_pytest.capture.CaptureFixture object at 0x000001F82BAEA978> tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_output_quiet0') def test_output_quiet(capsys, tmp_path): > render(tmp_path, quiet=True) tests\test_output.py:45: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. _____________________ test_copy_default_advertised[name0] _____________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1')) monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x000001F82BB2AF60> capsys = <_pytest.capture.CaptureFixture object at 0x000001F82BB2A7F0> name = 'Mario' @pytest.mark.parametrize("name", [DEFAULT, None, "Luigi"]) def test_copy_default_advertised(tmp_path_factory, monkeypatch, capsys, name): """Test that the questions for the user are OK""" monkeypatch.setattr("sys.stdin", StringIO("\n" * 3)) template, subproject = ( tmp_path_factory.mktemp("template"), tmp_path_factory.mktemp("subproject"), ) with local.cwd(template): build_file_tree(MARIO_TREE) git("init") git("add", ".") git("commit", "-m", "v1") git("tag", "v1") git("commit", "--allow-empty", "-m", "v2") git("tag", "v2") with local.cwd(subproject): # Copy the v1 template kwargs = {} if name is not DEFAULT: kwargs["data"] = {"your_name": name} else: name = "Mario" # Default in the template > copy(str(template), ".", vcs_ref="v1", **kwargs) tests\test_prompt.py:59: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.u4hzdiaw\\.git\\objects\\32' onerror = .onerror at 0x000001F82BB2CF28> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.u4hzdiaw\\.git\\objects\\32\\2718f759cc66a0be249ce794ce31a802054eef' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- in_love? Format: bool 🎤? [Y/n] If you have a name, tell me now. your_name? Format: str 🎤 [Mario]: Secret enemy name your_enemy? Format: str 🕵️ [Bowser]: what_enemy_does? Format: str 🎤 [Bowser hates Mario]: create .copier-answers.yml _____________________ test_copy_default_advertised[None] ______________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1')) monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x000001F82B8A9128> capsys = <_pytest.capture.CaptureFixture object at 0x000001F82B8A9780> name = None @pytest.mark.parametrize("name", [DEFAULT, None, "Luigi"]) def test_copy_default_advertised(tmp_path_factory, monkeypatch, capsys, name): """Test that the questions for the user are OK""" monkeypatch.setattr("sys.stdin", StringIO("\n" * 3)) template, subproject = ( tmp_path_factory.mktemp("template"), tmp_path_factory.mktemp("subproject"), ) with local.cwd(template): build_file_tree(MARIO_TREE) git("init") git("add", ".") git("commit", "-m", "v1") git("tag", "v1") git("commit", "--allow-empty", "-m", "v2") git("tag", "v2") with local.cwd(subproject): # Copy the v1 template kwargs = {} if name is not DEFAULT: kwargs["data"] = {"your_name": name} else: name = "Mario" # Default in the template > copy(str(template), ".", vcs_ref="v1", **kwargs) tests\test_prompt.py:59: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.2chqf6ck\\.git\\objects\\32' onerror = .onerror at 0x000001F82B96BF28> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.2chqf6ck\\.git\\objects\\32\\2718f759cc66a0be249ce794ce31a802054eef' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- in_love? Format: bool 🎤? [Y/n] Secret enemy name your_enemy? Format: str 🕵️ [Bowser]: what_enemy_does? Format: str 🎤 [Bowser hates None]: create .copier-answers.yml _____________________ test_copy_default_advertised[Luigi] _____________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1')) monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x000001F82B8E4BE0> capsys = <_pytest.capture.CaptureFixture object at 0x000001F82B8E4CC0> name = 'Luigi' @pytest.mark.parametrize("name", [DEFAULT, None, "Luigi"]) def test_copy_default_advertised(tmp_path_factory, monkeypatch, capsys, name): """Test that the questions for the user are OK""" monkeypatch.setattr("sys.stdin", StringIO("\n" * 3)) template, subproject = ( tmp_path_factory.mktemp("template"), tmp_path_factory.mktemp("subproject"), ) with local.cwd(template): build_file_tree(MARIO_TREE) git("init") git("add", ".") git("commit", "-m", "v1") git("tag", "v1") git("commit", "--allow-empty", "-m", "v2") git("tag", "v2") with local.cwd(subproject): # Copy the v1 template kwargs = {} if name is not DEFAULT: kwargs["data"] = {"your_name": name} else: name = "Mario" # Default in the template > copy(str(template), ".", vcs_ref="v1", **kwargs) tests\test_prompt.py:59: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.r7ky45wz\\.git\\objects\\00' onerror = .onerror at 0x000001F82BB2CB70> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.r7ky45wz\\.git\\objects\\00\\0f3e3caac0656ae992210f0a5d3586c2f90cc3' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- in_love? Format: bool 🎤? [Y/n] Secret enemy name your_enemy? Format: str 🕵️ [Bowser]: what_enemy_does? Format: str 🎤 [Bowser hates Luigi]: create .copier-answers.yml __________________________ test_update_subdirectory ___________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_update_subdirectory0') def test_update_subdirectory(tmp_path): copier.copy("./tests/demo_subdirectory", tmp_path, force=True) with local.cwd(tmp_path): git_init() conf = make_config("./tests/demo_subdirectory", str(tmp_path), force=True) > update_diff(conf) tests\test_subdirectory.py:40: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:244: in update_diff diff = diff_cmd("--inter-hunk-context=0") ..\AppData\Local\Programs\Python\Python36\Lib\tempfile.py:809: in __exit__ self.cleanup() ..\AppData\Local\Programs\Python\Python36\Lib\tempfile.py:813: in cleanup _shutil.rmtree(self.name) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.main.update_diff.3se06lhi\\.git\\objects\\2b' onerror = .onerror at 0x000001F82B7F0F28> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.main.update_diff.3se06lhi\\.git\\objects\\2b\\d7d826946c28fc7c10e4e9d8ac142f595020cb' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- create conf_readme.md _____________________ test_new_version_uses_subdirectory ______________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1')) def test_new_version_uses_subdirectory(tmp_path_factory): # Template in v1 doesn't have a _subdirectory; # in v2 it moves all things into a subdir and adds that key to copier.yml. # Some files change. Downstream project has evolved too. Does that work as expected? template_path = tmp_path_factory.mktemp("subdirectory_template") project_path = tmp_path_factory.mktemp("subdirectory_project") # First, create the template with an initial README with local.cwd(template_path): with open("README.md", "w") as fd: fd.write("upstream version 1\n") with open("[[_copier_conf.answers_file]].tmpl", "w") as fd: fd.write("[[_copier_answers|to_nice_yaml]]\n") git_init("hello template") git("tag", "v1") # Generate the project a first time, assert the README exists > copier.copy(str(template_path), project_path, force=True) tests\test_subdirectory.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.v2gpta5f\\.git\\objects\\80' onerror = .onerror at 0x000001F82B945158> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.v2gpta5f\\.git\\objects\\80\\4d4137a341445e13e423dd7029683315068d6b' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- create README.md create .copier-answers.yml ____________________ test_new_version_changes_subdirectory ____________________ src_path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\pytest-of-user\\pytest-1\\subdirectory_template1' dst_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/subdirectory_project1') data = None def copy( src_path: OptStr = None, dst_path: StrOrPath = ".", data: AnyByStrDict = None, *, answers_file: OptStr = None, exclude: OptStrSeq = None, skip_if_exists: OptStrSeq = None, tasks: OptStrSeq = None, envops: AnyByStrDict = None, extra_paths: OptStrSeq = None, pretend: OptBool = False, force: OptBool = False, skip: OptBool = False, quiet: OptBool = False, cleanup_on_error: OptBool = True, vcs_ref: OptStr = None, only_diff: OptBool = True, subdirectory: OptStr = None, ) -> None: """ Uses the template in src_path to generate a new project at dst_path. Arguments: - src_path (str): Absolute path to the project skeleton. May be a version control system URL. If `None`, it will be taken from `dst_path/answers_file` or fail. - dst_path (str): Absolute path to where to render the skeleton - data (dict): Optional. Data to be passed to the templates in addtion to the user data from a `copier.json`. - answers_file (str): Path where to obtain the answers recorded from the last update. The path must be relative to `dst_path`. - exclude (list): A list of names or gitignore-style patterns matching files or folders that must not be copied. - skip_if_exists (list): A list of names or gitignore-style patterns matching files or folders, that are skipped if another with the same name already exists in the destination folder. (It only makes sense if you are copying to a folder that already exists). - tasks (list): Optional lists of commands to run in order after finishing the copy. Like in the templates files, you can use variables on the commands that will be replaced by the real values before running the command. If one of the commands fail, the rest of them will not run. - envops (dict): Extra options for the Jinja template environment. - extra_paths (list): Optional. Additional paths, outside the `src_path`, from where to search for templates. This is intended to be used with shared parent templates, files with macros, etc. outside the copied project skeleton. - pretend (bool): Run but do not make any changes - force (bool): Overwrite files that already exist, without asking - skip (bool): Skip files that already exist, without asking - quiet (bool): Suppress the status output - cleanup_on_error (bool): Remove the destination folder if the copy process or one of the tasks fail. - vcs_ref (str): VCS reference to checkout in the template. - only_diff (bool): Try to update only the template diff. - subdirectory (str): Specify a subdirectory to use when generating the project. """ conf = make_config(**locals()) is_update = conf.original_src_path != conf.src_path and vcs.is_git_repo_root( conf.src_path ) do_diff_update = ( conf.only_diff and is_update and conf.old_commit and vcs.is_git_repo_root(Path(conf.dst_path)) ) try: if do_diff_update: update_diff(conf=conf) else: > copy_local(conf=conf) copier\main.py:142: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ conf = ConfigData(src_path=WindowsPath('C:/Users/user/AppData/Local/Temp/1/copier.vcs.clone.cj9r8gxa'), subdirectory='sub...{}, data_from_answers_file={}, data_from_template_defaults={'_folder_name': 'subdirectory_project1'}, _data_mutable={}) def copy_local(conf: ConfigData) -> None: must_filter = create_path_filter(conf.exclude) render = Renderer(conf) skip_patterns = [render.string(pattern) for pattern in conf.skip_if_exists] must_skip = create_path_filter(skip_patterns) if not conf.quiet: print("") # padding space folder: StrOrPath rel_folder: StrOrPath src_path = conf.src_path if conf.subdirectory is not None: src_path /= conf.subdirectory for folder, sub_dirs, files in os.walk(src_path): rel_folder = str(folder).replace(str(src_path), "", 1).lstrip(os.path.sep) rel_folder = render.string(rel_folder) rel_folder = str(rel_folder).replace("." + os.path.sep, ".", 1) if must_filter(rel_folder): # Folder is excluded, so stop walking it sub_dirs[:] = [] continue folder = Path(folder) rel_folder = Path(rel_folder) render_folder(rel_folder, conf) source_paths = get_source_paths( conf, folder, rel_folder, files, render, must_filter ) for source_path, rel_path in source_paths: > render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:190: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ conf = ConfigData(src_path=WindowsPath('C:/Users/user/AppData/Local/Temp/1/copier.vcs.clone.cj9r8gxa'), subdirectory='sub...{}, data_from_answers_file={}, data_from_template_defaults={'_folder_name': 'subdirectory_project1'}, _data_mutable={}) rel_path = WindowsPath('.copier-answers.yml') src_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/copier.vcs.clone.cj9r8gxa/subdir1/[[_copier_conf.answers_file]].tmpl') render = must_skip = .match at 0x000001F82B945C80> def render_file( conf: ConfigData, rel_path: Path, src_path: Path, render: Renderer, must_skip: CheckPathFunc, ) -> None: """Process or copy a file of the skeleton.""" content: Optional[str] = None if str(src_path).endswith(conf.templates_suffix): > content = render(src_path) copier\main.py:325: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = fullpath = WindowsPath('C:/Users/user/AppData/Local/Temp/1/copier.vcs.clone.cj9r8gxa/subdir1/[[_copier_conf.answers_file]].tmpl') def __call__(self, fullpath: StrOrPath) -> str: relpath = ( str(fullpath).replace(str(self.conf.src_path), "", 1).lstrip(os.path.sep) ) > tmpl = self.env.get_template(relpath) copier\tools.py:158: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = name = 'subdir1\\[[_copier_conf.answers_file]].tmpl', parent = None globals = None @internalcode def get_template(self, name, parent=None, globals=None): """Load a template from the loader. If a loader is configured this method asks the loader for the template and returns a :class:`Template`. If the `parent` parameter is not `None`, :meth:`join_path` is called to get the real template name before loading. The `globals` parameter can be used to provide template wide globals. These variables are available in the context at render time. If the template does not exist a :exc:`TemplateNotFound` exception is raised. .. versionchanged:: 2.4 If `name` is a :class:`Template` object it is returned from the function unchanged. """ if isinstance(name, Template): return name if parent is not None: name = self.join_path(name, parent) > return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = name = 'subdir1\\[[_copier_conf.answers_file]].tmpl' globals = {'cycler': , 'dict': , 'joiner': , 'lipsum': , ...} @internalcode def _load_template(self, name, globals): if self.loader is None: raise TypeError("no loader for this environment specified") cache_key = (weakref.ref(self.loader), name) if self.cache is not None: template = self.cache.get(cache_key) if template is not None and ( not self.auto_reload or template.is_up_to_date ): return template > template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = environment = name = 'subdir1\\[[_copier_conf.answers_file]].tmpl' globals = {'cycler': , 'dict': , 'joiner': , 'lipsum': , ...} @internalcode def load(self, environment, name, globals=None): """Loads a template. This method looks up the template in the cache or loads one by calling :meth:`get_source`. Subclasses should not override this method as loaders working on collections of other loaders (such as :class:`PrefixLoader` or :class:`ChoiceLoader`) will not call this method but `get_source` directly. """ code = None if globals is None: globals = {} # first we try to get the source for this template together # with the filename and the uptodate function. > source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = environment = template = 'subdir1\\[[_copier_conf.answers_file]].tmpl' def get_source(self, environment, template): > pieces = split_template_path(template) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = 'subdir1\\[[_copier_conf.answers_file]].tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: subdir1\[[_copier_conf.answers_file]].tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound During handling of the above exception, another exception occurred: tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1')) def test_new_version_changes_subdirectory(tmp_path_factory): # Template in v3 changes from one subdirectory to another. # Some file evolves also. Sub-project evolves separately. # Sub-project is updated. Does that work as expected? template_path = tmp_path_factory.mktemp("subdirectory_template") project_path = tmp_path_factory.mktemp("subdirectory_project") # First, create the template with an initial subdirectory and README inside it with local.cwd(template_path): os.mkdir("subdir1") with open("subdir1/README.md", "w") as fd: fd.write("upstream version 1\n") with open("subdir1/[[_copier_conf.answers_file]].tmpl", "w") as fd: fd.write("[[_copier_answers|to_nice_yaml]]\n") # Add the subdirectory option to copier.yml with open("copier.yml", "w") as fd: fd.write("_subdirectory: subdir1\n") git_init("hello template") # Generate the project a first time, assert the README exists > copier.copy(str(template_path), project_path, force=True) tests\test_subdirectory.py:140: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.cj9r8gxa\\.git\\objects\\56' onerror = .onerror at 0x000001F82B8C17B8> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.cj9r8gxa\\.git\\objects\\56\\833abac2b79a6a1d12804857bcdc86051937e8' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- No git tags found in template; using HEAD as ref create README.md Something went wrong. Removing destination folder. ______________________________ test_render_tasks ______________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_render_tasks0') def test_render_tasks(tmp_path): tasks = ["touch [[ myvar ]]/1.txt", "touch [[ myvar ]]/2.txt"] > render(tmp_path, tasks=tasks) tests\test_tasks.py:8: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests\helpers.py:26: in render copier.copy(str(PROJECT_TEMPLATE), tmp_path, data=DATA, **kwargs) copier\main.py:142: in copy copy_local(conf=conf) copier\main.py:190: in copy_local render_file(conf, rel_path, source_path, render, must_skip) copier\main.py:325: in render_file content = render(src_path) copier\tools.py:158: in __call__ tmpl = self.env.get_template(relpath) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:883: in get_template return self._load_template(name, self.make_globals(globals)) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\environment.py:857: in _load_template template = self.loader.load(self, name, globals) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:115: in load source, filename, uptodate = self.get_source(environment, name) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:177: in get_source pieces = split_template_path(template) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ template = '[% if not py3 %]py2_folder[% endif %]\\thing.py.tmpl' def split_template_path(template): """Split a path into segments and perform a sanity check. If it detects '..' in the path it will raise a `TemplateNotFound` error. """ pieces = [] for piece in template.split("/"): if ( path.sep in piece or (path.altsep and path.altsep in piece) or piece == path.pardir ): > raise TemplateNotFound(template) E jinja2.exceptions.TemplateNotFound: [% if not py3 %]py2_folder[% endif %]\thing.py.tmpl ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\jinja2\loaders.py:32: TemplateNotFound ---------------------------- Captured stdout call ----------------------------- Something went wrong. Removing destination folder. _______________________________ test_updatediff _______________________________ tmpdir = local('C:\\Users\\user\\AppData\\Local\\Temp\\1\\pytest-of-user\\pytest-1\\test_updatediff0') def test_updatediff(tmpdir): tmp_path = Path(tmpdir) target = tmp_path / "target" readme = target / "README.txt" answers = target / ".copier-answers.yml" commit = git["commit", "--all"] # Run copier 1st time, with specific tag CopierApp.invoke( > "copy", str(REPO_BUNDLE_PATH), str(target), force=True, vcs_ref="v0.0.1" ) tests\test_updatediff.py:23: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\plumbum\cli\application.py:615: in invoke inst, retcode = subapp.run(argv, exit=False) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\plumbum\cli\application.py:572: in run retcode = inst.main(*tailargs) copier\cli.py:17: in _wrapper return method(*args, **kwargs) copier\cli.py:158: in main self.parent._copy(template_src, destination_path) copier\cli.py:121: in _copy **kwargs, copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.i1drx918\\.git\\objects\\pack' onerror = .onerror at 0x000001F82B84FBF8> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.i1drx918\\.git\\objects\\pack\\pack-fc2e28237057fb097e33d4b8e3de9631a78507e6.idx' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- create .copier-answers.yml create README.txt _________________________ test_commit_hooks_respected _________________________ tmp_path = WindowsPath('C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_commit_hooks_respected0/tmp_path') def test_commit_hooks_respected(tmp_path: Path): """Commit hooks are taken into account when producing the update diff.""" # Prepare source template v1 src, tmp_path = tmp_path / "src", tmp_path / "tmp_path" src.mkdir() with local.cwd(src): build_file_tree( { "copier.yml": """ _tasks: - git init - pre-commit install - pre-commit run -a || true what: grog """, "[[ _copier_conf.answers_file ]].tmpl": """ [[ _copier_answers|to_nice_yaml ]] """, ".pre-commit-config.yaml": r""" repos: - repo: https://github.com/prettier/prettier rev: 2.0.4 hooks: - id: prettier - repo: local hooks: - id: forbidden-files name: forbidden files entry: found forbidden files; remove them language: fail files: "\\.rej$" """, "life.yml.tmpl": """ # Following code should be reformatted by pre-commit after copying Line 1: hello Line 2: [[ what ]] Line 3: bye """, } ) git("init") git("add", ".") git("commit", "-m", "commit 1") git("tag", "v1") # Copy source template > copy(src_path=str(src), dst_path=tmp_path, force=True) tests\test_updatediff.py:187: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\main.py:150: in copy shutil.rmtree(conf.src_path) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.64je6k9p\\.git\\objects\\39' onerror = .onerror at 0x000001F82B891A60> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.64je6k9p\\.git\\objects\\39\\02e85b0dcaf023b573fc714909ecf81cccf59a' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError ---------------------------- Captured stdout call ----------------------------- create .pre-commit-config.yaml create life.yml create .copier-answers.yml Initialized empty Git repository in C:/Users/user/AppData/Local/Temp/1/pytest-of-user/pytest-1/test_commit_hooks_respected0/tmp_path/.git/ pre-commit installed at .git\hooks\pre-commit [INFO] Initializing environment for https://github.com/prettier/prettier. [INFO] Installing environment for https://github.com/prettier/prettier. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... prettier.............................................(no files to check)Skipped forbidden files......................................(no files to check)Skipped ---------------------------- Captured stderr call ----------------------------- > Running task 1 of 3: git init > Running task 2 of 3: pre-commit install > Running task 3 of 3: pre-commit run -a || true ________________________________ test_get_repo ________________________________ def test_get_repo(): get = vcs.get_repo assert get("git@git.myproject.org:MyProject") == "git@git.myproject.org:MyProject" assert ( get("git://git.myproject.org/MyProject") == "git://git.myproject.org/MyProject" ) assert ( get("https://github.com/jpscaletti/copier.git") == "https://github.com/jpscaletti/copier.git" ) assert ( get("gh:/jpscaletti/copier.git") == "https://github.com/jpscaletti/copier.git" ) assert get("gh:jpscaletti/copier.git") == "https://github.com/jpscaletti/copier.git" assert get("gl:jpscaletti/copier.git") == "https://gitlab.com/jpscaletti/copier.git" assert get("gh:jpscaletti/copier") == "https://github.com/jpscaletti/copier.git" assert get("gl:jpscaletti/copier") == "https://gitlab.com/jpscaletti/copier.git" assert ( get("git+https://git.myproject.org/MyProject") == "https://git.myproject.org/MyProject" ) assert ( get("git+ssh://git.myproject.org/MyProject") == "ssh://git.myproject.org/MyProject" ) assert get("git://git.myproject.org/MyProject.git@master") assert get("git://git.myproject.org/MyProject.git@v1.0") assert get("git://git.myproject.org/MyProject.git@da39a3ee5e6b4b0d3255bfef956018") > assert get("http://google.com") is None tests\test_vcs.py:40: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ copier\vcs.py:48: in get_repo or is_git_repo_root(url_path) copier\vcs.py:27: in is_git_repo_root with local.cwd(path / ".git"): ..\AppData\Local\Programs\Python\Python36\Lib\contextlib.py:81: in __enter__ return next(self.gen) ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\plumbum\path\local.py:375: in __call__ newdir = self.chdir(newdir) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = newdir = WindowsPath('http:/google.com/.git') def chdir(self, newdir): """Changes the current working directory to the given one :param newdir: The destination director (a string or a ``LocalPath``) """ if isinstance(newdir, RemotePath): raise TypeError("newdir cannot be %r" % (newdir, )) logger.debug("Chdir to %s", newdir) > os.chdir(str(newdir)) E OSError: [WinError 123] La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte: 'http:\\google.com\\.git' ..\.venvs\copier-6wp17jh--py3.6\lib\site-packages\plumbum\path\local.py:360: OSError _________________________________ test_clone __________________________________ def test_clone(): tmp = vcs.clone("https://github.com/copier-org/copier.git") assert tmp assert exists(join(tmp, "README.md")) > shutil.rmtree(tmp) tests\test_vcs.py:48: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:500: in rmtree return _rmtree_unsafe(path, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:390: in _rmtree_unsafe _rmtree_unsafe(fullname, onerror) ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:395: in _rmtree_unsafe onerror(os.unlink, fullname, sys.exc_info()) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ path = 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.171og9u6\\.git\\objects\\pack' onerror = .onerror at 0x000001F82BB3D268> def _rmtree_unsafe(path, onerror): try: if os.path.islink(path): # symlinks to directories are forbidden, see bug #1669 raise OSError("Cannot call rmtree on a symbolic link") except OSError: onerror(os.path.islink, path, sys.exc_info()) # can't continue even if onerror hook returns return names = [] try: names = os.listdir(path) except OSError: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except OSError: mode = 0 if stat.S_ISDIR(mode): _rmtree_unsafe(fullname, onerror) else: try: > os.unlink(fullname) E PermissionError: [WinError 5] Accès refusé: 'C:\\Users\\user\\AppData\\Local\\Temp\\1\\copier.vcs.clone.171og9u6\\.git\\objects\\pack\\pack-ad21e377bf323a731ceb92acc46d87aa4550aa15.idx' ..\AppData\Local\Programs\Python\Python36\Lib\shutil.py:393: PermissionError =========================== short test summary info =========================== FAILED tests/test_config.py::test_invalid_yaml - assert None FAILED tests/test_copy.py::test_copy - jinja2.exceptions.TemplateNotFound: [%... FAILED tests/test_copy.py::test_copy_repo - PermissionError: [WinError 5] Acc... FAILED tests/test_copy.py::test_default_exclude - jinja2.exceptions.TemplateN... FAILED tests/test_copy.py::test_include_file - jinja2.exceptions.TemplateNotF... FAILED tests/test_copy.py::test_include_pattern - jinja2.exceptions.TemplateN... FAILED tests/test_copy.py::test_exclude_file - jinja2.exceptions.TemplateNotF... FAILED tests/test_copy.py::test_config_exclude - jinja2.exceptions.TemplateNo... FAILED tests/test_copy.py::test_config_exclude_overridden - jinja2.exceptions... FAILED tests/test_copy.py::test_config_include - jinja2.exceptions.TemplateNo... FAILED tests/test_copy.py::test_skip_option - jinja2.exceptions.TemplateNotFo... FAILED tests/test_copy.py::test_force_option - jinja2.exceptions.TemplateNotF... FAILED tests/test_copy.py::test_pretend_option - jinja2.exceptions.TemplateNo... FAILED tests/test_demo_update_tasks.py::test_update_tasks - PermissionError: ... FAILED tests/test_migrations.py::test_migrations_and_tasks - PermissionError:... FAILED tests/test_migrations.py::test_pre_migration_modifies_answers - Permis... FAILED tests/test_output.py::test_output - jinja2.exceptions.TemplateNotFound... FAILED tests/test_output.py::test_output_pretend - jinja2.exceptions.Template... FAILED tests/test_output.py::test_output_force - jinja2.exceptions.TemplateNo... FAILED tests/test_output.py::test_output_skip - jinja2.exceptions.TemplateNot... FAILED tests/test_output.py::test_output_quiet - jinja2.exceptions.TemplateNo... FAILED tests/test_prompt.py::test_copy_default_advertised[name0] - Permission... FAILED tests/test_prompt.py::test_copy_default_advertised[None] - PermissionE... FAILED tests/test_prompt.py::test_copy_default_advertised[Luigi] - Permission... FAILED tests/test_subdirectory.py::test_update_subdirectory - PermissionError... FAILED tests/test_subdirectory.py::test_new_version_uses_subdirectory - Permi... FAILED tests/test_subdirectory.py::test_new_version_changes_subdirectory - Pe... FAILED tests/test_tasks.py::test_render_tasks - jinja2.exceptions.TemplateNot... FAILED tests/test_updatediff.py::test_updatediff - PermissionError: [WinError... FAILED tests/test_updatediff.py::test_commit_hooks_respected - PermissionErro... FAILED tests/test_vcs.py::test_get_repo - OSError: [WinError 123] La syntaxe ... FAILED tests/test_vcs.py::test_clone - PermissionError: [WinError 5] Accès re... ================== 32 failed, 81 passed in 320.33s (0:05:20) ==================