========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= test session starts ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
platform linux -- Python 3.10.12, pytest-9.0.3, pluggy-1.6.0 -- /usr/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.10.12', 'Platform': 'Linux-6.8.0-1025-gke-x86_64-with-glibc2.35', 'Packages': {'pytest': '9.0.3', 'pluggy': '1.6.0'}, 'Plugins': {'anyio': '4.13.0', 'mock': '3.15.1', 'metadata': '3.1.1', 'json-report': '1.5.0', 'cov': '7.1.0'}}
rootdir: /workspace/cookiecutter
configfile: setup.cfg
plugins: anyio-4.13.0, mock-3.15.1, metadata-3.1.1, json-report-1.5.0, cov-7.1.0
collected 37 items

tests/replay/test_replay.py::test_raise_on_invalid_mode[invalid_kwargs0] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [  2%]
tests/replay/test_replay.py::test_raise_on_invalid_mode[invalid_kwargs1] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [  5%]
tests/replay/test_replay.py::test_raise_on_invalid_mode[invalid_kwargs2] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [  8%]
tests/test_generate_file.py::test_generate_file PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           [ 10%]
tests/test_generate_file.py::test_generate_file_jsonify_filter PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [ 13%]
tests/test_generate_file.py::test_generate_file_random_ascii_string[True-10] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [ 16%]
tests/test_generate_file.py::test_generate_file_random_ascii_string[True-40] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              [ 18%]
tests/test_generate_file.py::test_generate_file_random_ascii_string[False-10] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             [ 21%]
tests/test_generate_file.py::test_generate_file_random_ascii_string[False-40] PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             [ 24%]
tests/test_generate_file.py::test_generate_file_with_true_condition PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       [ 27%]
tests/test_generate_file.py::test_generate_file_with_false_condition PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [ 29%]
tests/test_generate_file.py::test_generate_file_verbose_template_syntax_error FAILED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             [ 32%]
tests/test_generate_file.py::test_generate_file_does_not_translate_lf_newlines_to_crlf PASSED                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [ 35%]
tests/test_generate_file.py::test_generate_file_does_not_translate_crlf_newlines_to_lf PASSED                                                                                                                                                                                                                                                                                                                                                <response clipped><NOTE>Due to the max output limit, only part of the full response has been shown to you.</NOTE>sg = f"Unable to create directory '{directory}'"
>       assert msg == error.message
E       assert "Unable to create directory 'testproject/{{cookiecutter.foobar}}'" == "Unable to create directory '{{cookiecutter.project_slug}}/{{cookiecutter.foobar}}'"
E
E         - Unable to create directory '{{cookiecutter.project_slug}}/{{cookiecutter.foobar}}'
E         ?                             -----------  ^^       -------
E         + Unable to create directory 'testproject/{{cookiecutter.foobar}}'
E         ?                               ^^

tests/test_generate_files.py:413: AssertionError
__________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ test_echo_undefined_variable_error __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

output_dir = '/tmp/pytest-of-openhands/pytest-1/test_echo_undefined_variable_e0/output', cli_runner = <function cli_runner.<locals>.cli_main at 0x7f07cc5e48b0>

    def test_echo_undefined_variable_error(output_dir, cli_runner):
        """Cli invocation return error if variable undefined in template."""
        template_path = 'tests/undefined-variable/file-name/'

        result = cli_runner(
            '--no-input',
            '--default-config',
            '--output-dir',
            output_dir,
            template_path,
        )

        assert result.exit_code == 1

        error = "Unable to create file '{{cookiecutter.foobar}}'"
        assert error in result.output

        message = (
            "Error message: 'collections.OrderedDict object' has no attribute 'foobar'"
        )
        assert message in result.output

        context = {
            '_cookiecutter': {
                'github_username': 'hackebrot',
                'project_slug': 'testproject',
            },
            'cookiecutter': {
                'github_username': 'hackebrot',
                'project_slug': 'testproject',
                '_template': template_path,
                '_repo_dir': template_path,
                '_output_dir': output_dir,
                '_checkout': None,
            },
        }
        context_str = json.dumps(context, indent=4, sort_keys=True)
