Skip to content

Instantly share code, notes, and snippets.

@GenevieveBuckley
Last active August 28, 2023 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GenevieveBuckley/4839fa1ba39fe83b10c28dbee87e3abf to your computer and use it in GitHub Desktop.
Save GenevieveBuckley/4839fa1ba39fe83b10c28dbee87e3abf to your computer and use it in GitHub Desktop.
copier test failures
pre-commit-hooks.nix: updating /workspace/copier repo
pre-commit installed at .git/hooks/pre-commit
pre-commit installed at .git/hooks/commit-msg
direnv: No virtual environment exists. Executing `poetry install` to create one.
Creating virtualenv copier-tqPO6HKK-py3.10 in /workspace/.pyenv_mirror/poetry/virtualenvs
Installing dependencies from lock file
Package operations: 70 installs, 1 update, 0 removals
• Installing six (1.16.0)
• Installing markupsafe (2.1.1)
• Installing python-dateutil (2.8.2)
• Installing pyyaml (6.0.1)
• Installing click (8.1.3)
• Installing ghp-import (2.1.0)
• Installing jinja2 (3.1.2)
• Installing markdown (3.3.7)
• Installing mergedeep (1.3.4)
• Installing packaging (23.1)
• Installing pathspec (0.11.2)
• Installing platformdirs (2.6.2)
• Installing pyyaml-env-tag (0.1)
• Installing watchdog (2.2.1)
• Installing mkdocs (1.5.1)
• Installing colorama (0.4.6)
• Installing mkdocs-autorefs (0.4.1)
• Installing pymdown-extensions (10.0)
• Installing certifi (2022.12.7): Downloading... 0%
• Installing charset-normalizer (3.0.1): Pending...
• Installing distlib (0.3.6): Pending...
• Installing exceptiongroup (1.1.0): Installing...
• Installing filelock (3.9.0): Pending...
• Installing certifi (2022.12.7)
• Installing charset-normalizer (3.0.1)
• Installing distlib (0.3.6)
• Installing exceptiongroup (1.1.0)
• Installing filelock (3.9.0)
• Installing griffe (0.25.3)
• Installing idna (3.4)
• Installing iniconfig (2.0.0)
• Installing mkdocstrings (0.22.0)
• Installing pluggy (1.0.0)
• Updating setuptools (67.6.1 -> 66.0.0)
• Installing tomli (2.0.1)
• Installing typing-extensions (4.7.1)
• Installing urllib3 (1.26.14)
• Installing wcwidth (0.2.6)
• Installing annotated-types (0.5.0): Downloading... 0%
• Installing cfgv (3.3.1): Downloading... 100%
Connection pool is full, discarding connection: pypi.org. Connection pool size: 10
• Installing annotated-types (0.5.0): Downloading... 100%
• Installing cfgv (3.3.1): Downloading... 100%
• Installing annotated-types (0.5.0)
• Installing cfgv (3.3.1)
• Installing coverage (7.0.5)
• Installing execnet (1.9.0)
• Installing identify (2.5.13)
• Installing mkdocs-material-extensions (1.1.1)
• Installing mkdocstrings-python (0.8.3)
• Installing mypy-extensions (1.0.0)
• Installing nodeenv (1.7.0)
• Installing pastel (0.2.1)
• Installing prompt-toolkit (3.0.36)
• Installing ptyprocess (0.7.0)
• Installing pydantic-core (2.6.0)
• Installing pygments (2.16.1)
• Installing pytest (7.4.0)
• Installing regex (2022.10.31)
• Installing requests (2.31.0)
• Installing virtualenv (20.17.1)
• Installing decorator (5.1.1): Downloading... 100%
• Installing dunamai (1.18.0): Downloading... 16%
• Installing decorator (5.1.1): Installing...
• Installing dunamai (1.18.0): Downloading... 16%
• Installing funcy (2.0): Downloading... 26%
• Installing jinja2-ansible-filters (1.3.2): Downloading... 64%
• Installing decorator (5.1.1)
• Installing dunamai (1.18.0)
• Installing funcy (2.0)
• Installing jinja2-ansible-filters (1.3.2)
• Installing markdown-exec (1.6.0)
• Installing pytest-cov (4.1.0)
• Installing mypy (1.4.1)
• Installing pexpect (4.8.0)
• Installing plumbum (1.8.2)
• Installing poethepoet (0.22.0)
• Installing pre-commit (3.3.3)
• Installing pydantic (2.2.0)
• Installing mkdocs-material (9.1.21)
• Installing pytest-xdist (3.3.1)
• Installing pyyaml-include (1.3.1)
• Installing questionary (2.0.0)
• Installing types-backports (0.1.3)
• Installing types-decorator (5.1.8.4)
• Installing types-psutil (5.9.5.16)
• Installing types-pyyaml (6.0.12.11)
Installing the current project: copier (0.0.0)
direnv: export +C_INCLUDE_PATH +DEVENV_DOTFILE +DEVENV_PROFILE +DEVENV_ROOT +DEVENV_STATE +GIT_EXTERNAL_DIFF +IN_NIX_SHELL +LD_LIBRARY_PATH +LIBRARY_PATH +PKG_CONFIG_PATH +POETRY_ACTIVE +VIRTUAL_ENV +XDG_CONFIG_DIRS +XDG_DATA_DIRS +name ~PATH
gitpod /workspace/copier (master) $ HISTFILE=/workspace/.gitpod/cmd-0 history -r; {
> direnv allow
> }
direnv: loading /workspace/copier/.envrc
direnv: using flake . --impure --accept-flake-config
pre-commit-hooks.nix: hooks up to date
direnv: export +C_INCLUDE_PATH +DEVENV_DOTFILE +DEVENV_PROFILE +DEVENV_ROOT +DEVENV_STATE +GIT_EXTERNAL_DIFF +IN_NIX_SHELL +LD_LIBRARY_PATH +LIBRARY_PATH +PKG_CONFIG_PATH +POETRY_ACTIVE +VIRTUAL_ENV +XDG_CONFIG_DIRS +XDG_DATA_DIRS +name ~PATH
gitpod /workspace/copier (master) $ poe test
Poe => pytest --color=yes
=================================================================== test session starts ===================================================================
platform linux -- Python 3.10.12, pytest-7.4.0, pluggy-1.0.0
rootdir: /workspace/copier
configfile: pyproject.toml
plugins: cov-4.1.0, xdist-3.3.1
16 workers [716 items]
................................................................................................................................................... [ 20%]
...................................................................................................................F............................... [ 41%]
................................................................................................................................................... [ 61%]
.....................................................................................................s............................................. [ 82%]
..............................................................................F................................x.......x.....x.x [100%]
======================================================================== FAILURES =========================================================================
________________________________________________________________ test_answer_changes[True] ________________________________________________________________
[gw5] linux -- Python 3.10.12 /workspace/.pyenv_mirror/poetry/virtualenvs/copier-tqPO6HKK-py3.10/bin/python
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-gitpod/pytest-0/popen-gw5'), _trace=<pluggy._tracing.TagTrac...87e3310>, _basetemp=PosixPath('/tmp/pytest-of-gitpod/pytest-0/popen-gw5'), _retention_count=3, _retention_policy='all')
spawn = <function spawn.<locals>._spawn at 0x7feff84272e0>, interactive = True
@pytest.mark.parametrize("interactive", [False, True])
def test_answer_changes(
tmp_path_factory: TempPathFactory, spawn: Spawn, interactive: bool
) -> None:
src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
with local.cwd(src):
build_file_tree(
{
"{{ _copier_conf.answers_file }}.jinja": "{{ _copier_answers|to_nice_yaml }}",
"copier.yml": """
condition:
type: bool
""",
"{% if condition %}file.txt{% endif %}.jinja": "",
}
)
git("init")
git("add", ".")
git("commit", "-mv1")
git("tag", "v1")
if interactive:
tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10)
expect_prompt(tui, "condition", "bool")
tui.expect_exact("(y/N)")
tui.sendline("y")
tui.expect_exact("Yes")
tui.expect_exact(pexpect.EOF)
else:
copier.run_copy(str(src), dst, data={"condition": True})
assert (dst / "file.txt").exists()
with local.cwd(dst):
git("init")
git("add", ".")
git("commit", "-mv1")
if interactive:
tui = spawn(COPIER_PATH + ("update", str(dst)), timeout=10)
> expect_prompt(tui, "condition", "bool")
tests/test_conditional_file_name.py:105:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/helpers.py:131: in expect_prompt
tui.expect_exact(name)
../.pyenv_mirror/poetry/virtualenvs/copier-tqPO6HKK-py3.10/lib/python3.10/site-packages/pexpect/spawnbase.py:421: in expect_exact
return exp.expect_loop(timeout)
../.pyenv_mirror/poetry/virtualenvs/copier-tqPO6HKK-py3.10/lib/python3.10/site-packages/pexpect/expect.py:181: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x7feff85c7d00>
err = TIMEOUT("<pexpect.popen_spawn.PopenSpawn object at 0x7feff84b9c60>\nsearcher: searcher_string:\n 0: b'condition'")
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn._before.getvalue()
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
exc = TIMEOUT(msg)
exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
> raise exc
E pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x7feff84b9c60>
E searcher: searcher_string:
E 0: b'condition'
E <pexpect.popen_spawn.PopenSpawn object at 0x7feff84b9c60>
E searcher: searcher_string:
E 0: b'condition'
../.pyenv_mirror/poetry/virtualenvs/copier-tqPO6HKK-py3.10/lib/python3.10/site-packages/pexpect/expect.py:144: TIMEOUT
------------------------------------------------------------------ Captured stderr call -------------------------------------------------------------------
Warning: Input is not a terminal (fd=0).
🎤 condition (bool)
(y/N)
y
🎤 condition (bool)
Yes
Copying from template version 1
identical .
create .copier-answers.yml
create file.txt
Updating to template version 1
______________________________________________________________ test_update_choice[choices1] _______________________________________________________________
[gw2] linux -- Python 3.10.12 /workspace/.pyenv_mirror/poetry/virtualenvs/copier-tqPO6HKK-py3.10/bin/python
tmp_path_factory = TempPathFactory(_given_basetemp=PosixPath('/tmp/pytest-of-gitpod/pytest-0/popen-gw2'), _trace=<pluggy._tracing.TagTrac...1267340>, _basetemp=PosixPath('/tmp/pytest-of-gitpod/pytest-0/popen-gw2'), _retention_count=3, _retention_policy='all')
spawn = <function spawn.<locals>._spawn at 0x7fed50f07400>, choices = [['one', 1], ['two', 2], ['three', 3]]
@pytest.mark.parametrize(
"choices",
(
[1, 2, 3],
[["one", 1], ["two", 2], ["three", 3]],
{"one": 1, "two": 2, "three": 3},
),
)
def test_update_choice(
tmp_path_factory: pytest.TempPathFactory,
spawn: Spawn,
choices: Union[
List[int],
List[List[Union[str, int]]], # actually `List[Tuple[str, int]]`
Dict[str, int],
],
) -> None:
"""Choices are properly remembered and selected in TUI when updating."""
src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
# Create template
build_file_tree(
{
(src / "copier.yml"): (
f"""\
_templates_suffix: {SUFFIX_TMPL}
_envops: {BRACKET_ENVOPS_JSON}
pick_one:
type: float
default: 3
choices: {choices}
"""
),
(src / "[[ _copier_conf.answers_file ]].tmpl"): (
"[[ _copier_answers|to_nice_yaml ]]"
),
}
)
with local.cwd(src):
git("init")
git("add", ".")
git("commit", "-m one")
git("tag", "v1")
# Copy
tui = spawn(COPIER_PATH + ("copy", str(src), str(dst)), timeout=10)
expect_prompt(tui, "pick_one", "float")
tui.sendline(Keyboard.Up)
tui.expect_exact(pexpect.EOF)
answers = yaml.safe_load((dst / ".copier-answers.yml").read_text())
assert answers["pick_one"] == 2.0
with local.cwd(dst):
git("init")
git("add", ".")
git("commit", "-m1")
# Update
tui = spawn(
COPIER_PATH
+ (
"update",
str(dst),
),
timeout=10,
)
> expect_prompt(tui, "pick_one", "float")
tests/test_prompt.py:374:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/helpers.py:131: in expect_prompt
tui.expect_exact(name)
../.pyenv_mirror/poetry/virtualenvs/copier-tqPO6HKK-py3.10/lib/python3.10/site-packages/pexpect/spawnbase.py:421: in expect_exact
return exp.expect_loop(timeout)
../.pyenv_mirror/poetry/virtualenvs/copier-tqPO6HKK-py3.10/lib/python3.10/site-packages/pexpect/expect.py:181: in expect_loop
return self.timeout(e)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pexpect.expect.Expecter object at 0x7fed5109c880>
err = TIMEOUT("<pexpect.popen_spawn.PopenSpawn object at 0x7fed5109d540>\nsearcher: searcher_string:\n 0: b'pick_one'")
def timeout(self, err=None):
spawn = self.spawn
spawn.before = spawn._before.getvalue()
spawn.after = TIMEOUT
index = self.searcher.timeout_index
if index >= 0:
spawn.match = TIMEOUT
spawn.match_index = index
return index
else:
spawn.match = None
spawn.match_index = None
msg = str(spawn)
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
exc = TIMEOUT(msg)
exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
> raise exc
E pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x7fed5109d540>
E searcher: searcher_string:
E 0: b'pick_one'
E <pexpect.popen_spawn.PopenSpawn object at 0x7fed5109d540>
E searcher: searcher_string:
E 0: b'pick_one'
../.pyenv_mirror/poetry/virtualenvs/copier-tqPO6HKK-py3.10/lib/python3.10/site-packages/pexpect/expect.py:144: TIMEOUT
------------------------------------------------------------------ Captured stderr call -------------------------------------------------------------------
Warning: Input is not a terminal (fd=0).
🎤 pick_one (float)
(Use arrow keys)
one
two
» three
🎤 pick_one (float)
two
Copying from template version 1
identical .
create .copier-answers.yml
Updating to template version 1
==================================================================== warnings summary =====================================================================
tests/test_minimum_version.py::test_version_greater_than_required
tests/test_minimum_version.py::test_minimum_version_update
/workspace/copier/copier/template.py:134: OldTemplateWarning: This template was designed for Copier 10.5.1, but your version of Copier is 99.99.99. You could find some incompatibilities.
warn(
tests/test_minimum_version.py::test_minimum_version_update
/workspace/copier/copier/template.py:134: OldTemplateWarning: This template was designed for Copier 10.5.1, but your version of Copier is 11.0.0. You could find some incompatibilities.
warn(
tests/test_complex_questions.py: 6 warnings
tests/test_prompt.py: 318 warnings
tests/test_output.py: 6 warnings
tests/test_conditional_file_name.py: 2 warnings
tests/test_templated_prompt.py: 14 warnings
tests/test_updatediff.py: 2 warnings
/workspace/.pyenv_mirror/poetry/virtualenvs/copier-tqPO6HKK-py3.10/lib/python3.10/site-packages/pexpect/popen_spawn.py:60: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
self._read_thread.setDaemon(True)
tests/test_dirty_local.py::test_copy_dirty_head
/workspace/copier/copier/vcs.py:178: DirtyLocalWarning: Dirty template changes included automatically.
warn(
tests/test_templated_prompt.py::test_templated_prompt_builtins
/workspace/copier/copier/user_data.py:31: FutureWarning: 'now' will be removed in a future release of Copier.
Please use this instead: {{ '%Y-%m-%d %H:%M:%S' | strftime }}
strftime format reference https://strftime.org/
warnings.warn(
tests/test_templated_prompt.py::test_templated_prompt_builtins
/workspace/copier/copier/user_data.py:41: FutureWarning: 'make_secret' will be removed in a future release of Copier.
Please use this instead: {{ 999999999999999999999999999999999|ans_random|hash('sha512') }}
random and hash filters documentation: https://docs.ansible.com/ansible/2.3/playbooks_filters.html
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================= short test summary info =================================================================
SKIPPED [1] tests/test_prompt.py:381: TODO: fix this
XFAIL tests/test_updatediff.py::test_update_needs_more_context[True-1] - Not enough context lines to resolve the conflict.
XFAIL tests/test_updatediff.py::test_update_needs_more_context[True-2] - Not enough context lines to resolve the conflict.
XFAIL tests/test_updatediff.py::test_update_needs_more_context[False-2] - Not enough context lines to resolve the conflict.
XFAIL tests/test_updatediff.py::test_update_needs_more_context[False-1] - Not enough context lines to resolve the conflict.
FAILED tests/test_conditional_file_name.py::test_answer_changes[True] - pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x7feff84b9c60>
FAILED tests/test_prompt.py::test_update_choice[choices1] - pexpect.exceptions.TIMEOUT: <pexpect.popen_spawn.PopenSpawn object at 0x7fed5109d540>
====================================== 2 failed, 709 passed, 1 skipped, 4 xfailed, 354 warnings in 214.96s (0:03:34) ======================================
gitpod /workspace/copier (master) $
(base) genevieb@dyn-130-194-109-212 ~ % cd Documents/GitHub/copier
direnv: loading ~/Documents/GitHub/copier/.envrc
direnv: using flake . --impure --accept-flake-config
error: experimental Nix feature 'flakes' is disabled; use '--extra-experimental-features flakes' to override
direnv: export +POETRY_ACTIVE +VIRTUAL_ENV -DYLD_LIBRARY_PATH ~PATH
(base) genevieb@dyn-130-194-109-212 copier % poe test
Poe => pytest --color=yes
============================= test session starts ==============================
platform darwin -- Python 3.11.5, pytest-7.4.0, pluggy-1.0.0
rootdir: /Users/genevieb/Documents/GitHub/copier
configfile: pyproject.toml
plugins: cov-4.1.0, xdist-3.3.1
8 workers [716 items]
........................................................................ [ 10%]
........................................................................ [ 20%]
.............x.......................................................... [ 30%]
........................................................................ [ 40%]
.....x.................................................................. [ 50%]
........................................................................ [ 60%]
........................................................................ [ 70%]
........................................................................ [ 80%]
........................................................................ [ 90%]
..............s.................................x.x......xx......... [100%]
=============================== warnings summary ===============================
tests/test_complex_questions.py: 6 warnings
tests/test_prompt.py: 318 warnings
tests/test_output.py: 9 warnings
tests/test_conditional_file_name.py: 2 warnings
tests/test_templated_prompt.py: 14 warnings
tests/test_updatediff.py: 2 warnings
/Users/genevieb/Library/Caches/pypoetry/virtualenvs/copier-ca_NzRlD-py3.11/lib/python3.11/site-packages/pexpect/popen_spawn.py:60: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
self._read_thread.setDaemon(True)
tests/test_dirty_local.py::test_copy_dirty_head
/Users/genevieb/Documents/GitHub/copier/copier/vcs.py:178: DirtyLocalWarning: Dirty template changes included automatically.
warn(
tests/test_minimum_version.py::test_version_greater_than_required
tests/test_minimum_version.py::test_minimum_version_update
/Users/genevieb/Documents/GitHub/copier/copier/template.py:134: OldTemplateWarning: This template was designed for Copier 10.5.1, but your version of Copier is 99.99.99. You could find some incompatibilities.
warn(
tests/test_minimum_version.py::test_minimum_version_update
/Users/genevieb/Documents/GitHub/copier/copier/template.py:134: OldTemplateWarning: This template was designed for Copier 10.5.1, but your version of Copier is 11.0.0. You could find some incompatibilities.
warn(
tests/test_templated_prompt.py::test_templated_prompt_builtins
/Users/genevieb/Documents/GitHub/copier/copier/user_data.py:31: FutureWarning: 'now' will be removed in a future release of Copier.
Please use this instead: {{ '%Y-%m-%d %H:%M:%S' | strftime }}
strftime format reference https://strftime.org/
warnings.warn(
tests/test_templated_prompt.py::test_templated_prompt_builtins
/Users/genevieb/Documents/GitHub/copier/copier/user_data.py:41: FutureWarning: 'make_secret' will be removed in a future release of Copier.
Please use this instead: {{ 999999999999999999999999999999999|ans_random|hash('sha512') }}
random and hash filters documentation: https://docs.ansible.com/ansible/2.3/playbooks_filters.html
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
SKIPPED [1] tests/test_prompt.py:381: TODO: fix this
XFAIL tests/test_copy.py::test_exclude_file - Mac claims to use UTF-8 filesystem, but behaves differently.
XFAIL tests/test_exclude.py::test_path_filter - OS without proper UTF-8 filesystem.
XFAIL tests/test_updatediff.py::test_update_needs_more_context[True-1] - Not enough context lines to resolve the conflict.
XFAIL tests/test_updatediff.py::test_update_needs_more_context[True-2] - Not enough context lines to resolve the conflict.
XFAIL tests/test_updatediff.py::test_update_needs_more_context[False-1] - Not enough context lines to resolve the conflict.
XFAIL tests/test_updatediff.py::test_update_needs_more_context[False-2] - Not enough context lines to resolve the conflict.
===== 709 passed, 1 skipped, 6 xfailed, 357 warnings in 171.99s (0:02:51) ======
(base) genevieb@dyn-130-194-109-212 copier %
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment