poetry-plugin-export icon indicating copy to clipboard operation
poetry-plugin-export copied to clipboard

test_exporter_exports_extra_index_url_and_trusted_host fails

Open yurivict opened this issue 2 years ago • 1 comments

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― test_exporter_exports_extra_index_url_and_trusted_host ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

tmp_path = PosixPath('/tmp/pytest-of-yuri/pytest-1/test_exporter_exports_extra_in0'), poetry = <poetry.poetry.Poetry object at 0x954ed7c10>

    def test_exporter_exports_extra_index_url_and_trusted_host(
        tmp_path: Path, poetry: Poetry
    ) -> None:
        poetry.pool.add_repository(
            LegacyRepository(
                "custom",
                "http://example.com/simple",
            ),
            priority=Priority.EXPLICIT,
        )
        poetry.locker.mock_lock_data(  # type: ignore[attr-defined]
            {
                "package": [
                    {
                        "name": "foo",
                        "version": "1.2.3",
                        "optional": False,
                        "python-versions": "*",
                        "dependencies": {"bar": "*"},
                    },
                    {
                        "name": "bar",
                        "version": "4.5.6",
                        "optional": False,
                        "python-versions": "*",
                        "source": {
                            "type": "legacy",
                            "url": "http://example.com/simple",
                            "reference": "",
                        },
                    },
                ],
                "metadata": {
                    "python-versions": "*",
                    "content-hash": "123456789",
                    "files": {"foo": [], "bar": []},
                },
            }
        )
        set_package_requires(poetry)
    
        exporter = Exporter(poetry, NullIO())
        exporter.export("requirements.txt", tmp_path, "requirements.txt")
    
        with (tmp_path / "requirements.txt").open(encoding="utf-8") as f:
            content = f.read()
    
        expected = f"""\
    --trusted-host example.com
    --extra-index-url http://example.com/simple
    
    bar==4.5.6 ; {MARKER_PY}
    foo==1.2.3 ; {MARKER_PY}
    """
>       assert content == expected
E       assert '\nbar==4.5.6...ion < "4.0"\n' == '--trusted-ho...ion < "4.0"\n'
E         - --trusted-host example.com
E         - --extra-index-url http://example.com/simple
E           
E           bar==4.5.6 ; python_version >= "2.7" and python_version < "2.8" or python_version >= "3.6" and python_version < "4.0"
E           foo==1.2.3 ; python_version >= "2.7" and python_version < "2.8" or python_version >= "3.6" and python_version < "4.0"

tests/test_exporter.py:2722: AssertionError

Version: 1.4.0 Python-3.9 FreeBSD 13.2

yurivict avatar Jul 06 '23 00:07 yurivict

as this project's pipelines show: no, it doesn't.

you'll have to figure out for yourself what you're doing differenty

dimbleby avatar Jul 06 '23 07:07 dimbleby