>       assert context_str in result.output
E       assert '{\n    "_cookiecutter": {\n        "github_username": "hackebrot",\n        "project_slug": "testproject"\n    },\n    "cookiecutter": {\n        "_checkout": null,\n        "_output_dir": "/tmp/pytest-of-openhands/pytest-1/test_echo_undefined_variable_e0/output",\n        "_repo_dir": "tests/undefined-variable/file-name/",\n        "_template": "tests/undefined-variable/file-name/",\n        "github_username": "hackebrot",\n        "project_slug": "testproject"\n    }\n}' in "Error: Unable to create file '{{cookiecutter.foobar}}'. Error message: 'collections.OrderedDict object' has no attribute 'foobar'. Context: {'cookiecutter': OrderedDict([('project_slug', 'testproject'), ('github_username', 'hackebrot'), ('_template', 'tests/undefined-variable/file-name/'), ('_repo_dir', 'tests/undefined-variable/file-name/'), ('_output_dir', '/tmp/pytest-of-openhands/pytest-1/test_echo_undefined_variable_e0/output'), ('_checkout', None)]), '_cookiecutter': OrderedDict([('project_slug', 'testproject'), ('github_username', 'hackebrot')])}\n"
E        +  where "Error: Unable to create file '{{cookiecutter.foobar}}'. Error message: 'collections.OrderedDict object' has no attribute 'foobar'. Context: {'cookiecutter': OrderedDict([('project_slug', 'testproject'), ('github_username', 'hackebrot'), ('_template', 'tests/undefined-variable/file-name/'), ('_repo_dir', 'tests/undefined-variable/file-name/'), ('_output_dir', '/tmp/pytest-of-openhands/pytest-1/test_echo_undefined_variable_e0/output'), ('_checkout', None)]), '_cookiecutter': OrderedDict([('project_slug', 'testproject'), ('github_username', 'hackebrot')])}\n" = <Result SystemExit(1)>.output

tests/test_cli.py:442: AssertionError
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DEBUG    cookiecutter.main:main.py:79 context_file is tests/undefined-variable/file-name/cookiecutter.json
============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================ tests coverage ============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ coverage: platform linux, python 3.10.12-final-0 ___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Name                          Stmts   Miss  Cover   Missing
-----------------------------------------------------------
cookiecutter/__init__.py          6      0   100%
cookiecutter/__main__.py          1      0   100%
cookiecutter/cli.py              71     14    80%   23-31, 44-46, 78-79, 88, 124
cookiecutter/config.py           48     10    79%   27, 35, 40-41, 44, 46, 74, 79-82
cookiecutter/environment.py      16      2    88%   26-27
cookiecutter/exceptions.py       23      0   100%
cookiecutter/extensions.py       65      2    97%   46, 58
cookiecutter/find.py             17      1    94%   23
cookiecutter/generate.py        186     71    62%   33-41, 46-68, 84-85, 91-94, 96, 123-124, 132, 136-138, 157, 164-165, 173-185, 197-202, 239, 267-280, 295-300
cookiecutter/hooks.py            75     10    87%   64, 128-136
cookiecutter/log.py              19      4    79%   18-21
cookiecutter/main.py             65     13    80%   75-76, 87-91, 105-109, 127-128
cookiecutter/prompt.py          160     88    45%   19-23, 32-37, 53-54, 61, 72-85, 93-101, 111, 120-123, 143, 145, 152, 161, 171-174, 183, 205-206, 216, 218, 237-255, 268-277, 280-284
cookiecutter/replay.py           28     12    57%   13, 21, 23, 25, 34-42
cookiecutter/repository.py       42     12    71%   31, 33, 71-81, 83-91, 102
cookiecutter/utils.py            47     10    79%   20-21, 37-38, 59-60, 72-75
cookiecutter/vcs.py              53     39    26%   22-37, 45, 58-100
cookiecutter/zipfile.py          48     24    50%   28-36, 46, 52-67, 69
-----------------------------------------------------------
TOTAL                           970    312    68%
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= short test summary info ========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
FAILED tests/test_generate_file.py::test_generate_file_verbose_template_syntax_error - assert None
 +  where None = <built-in method match of re.Pattern object at 0x64ef6d001230>('Missing end of comment tag')
 +    where <built-in method match of re.Pattern object at 0x64ef6d001230> = re.compile('Missing end of comment tag\n {2}File "(.[/\\\\])*tests[/\\\\]files[/\\\\]syntax_error.txt", line 1\n {4}I eat {{ syntax_error }} {# this comment is not closed}').match
 +    and   'Missing end of comment tag' = str(TemplateSyntaxError('Missing end of comment tag'))
 +      where TemplateSyntaxError('Missing end of comment tag') = <ExceptionInfo TemplateSyntaxError('Missing end of comment tag') tblen=8>.value
