python-poetry / python-poetry/poetry-plugin-export

test_exporter_exports_extra_index_url_and_trusted_host fails

Open
#218 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
335
Forks
57
Avg merge
1h 23m
Merged PRs (30d)
3

Description

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running tests/test_exporter.py::test_exporter_exports_extra_index_url_and_trusted_host and inspect the exporter entry point used by the test. Done means the generated requirements.txt includes the trusted-host and extra-index-url lines shown in the expected output, with the existing package requirements preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.