FAILED tests/test_generate_files.py::test_raise_undefined_variable_dir_name - assert "Unable to create directory 'testproject/{{cookiecutter.foobar}}'" == "Unable to create directory '{{cookiecutter.project_slug}}/{{cookiecutter.foobar}}'"

  - Unable to create directory '{{cookiecutter.project_slug}}/{{cookiecutter.foobar}}'
  ?                             -----------  ^^       -------
  + Unable to create directory 'testproject/{{cookiecutter.foobar}}'
  ?                               ^^
FAILED tests/test_generate_files.py::test_raise_undefined_variable_dir_name_existing_project - assert "Unable to create directory 'testproject/{{cookiecutter.foobar}}'" == "Unable to create directory '{{cookiecutter.project_slug}}/{{cookiecutter.foobar}}'"

  - Unable to create directory '{{cookiecutter.project_slug}}/{{cookiecutter.foobar}}'
  ?                             -----------  ^^       -------
  + Unable to create directory 'testproject/{{cookiecutter.foobar}}'
  ?                               ^^
FAILED tests/test_cli.py::test_echo_undefined_variable_error - assert '{\n    "_cookiecutter": {\n        "github_username": "hackebrot",\n        "project_slug": "testproject"\n    },\n    "cookiecutter": {\n        "_checkout": null,\n        "_output_dir": "/tmp/pytest-of-openhands/pytest-1/test_echo_undefined_variable_e0/output",\n        "_repo_dir": "tests/undefined-variable/file-name/",\n        "_template": "tests/undefined-variable/file-name/",\n        "github_username": "hackebrot",\n        "project_slug": "testproject"\n    }\n}' in "Error: Unable to create file '{{cookiecutter.foobar}}'. Error message: 'collections.OrderedDict object' has no attribute 'foobar'. Context: {'cookiecutter': OrderedDict([('project_slug', 'testproject'), ('github_username', 'hackebrot'), ('_template', 'tests/undefined-variable/file-name/'), ('_repo_dir', 'tests/undefined-variable/file-name/'), ('_output_dir', '/tmp/pytest-of-openhands/pytest-1/test_echo_undefined_variable_e0/output'), ('_checkout', None)]), '_cookiecutter': OrderedDict([('project_slug', 'testproject'), ('github_username', 'hackebrot')])}\n"
 +  where "Error: Unable to create file '{{cookiecutter.foobar}}'. Error message: 'collections.OrderedDict object' has no attribute 'foobar'. Context: {'cookiecutter': OrderedDict([('project_slug', 'testproject'), ('github_username', 'hackebrot'), ('_template', 'tests/undefined-variable/file-name/'), ('_repo_dir', 'tests/undefined-variable/file-name/'), ('_output_dir', '/tmp/pytest-of-openhands/pytest-1/test_echo_undefined_variable_e0/output'), ('_checkout', None)]), '_cookiecutter': OrderedDict([('project_slug', 'testproject'), ('github_username', 'hackebrot')])}\n" = <Result SystemExit(1)>.output
===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== 4 failed, 33 passed in 0.73s =====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
[The command completed with exit code 1.]
[Current working directory: /workspace/cookiecutter]
[Python interpreter: /usr/bin/python]
[Command finished with exit code 1]