==> Building on glalie ==> Checking for remote environment... ==> Syncing package to remote host... sending incremental file list created directory packages/python-poetry-plugin-export ./ .SRCINFO 710 100% 0.00kB/s 0:00:00 710 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=3/5) .nvchecker.toml 113 100% 110.35kB/s 0:00:00 113 100% 110.35kB/s 0:00:00 (xfr#2, to-chk=2/5) PKGBUILD 1,210 100% 1.15MB/s 0:00:00 1,210 100% 1.15MB/s 0:00:00 (xfr#3, to-chk=1/5) python-poetry-plugin-export-1.9.0-1.log 507 100% 495.12kB/s 0:00:00 507 100% 495.12kB/s 0:00:00 (xfr#4, to-chk=0/5) sent 1,628 bytes received 154 bytes 3,564.00 bytes/sec total size is 2,226 speedup is 1.25 ==> Running pkgctl build --arch riscv64 --repo extra on remote host... ==> WARNING: unsupported architecture: riscv64 ==> Building python-poetry-plugin-export  -> repo: extra  -> arch: riscv64  -> worker: felix-2 ==> Building python-poetry-plugin-export for [extra] (riscv64) ]2;🔵 Container arch-nspawn-991358 on glalie.felixc.at\[?25l:: Synchronizing package databases... core downloading... extra downloading... :: Starting full system upgrade... there is nothing to do [?25h==> Building in chroot for [extra] (riscv64)... ==> Synchronizing chroot copy [/var/lib/archbuild/extra-riscv64/root] -> [felix-2]...done ==> Making package: python-poetry-plugin-export 1.9.0-1 (Sun May 25 03:22:51 2025) ==> Retrieving sources...  -> Downloading python-poetry-plugin-export-1.9.0.tar.gz... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 77437 0 77437 0 0 47002 0 --:--:-- 0:00:01 --:--:-- 47002 ==> Validating source files with sha512sums... python-poetry-plugin-export-1.9.0.tar.gz ... Passed ]2;🔵 Container arch-nspawn-992530 on glalie.felixc.at\==> Making package: python-poetry-plugin-export 1.9.0-1 (Sun May 25 03:23:26 2025) ==> Checking runtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... looking for conflicting packages... warning: dependency cycle detected: warning: python-poetry-plugin-export will be installed before its python-poetry dependency Package (55) New Version Net Change Download Size core/mpdecimal 4.0.1-1 0.31 MiB core/python 3.13.3-1 108.92 MiB extra/python-attrs 24.1.0-1 0.56 MiB extra/python-build 1.2.2-3 0.20 MiB extra/python-cachecontrol 1:0.14.3-1 0.17 MiB 0.04 MiB extra/python-cachy 0.3.0-11 0.20 MiB 0.04 MiB extra/python-cffi 1.17.1-2 1.35 MiB extra/python-charset-normalizer 3.4.2-1 0.46 MiB extra/python-cleo 1:2.1.0-1 0.92 MiB 0.17 MiB extra/python-crashtest 0.4.1-4 0.05 MiB 0.01 MiB extra/python-cryptography 44.0.3-1 5.15 MiB extra/python-distlib 0.3.9-2 1.29 MiB extra/python-dulwich 0.22.8-1 4.31 MiB extra/python-fastjsonschema 2.21.1-1 0.27 MiB extra/python-filelock 3.18.0-1 0.13 MiB extra/python-findpython 0.6.3-1 0.19 MiB 0.04 MiB extra/python-html5lib 1.1-15 1.66 MiB extra/python-idna 3.10-2 0.88 MiB extra/python-installer 0.7.0-10 0.17 MiB extra/python-jaraco.classes 3.4.0-2 0.04 MiB extra/python-jaraco.context 6.0.1-1 0.04 MiB extra/python-jaraco.functools 4.1.0-1 0.07 MiB extra/python-jeepney 0.9.0-1 0.42 MiB extra/python-jsonschema 4.23.0-2 1.33 MiB extra/python-jsonschema-specifications 2024.10.1-1 0.05 MiB extra/python-keyring 25.6.0-1 0.34 MiB extra/python-lark-parser 1.2.2-3 1.24 MiB extra/python-lockfile 0.12.2-14 0.10 MiB 0.02 MiB extra/python-more-itertools 10.7.0-1 0.67 MiB extra/python-msgpack 1.0.5-3 0.31 MiB extra/python-packaging 25.0-1 0.67 MiB extra/python-pbs-installer 2025.03.17-1 0.76 MiB 0.07 MiB extra/python-pexpect 4.9.0-4 0.60 MiB extra/python-pkginfo 1.12.0-1 0.34 MiB 0.07 MiB extra/python-platformdirs 4.3.6-2 0.24 MiB extra/python-poetry-core 2.1.2-1 1.40 MiB extra/python-poetry-plugin-export 1.8.0-3 0.08 MiB 0.02 MiB extra/python-ptyprocess 0.7.0-8 0.12 MiB extra/python-pycparser 2.22-3 1.69 MiB extra/python-pyproject-hooks 1.2.0-3 0.10 MiB extra/python-rapidfuzz 3.12.2-1 5.03 MiB extra/python-referencing 0.35.1-3.1 0.38 MiB extra/python-requests 2.32.3-4.1 0.60 MiB extra/python-requests-toolbelt 1.0.0-3 0.43 MiB 0.08 MiB extra/python-rpds-py 0.22.3-1 0.65 MiB extra/python-secretstorage 3.3.3-6 0.11 MiB extra/python-shellingham 1.5.4-3 0.06 MiB extra/python-six 1.17.0-1 0.12 MiB extra/python-tomlkit 0.13.2-2 0.57 MiB extra/python-trove-classifiers 2025.5.9.12-1 0.13 MiB 0.02 MiB extra/python-typing_extensions 4.13.2-1 0.52 MiB extra/python-urllib3 2.4.0-1 1.26 MiB 0.23 MiB extra/python-virtualenv 20.28.0-1 5.19 MiB extra/python-webencodings 0.5.1-12 0.07 MiB extra/python-poetry 2.1.2-1 3.03 MiB 0.53 MiB Total Download Size: 1.33 MiB Total Installed Size: 155.94 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... python-poetry-2.1.2-1-any downloading... python-urllib3-2.4.0-1-any downloading... python-cleo-1:2.1.0-1-any downloading... python-requests-toolbelt-1.0.0-3-any downloading... python-pbs-installer-2025.03.17-1-any downloading... python-pkginfo-1.12.0-1-any downloading... python-findpython-0.6.3-1-any downloading... python-cachecontrol-1:0.14.3-1-any downloading... python-cachy-0.3.0-11-any downloading... python-poetry-plugin-export-1.8.0-3-any downloading... python-lockfile-0.12.2-14-any downloading... python-trove-classifiers-2025.5.9.12-1-any downloading... python-crashtest-0.4.1-4-any downloading... checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing mpdecimal... installing python... Optional dependencies for python python-setuptools: for building Python packages using tooling that is usually bundled with Python python-pip: for installing Python packages using tooling that is usually bundled with Python python-pipx: for installing Python software not packaged on Arch Linux sqlite: for a default database integration [installed] xz: for lzma [installed] tk: for tkinter installing python-packaging... installing python-pyproject-hooks... installing python-build... Optional dependencies for python-build python-pip: to use as the Python package installer (default) python-uv: to use as the Python package installer python-virtualenv: to use virtualenv for build isolation [pending] installing python-filelock... installing python-msgpack... installing python-charset-normalizer... installing python-idna... installing python-urllib3... Optional dependencies for python-urllib3 python-brotli: Brotli support python-brotlicffi: Brotli support python-h2: HTTP/2 support python-pysocks: SOCKS support python-zstandard: Zstandard support installing python-requests... Optional dependencies for python-requests python-chardet: alternative character encoding library python-pysocks: SOCKS proxy support installing python-cachecontrol... Optional dependencies for python-cachecontrol python-lockfile: for filecache [pending] python-redis: for redis cache installing python-cachy... installing python-crashtest... installing python-rapidfuzz... Optional dependencies for python-rapidfuzz python-numpy installing python-typing_extensions... installing python-cleo... installing python-dulwich... Optional dependencies for python-dulwich python-fastimport: for fast-import support python-gpgme: for PGP signature support python-idna: for HTTPS support via urllib3 [installed] python-paramiko: for use as the SSH implementation python-pyopenssl: for HTTPS support via urllib3 python-pyinotify: to watch for changes to refs installing python-fastjsonschema... installing python-findpython... installing python-six... installing python-webencodings... installing python-html5lib... Optional dependencies for python-html5lib python-lxml: lxml treebuilder python-genshi: genshi treewalker installing python-installer... installing python-attrs... installing python-rpds-py... installing python-referencing... installing python-jsonschema-specifications... installing python-jsonschema... Optional dependencies for python-jsonschema python-isoduration: for duration format python-fqdn: for hostname format python-idna: for idn-hostname format [installed] python-jsonpointer: for json-pointer & relative-json-pointer format python-rfc3339-validator: for date-time format python-rfc3987: for iri, iri-reference, uri & uri-reference format python-uri-template: for uri-template format python-webcolors: for color format installing python-more-itertools... installing python-jaraco.classes... installing python-jaraco.context... installing python-jaraco.functools... installing python-pycparser... installing python-cffi... Optional dependencies for python-cffi python-setuptools: "limited api" version checking in cffi.setuptools_ext installing python-cryptography... installing python-jeepney... Optional dependencies for python-jeepney python-trio: support D-Bus applications with Trio installing python-secretstorage... installing python-keyring... Optional dependencies for python-keyring libsecret: libsecret backend [installed] python-dbus: kwallet backend python-gobject: libsecret backend python-keyrings-alt: Alternative backends python-pluggy: devpi client installing python-lockfile... installing python-pbs-installer... Optional dependencies for python-pbs-installer python-httpx: for download support python-zstandard: for zstd installation support installing python-ptyprocess... installing python-pexpect... installing python-pkginfo... installing python-platformdirs... installing python-lark-parser... Optional dependencies for python-lark-parser python-atomicwrites: for atomic_cache python-regex: for regex support installing python-poetry-core... installing python-poetry-plugin-export... installing python-requests-toolbelt... installing python-shellingham... installing python-tomlkit... installing python-trove-classifiers... installing python-distlib... installing python-virtualenv... installing python-poetry... Optional dependencies for python-poetry python-pip: to use pip with virtual environments :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate... [?25h==> Checking buildtime dependencies... ==> Installing missing dependencies... [?25lresolving dependencies... looking for conflicting packages... Package (7) New Version Net Change extra/python-execnet 2.1.1-4 0.47 MiB extra/python-iniconfig 2.1.0-1 0.04 MiB extra/python-pluggy 1.6.0-1 0.20 MiB extra/python-pytest 1:8.3.5-1 3.93 MiB extra/python-pytest-mock 3.14.0-2 0.09 MiB extra/python-pytest-xdist 3.6.1-2 0.48 MiB extra/python-wheel 0.45.1-1 0.28 MiB Total Installed Size: 5.49 MiB :: Proceed with installation? [Y/n] checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing python-wheel... Optional dependencies for python-wheel python-keyring: for wheel.signatures [installed] python-xdg: for wheel.signatures python-setuptools: for legacy bdist_wheel subcommand installing python-iniconfig... installing python-pluggy... installing python-pytest... installing python-pytest-mock... installing python-execnet... installing python-pytest-xdist... :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate... [?25h==> Retrieving sources...  -> Found python-poetry-plugin-export-1.9.0.tar.gz ==> WARNING: Skipping all source file integrity checks. ==> Extracting sources...  -> Extracting python-poetry-plugin-export-1.9.0.tar.gz with bsdtar ==> Starting build()... * Getting build dependencies for wheel... * Building wheel... Successfully built poetry_plugin_export-1.9.0-py3-none-any.whl ==> Starting check()... ============================= test session starts ============================== platform linux -- Python 3.13.3, pytest-8.3.5, pluggy-1.6.0 rootdir: /build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0 configfile: pyproject.toml testpaths: tests plugins: mock-3.14.0, xdist-3.6.1 created: 128/128 workers 128 workers [141 items] ...................FF.FFFF.FFFFFFFFFF.FF.FFFFFFFFFFFFFFF.FFFFF.F.FFFFFFF [ 51%] FFFFFFFF.FFFFF.FFFFFFF..F.FFF.FFFFFFFFFFFFFFF..FFF.FFFF.FFFFFFFFF.FF. [100%] =================================== FAILURES =================================== _ test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes_disabled[1.1] _ [gw45] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw45/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes_disabled( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.with_hashes(False) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ bar==4.5.6 ; {MARKER_PY} foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:746: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ____ test_exporter_can_export_requirements_txt_with_standard_packages[2.1] _____ [gw27] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw27/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ bar==4.5.6 ; {MARKER_PY} foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:159: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_standard_packages_and_sorted_hashes[2.1] _ [gw49] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw49/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages_and_sorted_hashes( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [ {"name": "foo1.whl", "hash": "67890"}, {"name": "foo2.whl", "hash": "12345"}, ], "bar": [ {"name": "bar1.whl", "hash": "67890"}, {"name": "bar2.whl", "hash": "12345"}, ], }, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:12345 \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 \\ --hash=sha256:67890 """ > assert content == expected E assert 'bar==4.5.6 ;...ha256:67890\n' == 'bar==4.5.6 ;...ha256:67890\n' E E Skipping 45 identical trailing characters in diff, use -v to show E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:12345 \... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:698: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes[1.1] _ [gw44] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw44/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'bar==4.5.6 ;...ha256:12345\n' == 'bar==4.5.6 ;...ha256:12345\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890 E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \... E E ...Full output truncated (4 lines hidden), use '-vv' to show tests/test_exporter.py:641: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_standard_packages_and_markers[2.1] _ [gw33] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw33/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages_and_markers( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["markers"] = "python_version < '3.7'" lock_data["package"][2]["markers"] = "sys_platform == 'win32'" poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] markers = { "foo": "python_version < '3.7'", "bar": "extra =='foo'", "baz": "sys_platform == 'win32'", } set_package_requires(poetry, markers=markers) 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"""\ bar==4.5.6 ; {MARKER_PY} baz==7.8.9 ; {MARKER_PY_WIN32} foo==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_ONLY)} """ > assert content == expected E assert 'bar==4.5.6 ;...on == "3.6"\n' == 'bar==4.5.6 ;...on == "3.6"\n' E E Skipping 57 identical trailing characters in diff, use -v to show E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==7.8.9 ; (python_version >= "3.6" or python_version == "2.7") and sys_platform == "win32" and python_version < "4.0"... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:218: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_standard_packages_and_sorted_hashes[1.1] _ [gw41] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw41/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages_and_sorted_hashes( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [ {"name": "foo1.whl", "hash": "67890"}, {"name": "foo2.whl", "hash": "12345"}, ], "bar": [ {"name": "bar1.whl", "hash": "67890"}, {"name": "bar2.whl", "hash": "12345"}, ], }, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:12345 \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 \\ --hash=sha256:67890 """ > assert content == expected E assert 'bar==4.5.6 ;...ha256:67890\n' == 'bar==4.5.6 ;...ha256:67890\n' E E Skipping 45 identical trailing characters in diff, use -v to show E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:12345 \... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:698: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ______ test_exporter_can_export_requirements_txt_with_file_packages[2.1] _______ [gw80] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw80/test_exporter_can_export_requi0') poetry = fixture_root_uri = 'file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures' lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_file_packages( tmp_path: Path, poetry: Poetry, fixture_root_uri: str, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "file", "url": "distributions/demo-0.1.0.tar.gz", "reference": "", }, } ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ foo @ {fixture_root_uri}/distributions/demo-0.1.0.tar.gz ;\ {MARKER_PY} """ > assert content == expected E assert 'foo @ file:/...ion < "4.0"\n' == 'foo @ file:/...on == "2.7"\n' E E Skipping 133 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1573: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any[2.1-False-lines0] _ [gw38] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw38/test_exporter_can_export_requi0') poetry = , dev = False lines = ['a==1.2.3 ; python_version >= "3.6" and python_version < "3.8" or python_version == "2.7"'] lock_version = '2.1' @pytest.mark.parametrize( ["dev", "lines"], [ ( False, [f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38)}"], ), ( True, [ f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38).union(MARKER_PY36)}", f"b==4.5.6 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any( tmp_path: Path, poetry: Poetry, dev: bool, lines: list[str], lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "a", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "b", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": {"a": ">=1.2.3"}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"a": [], "b": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["main", "dev"] lock_data["package"][0]["markers"] = {"main": "python_version < '3.8'"} lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] root = poetry.package.with_dependency_groups([], only=True) root.add_dependency( Factory.create_dependency( name="a", constraint={"version": "^1.2.3", "python": "<3.8"} ) ) root.add_dependency( Factory.create_dependency( name="b", constraint={"version": "^4.5.6"}, groups=["dev"] ) ) poetry._package = root exporter = Exporter(poetry, NullIO()) if dev: exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() > assert content.strip() == "\n".join(lines) E assert 'a==1.2.3 ; p...rsion < "3.8"' == 'a==1.2.3 ; p...sion == "2.7"' E E - a==1.2.3 ; python_version >= "3.6" and python_version < "3.8" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^^ ^^ ^ ^ E + a==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "3.8" E ? + ^ ^ ^^ ^^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:592: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. __________ test_exporter_exports_requirements_txt_with_url_false[1.1] __________ [gw85] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw85/test_exporter_exports_requirem0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_url_false( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom", "https://example.com/simple", ) ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.with_urls(False) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'bar==4.5.6 ;...ha256:12345\n' == 'bar==4.5.6 ;...ha256:12345\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890 E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \... E E ...Full output truncated (4 lines hidden), use '-vv' to show tests/test_exporter.py:1747: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_nested_directory_packages[2.1] _ [gw73] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw73/test_exporter_can_export_requi0') poetry = fixture_root_uri = 'file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures' lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_directory_packages( tmp_path: Path, poetry: Poetry, fixture_root_uri: str, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project/../project_with_nested_local/bar", "reference": "", }, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project/../project_with_nested_local/bar/..", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ bar @ {fixture_root_uri}/project_with_nested_local/bar ; {MARKER_PY} baz @ {fixture_root_uri}/project_with_nested_local ; {MARKER_PY} foo @ {fixture_root_uri}/sample_project ; {MARKER_PY} """ > assert content == expected E assert 'bar @ file:/...ion < "4.0"\n' == 'bar @ file:/...on == "2.7"\n' E E Skipping 131 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz @ file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures/project_with_nested_local ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"... E E ...Full output truncated (7 lines hidden), use '-vv' to show tests/test_exporter.py:1485: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_circular_root_dependency[1.1] _ [gw59] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw59/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_circular_root_dependency( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": {poetry.package.pretty_name: {"version": "1.2.3"}}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'foo==1.2.3 ;...ion < "4.0"\n' == 'foo==1.2.3 ;...on == "2.7"\n' E E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1214: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_exports_requirements_txt_without_dev_packages_by_default[2.1] __ [gw46] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw46/test_exporter_exports_requirem0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_without_dev_packages_by_default( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) 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"""\ foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'foo==1.2.3 ;...ha256:12345\n' == 'foo==1.2.3 ;...ha256:12345\n' E E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:12345 tests/test_exporter.py:795: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _______ test_exporter_can_export_requirements_txt_with_git_packages[1.1] _______ [gw61] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw61/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_git_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "git", "url": "https://github.com/foo/foo.git", "reference": "123456", "resolved_reference": "abcdef", }, } ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ foo @ git+https://github.com/foo/foo.git@abcdef ; {MARKER_PY} """ > assert content == expected E assert 'foo @ git+ht...ion < "4.0"\n' == 'foo @ git+ht...on == "2.7"\n' E E Skipping 55 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1066: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_nested_directory_packages[1.1] _ [gw77] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw77/test_exporter_can_export_requi0') poetry = fixture_root_uri = 'file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures' lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_directory_packages( tmp_path: Path, poetry: Poetry, fixture_root_uri: str, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project/../project_with_nested_local/bar", "reference": "", }, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project/../project_with_nested_local/bar/..", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ bar @ {fixture_root_uri}/project_with_nested_local/bar ; {MARKER_PY} baz @ {fixture_root_uri}/project_with_nested_local ; {MARKER_PY} foo @ {fixture_root_uri}/sample_project ; {MARKER_PY} """ > assert content == expected E assert 'bar @ file:/...ion < "4.0"\n' == 'bar @ file:/...on == "2.7"\n' E E Skipping 131 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz @ file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures/project_with_nested_local ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"... E E ...Full output truncated (7 lines hidden), use '-vv' to show tests/test_exporter.py:1485: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ____ test_exporter_can_export_requirements_txt_with_directory_packages[2.1] ____ [gw66] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw66/test_exporter_can_export_requi0') poetry = fixture_root_uri = 'file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures' lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_directory_packages( tmp_path: Path, poetry: Poetry, fixture_root_uri: str, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project", "reference": "", }, } ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ foo @ {fixture_root_uri}/sample_project ; {MARKER_PY} """ > assert content == expected E assert 'foo @ file:/...ion < "4.0"\n' == 'foo @ file:/...on == "2.7"\n' E E Skipping 116 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1376: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes[2.1] _ [gw43] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw43/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'bar==4.5.6 ;...ha256:12345\n' == 'bar==4.5.6 ;...ha256:12345\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890 E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \... E E ...Full output truncated (4 lines hidden), use '-vv' to show tests/test_exporter.py:641: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any[1.1-True-lines1] _ [gw42] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw42/test_exporter_can_export_requi0') poetry = , dev = True lines = ['a==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'b==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '1.1' @pytest.mark.parametrize( ["dev", "lines"], [ ( False, [f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38)}"], ), ( True, [ f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38).union(MARKER_PY36)}", f"b==4.5.6 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any( tmp_path: Path, poetry: Poetry, dev: bool, lines: list[str], lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "a", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "b", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": {"a": ">=1.2.3"}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"a": [], "b": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["main", "dev"] lock_data["package"][0]["markers"] = {"main": "python_version < '3.8'"} lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] root = poetry.package.with_dependency_groups([], only=True) root.add_dependency( Factory.create_dependency( name="a", constraint={"version": "^1.2.3", "python": "<3.8"} ) ) root.add_dependency( Factory.create_dependency( name="b", constraint={"version": "^4.5.6"}, groups=["dev"] ) ) poetry._package = root exporter = Exporter(poetry, NullIO()) if dev: exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() > assert content.strip() == "\n".join(lines) E assert 'a==1.2.3 ; p...rsion < "4.0"' == 'a==1.2.3 ; p...sion == "2.7"' E E - a==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + a==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - b==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:592: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. __ test_exporter_exports_requirements_txt_with_dev_packages_if_opted_in[1.1] ___ [gw47] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw47/test_exporter_exports_requirem0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_dev_packages_if_opted_in( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'bar==4.5.6 ;...ha256:12345\n' == 'bar==4.5.6 ;...ha256:12345\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890 E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \... E E ...Full output truncated (4 lines hidden), use '-vv' to show tests/test_exporter.py:847: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ____ test_exporter_can_export_requirements_txt_with_directory_packages[1.1] ____ [gw64] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw64/test_exporter_can_export_requi0') poetry = fixture_root_uri = 'file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures' lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_directory_packages( tmp_path: Path, poetry: Poetry, fixture_root_uri: str, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project", "reference": "", }, } ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ foo @ {fixture_root_uri}/sample_project ; {MARKER_PY} """ > assert content == expected E assert 'foo @ file:/...ion < "4.0"\n' == 'foo @ file:/...on == "2.7"\n' E E Skipping 116 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1376: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_exports_requirements_txt_with_legacy_packages_trusted_host[1.1] _ [gw92] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw92/test_exporter_exports_requirem0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_legacy_packages_trusted_host( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom", "http://example.com/simple", ) ) lock_data: dict[str, Any] = { "package": [ { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "http://example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) 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} \\ --hash=sha256:67890 """ > assert content == expected E assert '--trusted-ho...ha256:67890\n' == '--trusted-ho...ha256:67890\n' E E Skipping 90 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890 tests/test_exporter.py:1803: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _______ test_exporter_exports_requirements_txt_with_legacy_packages[2.1] _______ [gw81] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw81/test_exporter_exports_requirem0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_legacy_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom", "https://example.com/simple", ) ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ --extra-index-url https://example.com/simple bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 64 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:1683: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes_disabled[2.1] _ [gw51] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw51/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes_disabled( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.with_hashes(False) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ bar==4.5.6 ; {MARKER_PY} foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:746: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _______ test_exporter_can_export_requirements_txt_with_git_packages[2.1] _______ [gw65] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw65/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_git_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "git", "url": "https://github.com/foo/foo.git", "reference": "123456", "resolved_reference": "abcdef", }, } ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ foo @ git+https://github.com/foo/foo.git@abcdef ; {MARKER_PY} """ > assert content == expected E assert 'foo @ git+ht...ion < "4.0"\n' == 'foo @ git+ht...on == "2.7"\n' E E Skipping 55 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1066: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_exports_requirements_txt_with_optional_packages[2.1-extras0-lines0] _ [gw55] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw55/test_exporter_exports_requirem0') poetry = , extras = ['feature-bar'] lines = ['bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'foo==1.2.3 ; python_ve...ython_version == "2.7"', 'spam==0.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '2.1' @pytest.mark.parametrize( ["extras", "lines"], [ ( ["feature-bar"], [ f"bar==4.5.6 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", f"spam==0.1.0 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_optional_packages( tmp_path: Path, poetry: Poetry, extras: Collection[NormalizedName], lines: list[str], lock_version: str, ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": True, "python-versions": "*", "dependencies": {"spam": ">=0.1"}, }, { "name": "spam", "version": "0.1.0", "optional": True, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], "spam": [{"name": "spam.whl", "hash": "abcde"}], }, }, "extras": {"feature_bar": ["bar"]}, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["markers"] = 'extra == "feature-bar"' lock_data["package"][2]["markers"] = 'extra == "feature-bar"' poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.with_hashes(False) exporter.with_extras(extras) exporter.export( "requirements.txt", tmp_path, "requirements.txt", ) with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = "\n".join(lines) > assert content.strip() == expected E assert 'bar==4.5.6 ;...rsion < "4.0"' == 'bar==4.5.6 ;...sion == "2.7"' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:1023: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _______ test_exporter_exports_requirements_txt_with_legacy_packages[1.1] _______ [gw82] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw82/test_exporter_exports_requirem0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_legacy_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom", "https://example.com/simple", ) ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ --extra-index-url https://example.com/simple bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 64 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:1683: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any[1.1-False-lines0] _ [gw39] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw39/test_exporter_can_export_requi0') poetry = , dev = False lines = ['a==1.2.3 ; python_version >= "3.6" and python_version < "3.8" or python_version == "2.7"'] lock_version = '1.1' @pytest.mark.parametrize( ["dev", "lines"], [ ( False, [f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38)}"], ), ( True, [ f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38).union(MARKER_PY36)}", f"b==4.5.6 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any( tmp_path: Path, poetry: Poetry, dev: bool, lines: list[str], lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "a", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "b", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": {"a": ">=1.2.3"}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"a": [], "b": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["main", "dev"] lock_data["package"][0]["markers"] = {"main": "python_version < '3.8'"} lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] root = poetry.package.with_dependency_groups([], only=True) root.add_dependency( Factory.create_dependency( name="a", constraint={"version": "^1.2.3", "python": "<3.8"} ) ) root.add_dependency( Factory.create_dependency( name="b", constraint={"version": "^4.5.6"}, groups=["dev"] ) ) poetry._package = root exporter = Exporter(poetry, NullIO()) if dev: exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() > assert content.strip() == "\n".join(lines) E assert 'a==1.2.3 ; p...rsion < "3.8"' == 'a==1.2.3 ; p...sion == "2.7"' E E - a==1.2.3 ; python_version >= "3.6" and python_version < "3.8" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^^ ^^ ^ ^ E + a==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "3.8" E ? + ^ ^ ^^ ^^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:592: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ____ test_exporter_exports_requirements_txt_without_optional_packages[1.1] _____ [gw53] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw53/test_exporter_exports_requirem0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_without_optional_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": True, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] lock_data["package"][1]["markers"] = 'extra == "feature-bar"' poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'foo==1.2.3 ;...ha256:12345\n' == 'foo==1.2.3 ;...ha256:12345\n' E E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:12345 tests/test_exporter.py:943: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[1.1-priorities3-expected3] ______________ [gw127] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw127/test_exporter_index_urls_1_1_p0') poetry = priorities = [('custom-b', ), ('custom-a', )] expected = ('a', 'b'), lock_version = '1.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 107 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ________ test_exporter_exports_requirements_txt_to_standard_output[2.1] ________ [gw102] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw102/test_exporter_exports_requirem0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_to_standard_output( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) io = BufferedIO() exporter.export("requirements.txt", tmp_path, io) expected = f"""\ bar==4.5.6 ; {MARKER_PY} foo==1.2.3 ; {MARKER_PY} """ > assert io.fetch_output() == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:2195: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_exports_requirements_txt_with_legacy_packages_and_credentials[2.1] _ [gw93] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw93/test_exporter_exports_requirem0') poetry = config = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_legacy_packages_and_credentials( tmp_path: Path, poetry: Poetry, config: Config, lock_version: str ) -> None: poetry.config.merge( { "repositories": {"custom": {"url": "https://example.com/simple"}}, "http-basic": {"custom": {"username": "foo", "password": "bar"}}, } ) poetry.pool.add_repository( LegacyRepository("custom", "https://example.com/simple", config=poetry.config) ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.with_credentials() exporter.export( "requirements.txt", tmp_path, "requirements.txt", ) with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ --extra-index-url https://foo:bar@example.com/simple bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 72 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:2153: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. __ test_exporter_can_export_requirements_txt_with_nested_packages_cyclic[1.1] __ [gw58] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw58/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages_cyclic( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": {"bar": {"version": "4.5.6"}}, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": {"baz": {"version": "7.8.9"}}, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", "dependencies": {"foo": {"version": "1.2.3"}}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, skip={"bar", "baz"}) 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"""\ bar==4.5.6 ; {MARKER_PY} baz==7.8.9 ; {MARKER_PY} foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==7.8.9 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:1176: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ____ test_exporter_exports_requirements_txt_without_optional_packages[2.1] _____ [gw63] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw63/test_exporter_exports_requirem0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_without_optional_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": True, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] lock_data["package"][1]["markers"] = 'extra == "feature-bar"' poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'foo==1.2.3 ;...ha256:12345\n' == 'foo==1.2.3 ;...ha256:12345\n' E E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:12345 tests/test_exporter.py:943: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[1.1-priorities0-expected0] ______________ [gw125] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw125/test_exporter_index_urls_1_1_p0') poetry = priorities = [('custom-a', ), ('custom-b', )] expected = ('a', 'b'), lock_version = '1.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 107 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____ test_exporter_exports_requirements_txt_with_two_primary_sources[1.1] _____ [gw98] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw98/test_exporter_exports_requirem0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_two_primary_sources( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.remove_repository("PyPI") poetry.config.merge( { "repositories": { "custom-a": {"url": "https://a.example.com/simple"}, "custom-b": {"url": "https://b.example.com/simple"}, }, "http-basic": { "custom-a": {"username": "foo", "password": "bar"}, "custom-b": {"username": "baz", "password": "qux"}, }, } ) poetry.pool.add_repository( LegacyRepository( "custom-b", "https://b.example.com/simple", config=poetry.config, ), ) poetry.pool.add_repository( LegacyRepository( "custom-a", "https://a.example.com/simple", config=poetry.config, ), ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], "baz": [{"name": "baz.whl", "hash": "24680"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] lock_data["package"][2]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar", "baz"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.with_credentials() exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ --index-url https://baz:qux@b.example.com/simple --extra-index-url https://foo:bar@a.example.com/simple bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 baz==7.8.9 ; {MARKER_PY} \\ --hash=sha256:24680 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 123 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (10 lines hidden), use '-vv' to show tests/test_exporter.py:2080: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. __________ test_exporter_exports_requirements_txt_with_url_false[2.1] __________ [gw87] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw87/test_exporter_exports_requirem0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_url_false( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom", "https://example.com/simple", ) ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.with_urls(False) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'bar==4.5.6 ;...ha256:12345\n' == 'bar==4.5.6 ;...ha256:12345\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890 E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \... E E ...Full output truncated (4 lines hidden), use '-vv' to show tests/test_exporter.py:1747: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_omits_and_includes_extras_for_txt_formats[2.1-requirements.txt-expected1] _ [gw115] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw115/test_exporter_omits_and_includ0') poetry = , fmt = 'requirements.txt' expected = ['bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'baz==7.8.9 ; python_ve...python_version == "2.7"', 'foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '2.1' @pytest.mark.parametrize( ["fmt", "expected"], [ ( "constraints.txt", [ f"bar==4.5.6 ; {MARKER_PY}", f"baz==7.8.9 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", ], ), ( "requirements.txt", [ f"bar==4.5.6 ; {MARKER_PY}", f"bar[baz]==4.5.6 ; {MARKER_PY}", f"baz==7.8.9 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_omits_and_includes_extras_for_txt_formats( tmp_path: Path, poetry: Poetry, fmt: str, expected: list[str], lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": { "bar": { "extras": ["baz"], "version": ">=0.1.0", } }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": { "baz": { "version": ">=0.1.0", "optional": True, "markers": "extra == 'baz'", } }, "extras": {"baz": ["baz (>=0.1.0)"]}, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.export(fmt, tmp_path, "exported.txt") with (tmp_path / "exported.txt").open(encoding="utf-8") as f: content = f.read() # It does not matter whether packages are exported with extras or not # because all dependencies are listed explicitly. if lock_version == "2.1": expected = [req for req in expected if not req.startswith("bar[baz]")] > assert content == "\n".join(expected) + "\n" E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==7.8.9 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:2703: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[1.1-priorities1-expected1] ______________ [gw124] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw124/test_exporter_index_urls_1_1_p0') poetry = priorities = [('custom-b', ), ('custom-a', )] expected = ('b', 'a'), lock_version = '1.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 107 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ____________ test_exporter_can_export_requirements_txt_poetry[2.1] _____________ [gw35] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw35/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_poetry( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: """Regression test for #3254""" lock_data: dict[str, Any] = { "package": [ { "name": "poetry", "version": "1.1.4", "optional": False, "python-versions": "*", "dependencies": {"keyring": "*"}, }, { "name": "junit-xml", "version": "1.9", "optional": False, "python-versions": "*", "dependencies": {"six": "*"}, }, { "name": "keyring", "version": "21.8.0", "optional": False, "python-versions": "*", "dependencies": { "SecretStorage": { "version": "*", "markers": "sys_platform == 'linux'", } }, }, { "name": "secretstorage", "version": "3.3.0", "optional": False, "python-versions": "*", "dependencies": {"cryptography": "*"}, }, { "name": "cryptography", "version": "3.2", "optional": False, "python-versions": "*", "dependencies": {"six": "*"}, }, { "name": "six", "version": "1.15.0", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "poetry": [], "keyring": [], "secretstorage": [], "cryptography": [], "six": [], "junit-xml": [], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][3]["markers"] = "sys_platform == 'linux'" lock_data["package"][4]["markers"] = "sys_platform == 'linux'" poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires( poetry, skip={"keyring", "secretstorage", "cryptography", "six"} ) 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() # The dependency graph: # junit-xml 1.9 Creates JUnit XML test result documents that can be read by tools # └── six * such as Jenkins # poetry 1.1.4 Python dependency management and packaging made easy. # ├── keyring >=21.2.0,<22.0.0 # │ ├── importlib-metadata >=1 # │ │ └── zipp >=0.5 # │ ├── jeepney >=0.4.2 # │ ├── pywin32-ctypes <0.1.0 || >0.1.0,<0.1.1 || >0.1.1 # │ └── secretstorage >=3.2 -- On linux only # │ ├── cryptography >=2.0 # │ │ └── six >=1.4.1 # │ └── jeepney >=0.6 (circular dependency aborted here) expected = { "poetry": Dependency.create_from_pep_508(f"poetry==1.1.4; {MARKER_PY}"), "junit-xml": Dependency.create_from_pep_508(f"junit-xml==1.9 ; {MARKER_PY}"), "keyring": Dependency.create_from_pep_508(f"keyring==21.8.0 ; {MARKER_PY}"), "secretstorage": Dependency.create_from_pep_508( f"secretstorage==3.3.0 ; {MARKER_PY_LINUX}" ), "cryptography": Dependency.create_from_pep_508( f"cryptography==3.2 ; {MARKER_PY_LINUX}" ), "six": Dependency.create_from_pep_508( f"six==1.15.0 ; {MARKER_PY.union(MARKER_PY_LINUX)}" ), } for line in content.strip().split("\n"): dependency = Dependency.create_from_pep_508(line) assert dependency.name in expected expected_dependency = expected.pop(dependency.name) assert dependency == expected_dependency > assert dependency.marker == expected_dependency.marker E assert = "3.6") and python_version < "4.0" and sys_platform == "linux"> == = "3.6" or python_version == "2.7") and sys_platform == "linux" and python_version < "4.0"> E + where = "3.6") and python_version < "4.0" and sys_platform == "linux"> = .marker E + and = "3.6" or python_version == "2.7") and sys_platform == "linux" and python_version < "4.0"> = .marker tests/test_exporter.py:338: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____ test_exporter_can_export_requirements_txt_with_nested_packages[2.1] ______ [gw57] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw57/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "git", "url": "https://github.com/foo/foo.git", "reference": "123456", "resolved_reference": "abcdef", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": { "foo": { "git": "https://github.com/foo/foo.git", "rev": "123456", } }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, skip={"foo"}) 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"""\ bar==4.5.6 ; {MARKER_PY} foo @ git+https://github.com/foo/foo.git@abcdef ; {MARKER_PY} """ > assert content == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo @ git+https://github.com/foo/foo.git@abcdef ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:1122: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_directory_packages_editable[1.1] _ [gw71] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw71/test_exporter_can_export_requi0') poetry = fixture_root_uri = 'file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures' lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_directory_packages_editable( tmp_path: Path, poetry: Poetry, fixture_root_uri: str, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "develop": True, "source": { "type": "directory", "url": "sample_project", "reference": "", }, } ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ -e {fixture_root_uri}/sample_project ; {MARKER_PY} """ > assert content == expected E assert '-e file:///b...ion < "4.0"\n' == '-e file:///b...on == "2.7"\n' E E Skipping 113 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1419: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_exports_requirements_txt_without_dev_packages_by_default[1.1] __ [gw48] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw48/test_exporter_exports_requirem0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_without_dev_packages_by_default( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) 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"""\ foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'foo==1.2.3 ;...ha256:12345\n' == 'foo==1.2.3 ;...ha256:12345\n' E E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:12345 tests/test_exporter.py:795: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_standard_packages_and_markers[1.1] _ [gw28] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw28/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages_and_markers( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["markers"] = "python_version < '3.7'" lock_data["package"][2]["markers"] = "sys_platform == 'win32'" poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] markers = { "foo": "python_version < '3.7'", "bar": "extra =='foo'", "baz": "sys_platform == 'win32'", } set_package_requires(poetry, markers=markers) 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"""\ bar==4.5.6 ; {MARKER_PY} baz==7.8.9 ; {MARKER_PY_WIN32} foo==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_ONLY)} """ > assert content == expected E assert 'bar==4.5.6 ;...on == "3.6"\n' == 'bar==4.5.6 ;...on == "3.6"\n' E E Skipping 57 identical trailing characters in diff, use -v to show E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==7.8.9 ; (python_version >= "3.6" or python_version == "2.7") and sys_platform == "win32" and python_version < "4.0"... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:218: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. __ test_exporter_exports_requirements_txt_with_dev_extras[2.1-True-expected0] __ [gw89] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw89/test_exporter_exports_requirem0') poetry = , dev = True expected = ['bar==1.2.2 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'baz==1.2.3 ; python_ve...python_version == "2.7"', 'foo==1.2.1 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '2.1' @pytest.mark.parametrize( ["dev", "expected"], [ ( True, [ f"bar==1.2.2 ; {MARKER_PY}", f"baz==1.2.3 ; {MARKER_PY}", f"foo==1.2.1 ; {MARKER_PY}", ], ), ( False, [ f"bar==1.2.2 ; {MARKER_PY}", f"foo==1.2.1 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_dev_extras( tmp_path: Path, poetry: Poetry, dev: bool, expected: list[str], lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.1", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "1.2.2", "optional": False, "python-versions": "*", "dependencies": { "baz": { "version": ">=0.1.0", "optional": True, "markers": "extra == 'baz'", } }, "extras": {"baz": ["baz (>=0.1.0)"]}, }, { "name": "baz", "version": "1.2.3", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][2]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"baz"}) exporter = Exporter(poetry, NullIO()) if dev: exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() > assert content == "\n".join(expected) + "\n" E assert 'bar==1.2.2 ;...ion < "4.0"\n' == 'bar==1.2.2 ;...on == "2.7"\n' E E - bar==1.2.2 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==1.2.2 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:1880: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ____ test_exporter_can_export_requirements_txt_with_standard_packages[1.1] _____ [gw25] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw25/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_standard_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ bar==4.5.6 ; {MARKER_PY} foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:159: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ______ test_exporter_can_export_requirements_txt_with_file_packages[1.1] _______ [gw79] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw79/test_exporter_can_export_requi0') poetry = fixture_root_uri = 'file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures' lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_file_packages( tmp_path: Path, poetry: Poetry, fixture_root_uri: str, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "file", "url": "distributions/demo-0.1.0.tar.gz", "reference": "", }, } ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ foo @ {fixture_root_uri}/distributions/demo-0.1.0.tar.gz ;\ {MARKER_PY} """ > assert content == expected E assert 'foo @ file:/...ion < "4.0"\n' == 'foo @ file:/...on == "2.7"\n' E E Skipping 133 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1573: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_export_uses_requirements_txt_format_by_default ______________ [gw10] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None def test_export_uses_requirements_txt_format_by_default( tester: CommandTester, do_lock: None ) -> None: tester.execute() expected = f"""\ foo==1.0.0 ; {MARKER_PY} """ > assert tester.io.fetch_output() == expected E assert 'foo==1.0.0 ;...ion < "4.0"\n' == 'foo==1.0.0 ;...on == "2.7"\n' E E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/command/test_command_export.py:167: AssertionError _ test_exporter_exports_requirements_txt_with_legacy_packages_and_duplicate_sources[2.1] _ [gw100] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw100/test_exporter_exports_requirem0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_legacy_packages_and_duplicate_sources( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom-example", "https://example.com/simple", ) ) poetry.pool.add_repository( LegacyRepository( "custom-foobaz", "https://foobaz.com/simple", ) ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://foobaz.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], "baz": [{"name": "baz.whl", "hash": "24680"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] lock_data["package"][2]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar", "baz"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ --extra-index-url https://example.com/simple --extra-index-url https://foobaz.com/simple bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 baz==7.8.9 ; {MARKER_PY} \\ --hash=sha256:24680 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 108 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (10 lines hidden), use '-vv' to show tests/test_exporter.py:1972: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_exports_requirements_txt_with_legacy_packages_and_duplicate_sources[1.1] _ [gw90] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw90/test_exporter_exports_requirem0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_legacy_packages_and_duplicate_sources( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom-example", "https://example.com/simple", ) ) poetry.pool.add_repository( LegacyRepository( "custom-foobaz", "https://foobaz.com/simple", ) ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://foobaz.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], "baz": [{"name": "baz.whl", "hash": "24680"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] lock_data["package"][2]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar", "baz"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ --extra-index-url https://example.com/simple --extra-index-url https://foobaz.com/simple bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 baz==7.8.9 ; {MARKER_PY} \\ --hash=sha256:24680 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 108 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (10 lines hidden), use '-vv' to show tests/test_exporter.py:1972: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_exports_requirements_txt_with_dev_extras[1.1-False-expected1] __ [gw84] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw84/test_exporter_exports_requirem0') poetry = , dev = False expected = ['bar==1.2.2 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'foo==1.2.1 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '1.1' @pytest.mark.parametrize( ["dev", "expected"], [ ( True, [ f"bar==1.2.2 ; {MARKER_PY}", f"baz==1.2.3 ; {MARKER_PY}", f"foo==1.2.1 ; {MARKER_PY}", ], ), ( False, [ f"bar==1.2.2 ; {MARKER_PY}", f"foo==1.2.1 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_dev_extras( tmp_path: Path, poetry: Poetry, dev: bool, expected: list[str], lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.1", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "1.2.2", "optional": False, "python-versions": "*", "dependencies": { "baz": { "version": ">=0.1.0", "optional": True, "markers": "extra == 'baz'", } }, "extras": {"baz": ["baz (>=0.1.0)"]}, }, { "name": "baz", "version": "1.2.3", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][2]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"baz"}) exporter = Exporter(poetry, NullIO()) if dev: exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() > assert content == "\n".join(expected) + "\n" E assert 'bar==1.2.2 ;...ion < "4.0"\n' == 'bar==1.2.2 ;...on == "2.7"\n' E E - bar==1.2.2 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==1.2.2 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.1 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:1880: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any[2.1-True-lines1] _ [gw37] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw37/test_exporter_can_export_requi0') poetry = , dev = True lines = ['a==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'b==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '2.1' @pytest.mark.parametrize( ["dev", "lines"], [ ( False, [f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38)}"], ), ( True, [ f"a==1.2.3 ; {MARKER_PY27.union(MARKER_PY36_38).union(MARKER_PY36)}", f"b==4.5.6 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any( tmp_path: Path, poetry: Poetry, dev: bool, lines: list[str], lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "a", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "b", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": {"a": ">=1.2.3"}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"a": [], "b": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["main", "dev"] lock_data["package"][0]["markers"] = {"main": "python_version < '3.8'"} lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] root = poetry.package.with_dependency_groups([], only=True) root.add_dependency( Factory.create_dependency( name="a", constraint={"version": "^1.2.3", "python": "<3.8"} ) ) root.add_dependency( Factory.create_dependency( name="b", constraint={"version": "^4.5.6"}, groups=["dev"] ) ) poetry._package = root exporter = Exporter(poetry, NullIO()) if dev: exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() > assert content.strip() == "\n".join(lines) E assert 'a==1.2.3 ; p...rsion < "4.0"' == 'a==1.2.3 ; p...sion == "2.7"' E E - a==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + a==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - b==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:592: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_directory_packages_editable[2.1] _ [gw74] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw74/test_exporter_can_export_requi0') poetry = fixture_root_uri = 'file:///build/python-poetry-plugin-export/src/poetry-plugin-export-1.9.0/tests/fixtures' lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_directory_packages_editable( tmp_path: Path, poetry: Poetry, fixture_root_uri: str, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "develop": True, "source": { "type": "directory", "url": "sample_project", "reference": "", }, } ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ -e {fixture_root_uri}/sample_project ; {MARKER_PY} """ > assert content == expected E assert '-e file:///b...ion < "4.0"\n' == '-e file:///b...on == "2.7"\n' E E Skipping 113 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1419: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_export_groups[--with dev,opt-baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nopt==2.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw9] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, options = '--with dev,opt' expected = 'baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_versi... python_version == "2.7"\nopt==2.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "options, expected", [ ("", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--with dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n"), ("--with opt", f"foo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ; {MARKER_PY}\n"), ( "--with dev,opt", ( f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ;" f" {MARKER_PY}\n" ), ), (f"--without {MAIN_GROUP}", "\n"), ("--without dev", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--without opt", f"foo==1.0.0 ; {MARKER_PY}\n"), (f"--without {MAIN_GROUP},dev,opt", "\n"), (f"--only {MAIN_GROUP}", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--only dev", f"baz==2.0.0 ; {MARKER_PY}\n"), ( f"--only {MAIN_GROUP},dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n", ), ], ) def test_export_groups( tester: CommandTester, do_lock: None, options: str, expected: str ) -> None: tester.execute(options) > assert tester.io.fetch_output() == expected E assert 'baz==2.0.0 ;...ion < "4.0"\n' == 'baz==2.0.0 ;...on == "2.7"\n' E E - baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + baz==2.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/command/test_command_export.py:199: AssertionError _ test_exporter_exports_requirements_txt_with_legacy_packages_and_credentials[1.1] _ [gw101] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw101/test_exporter_exports_requirem0') poetry = config = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_legacy_packages_and_credentials( tmp_path: Path, poetry: Poetry, config: Config, lock_version: str ) -> None: poetry.config.merge( { "repositories": {"custom": {"url": "https://example.com/simple"}}, "http-basic": {"custom": {"username": "foo", "password": "bar"}}, } ) poetry.pool.add_repository( LegacyRepository("custom", "https://example.com/simple", config=poetry.config) ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.with_credentials() exporter.export( "requirements.txt", tmp_path, "requirements.txt", ) with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ --extra-index-url https://foo:bar@example.com/simple bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 72 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:2153: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____ test_exporter_can_export_requirements_txt_with_nested_packages[1.1] ______ [gw62] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw62/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "git", "url": "https://github.com/foo/foo.git", "reference": "123456", "resolved_reference": "abcdef", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": { "foo": { "git": "https://github.com/foo/foo.git", "rev": "123456", } }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, skip={"foo"}) 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"""\ bar==4.5.6 ; {MARKER_PY} foo @ git+https://github.com/foo/foo.git@abcdef ; {MARKER_PY} """ > assert content == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo @ git+https://github.com/foo/foo.git@abcdef ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:1122: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____ test_exporter_exports_requirements_txt_with_two_primary_sources[2.1] _____ [gw96] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw96/test_exporter_exports_requirem0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_two_primary_sources( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.remove_repository("PyPI") poetry.config.merge( { "repositories": { "custom-a": {"url": "https://a.example.com/simple"}, "custom-b": {"url": "https://b.example.com/simple"}, }, "http-basic": { "custom-a": {"username": "foo", "password": "bar"}, "custom-b": {"username": "baz", "password": "qux"}, }, } ) poetry.pool.add_repository( LegacyRepository( "custom-b", "https://b.example.com/simple", config=poetry.config, ), ) poetry.pool.add_repository( LegacyRepository( "custom-a", "https://a.example.com/simple", config=poetry.config, ), ) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], "baz": [{"name": "baz.whl", "hash": "24680"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] lock_data["package"][2]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar", "baz"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.with_credentials() exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ --index-url https://baz:qux@b.example.com/simple --extra-index-url https://foo:bar@a.example.com/simple bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 baz==7.8.9 ; {MARKER_PY} \\ --hash=sha256:24680 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 123 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (10 lines hidden), use '-vv' to show tests/test_exporter.py:2080: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. __ test_exporter_exports_requirements_txt_with_dev_packages_if_opted_in[2.1] ___ [gw54] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw54/test_exporter_exports_requirem0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_dev_packages_if_opted_in( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = f"""\ bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected E assert 'bar==4.5.6 ;...ha256:12345\n' == 'bar==4.5.6 ;...ha256:12345\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890 E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \... E E ...Full output truncated (4 lines hidden), use '-vv' to show tests/test_exporter.py:847: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_circular_root_dependency[2.1] _ [gw68] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw68/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_circular_root_dependency( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": {poetry.package.pretty_name: {"version": "1.2.3"}}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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"""\ foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'foo==1.2.3 ;...ion < "4.0"\n' == 'foo==1.2.3 ;...on == "2.7"\n' E E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.2.3 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:1214: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_export_groups[--only main,dev-baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw11] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, options = '--only main,dev' expected = 'baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "options, expected", [ ("", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--with dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n"), ("--with opt", f"foo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ; {MARKER_PY}\n"), ( "--with dev,opt", ( f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ;" f" {MARKER_PY}\n" ), ), (f"--without {MAIN_GROUP}", "\n"), ("--without dev", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--without opt", f"foo==1.0.0 ; {MARKER_PY}\n"), (f"--without {MAIN_GROUP},dev,opt", "\n"), (f"--only {MAIN_GROUP}", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--only dev", f"baz==2.0.0 ; {MARKER_PY}\n"), ( f"--only {MAIN_GROUP},dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n", ), ], ) def test_export_groups( tester: CommandTester, do_lock: None, options: str, expected: str ) -> None: tester.execute(options) > assert tester.io.fetch_output() == expected E assert 'baz==2.0.0 ;...ion < "4.0"\n' == 'baz==2.0.0 ;...on == "2.7"\n' E E - baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + baz==2.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/command/test_command_export.py:199: AssertionError __ test_exporter_can_export_requirements_txt_with_nested_packages_cyclic[2.1] __ [gw60] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw60/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages_cyclic( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": {"bar": {"version": "4.5.6"}}, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": {"baz": {"version": "7.8.9"}}, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", "dependencies": {"foo": {"version": "1.2.3"}}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, skip={"bar", "baz"}) 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"""\ bar==4.5.6 ; {MARKER_PY} baz==7.8.9 ; {MARKER_PY} foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==7.8.9 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:1176: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_export_groups[--only dev-baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw14] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, options = '--only dev' expected = 'baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "options, expected", [ ("", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--with dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n"), ("--with opt", f"foo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ; {MARKER_PY}\n"), ( "--with dev,opt", ( f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ;" f" {MARKER_PY}\n" ), ), (f"--without {MAIN_GROUP}", "\n"), ("--without dev", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--without opt", f"foo==1.0.0 ; {MARKER_PY}\n"), (f"--without {MAIN_GROUP},dev,opt", "\n"), (f"--only {MAIN_GROUP}", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--only dev", f"baz==2.0.0 ; {MARKER_PY}\n"), ( f"--only {MAIN_GROUP},dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n", ), ], ) def test_export_groups( tester: CommandTester, do_lock: None, options: str, expected: str ) -> None: tester.execute(options) > assert tester.io.fetch_output() == expected E assert 'baz==2.0.0 ;...ion < "4.0"\n' == 'baz==2.0.0 ;...on == "2.7"\n' E E - baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + baz==2.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/command/test_command_export.py:199: AssertionError _ test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_markers[1.1] _ [gw72] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw72/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_markers( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": { "bar": [ { "version": ">=1.2.3,<7.8.10", "markers": 'platform_system != "Windows"', }, { "version": ">=4.5.6,<7.8.10", "markers": 'platform_system == "Windows"', }, ] }, }, { "name": "bar", "version": "7.8.9", "optional": True, "python-versions": "*", "dependencies": { "baz": { "version": "!=10.11.12", "markers": 'platform_system == "Windows"', } }, }, { "name": "baz", "version": "10.11.13", "optional": True, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][2]["markers"] = 'platform_system == "Windows"' poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.with_hashes(False) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() marker_py_not_windows = MARKER_PY.intersect( parse_marker('platform_system != "Windows"') ) expected = f"""\ bar==7.8.9 ; {marker_py_not_windows.union(MARKER_PY_WINDOWS)} baz==10.11.13 ; {MARKER_PY_WINDOWS} foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'bar==7.8.9 ;...ion < "4.0"\n' == 'bar==7.8.9 ;...on == "2.7"\n' E E - bar==7.8.9 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==7.8.9 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==10.11.13 ; (python_version >= "3.6" or python_version == "2.7") and platform_system == "Windows" and python_version < "4.0" E + baz==10.11.13 ; (python_version == "2.7" or python_version >= "3.6") and python_version < "4.0" and platform_system == "Windows"... E E ...Full output truncated (4 lines hidden), use '-vv' to show tests/test_exporter.py:1289: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_exports_requirements_txt_with_optional_packages[1.1-extras0-lines0] _ [gw50] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw50/test_exporter_exports_requirem0') poetry = , extras = ['feature-bar'] lines = ['bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'foo==1.2.3 ; python_ve...ython_version == "2.7"', 'spam==0.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '1.1' @pytest.mark.parametrize( ["extras", "lines"], [ ( ["feature-bar"], [ f"bar==4.5.6 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", f"spam==0.1.0 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_optional_packages( tmp_path: Path, poetry: Poetry, extras: Collection[NormalizedName], lines: list[str], lock_version: str, ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": True, "python-versions": "*", "dependencies": {"spam": ">=0.1"}, }, { "name": "spam", "version": "0.1.0", "optional": True, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], "spam": [{"name": "spam.whl", "hash": "abcde"}], }, }, "extras": {"feature_bar": ["bar"]}, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][1]["markers"] = 'extra == "feature-bar"' lock_data["package"][2]["markers"] = 'extra == "feature-bar"' poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.with_hashes(False) exporter.with_extras(extras) exporter.export( "requirements.txt", tmp_path, "requirements.txt", ) with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = "\n".join(lines) > assert content.strip() == expected E assert 'bar==4.5.6 ;...rsion < "4.0"' == 'bar==4.5.6 ;...sion == "2.7"' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:1023: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_export_groups[-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw7] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, options = '' expected = 'foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "options, expected", [ ("", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--with dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n"), ("--with opt", f"foo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ; {MARKER_PY}\n"), ( "--with dev,opt", ( f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ;" f" {MARKER_PY}\n" ), ), (f"--without {MAIN_GROUP}", "\n"), ("--without dev", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--without opt", f"foo==1.0.0 ; {MARKER_PY}\n"), (f"--without {MAIN_GROUP},dev,opt", "\n"), (f"--only {MAIN_GROUP}", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--only dev", f"baz==2.0.0 ; {MARKER_PY}\n"), ( f"--only {MAIN_GROUP},dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n", ), ], ) def test_export_groups( tester: CommandTester, do_lock: None, options: str, expected: str ) -> None: tester.execute(options) > assert tester.io.fetch_output() == expected E assert 'foo==1.0.0 ;...ion < "4.0"\n' == 'foo==1.0.0 ;...on == "2.7"\n' E E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/command/test_command_export.py:199: AssertionError _ test_exporter_exports_requirements_txt_with_dev_extras[2.1-False-expected1] __ [gw95] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw95/test_exporter_exports_requirem0') poetry = , dev = False expected = ['bar==1.2.2 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'foo==1.2.1 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '2.1' @pytest.mark.parametrize( ["dev", "expected"], [ ( True, [ f"bar==1.2.2 ; {MARKER_PY}", f"baz==1.2.3 ; {MARKER_PY}", f"foo==1.2.1 ; {MARKER_PY}", ], ), ( False, [ f"bar==1.2.2 ; {MARKER_PY}", f"foo==1.2.1 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_dev_extras( tmp_path: Path, poetry: Poetry, dev: bool, expected: list[str], lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.1", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "1.2.2", "optional": False, "python-versions": "*", "dependencies": { "baz": { "version": ">=0.1.0", "optional": True, "markers": "extra == 'baz'", } }, "extras": {"baz": ["baz (>=0.1.0)"]}, }, { "name": "baz", "version": "1.2.3", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][2]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"baz"}) exporter = Exporter(poetry, NullIO()) if dev: exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() > assert content == "\n".join(expected) + "\n" E assert 'bar==1.2.2 ;...ion < "4.0"\n' == 'bar==1.2.2 ;...on == "2.7"\n' E E - bar==1.2.2 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==1.2.2 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.1 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:1880: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _________ test_exporter_exports_extra_index_url_and_trusted_host[2.1] __________ [gw120] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw120/test_exporter_exports_extra_in0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_extra_index_url_and_trusted_host( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom", "http://example.com/simple", ), priority=Priority.EXPLICIT, ) lock_data = { "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": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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 '--trusted-ho...ion < "4.0"\n' == '--trusted-ho...on == "2.7"\n' E E Skipping 90 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"... E E ...Full output truncated (3 lines hidden), use '-vv' to show tests/test_exporter.py:2965: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_export_includes_extras_by_flag[feature_bar-bar==1.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw13] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, extras = 'feature_bar' expected = 'bar==1.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "extras, expected", [ ( "feature_bar", f"""\ bar==1.1.0 ; {MARKER_PY} foo==1.0.0 ; {MARKER_PY} """, ), ( "feature_bar feature_qux", f"""\ bar==1.1.0 ; {MARKER_PY} foo==1.0.0 ; {MARKER_PY} qux==1.2.0 ; {MARKER_PY} """, ), ], ) def test_export_includes_extras_by_flag( tester: CommandTester, do_lock: None, extras: str, expected: str ) -> None: tester.execute(f"--format requirements.txt --extras '{extras}'") > assert tester.io.fetch_output() == expected E assert 'bar==1.1.0 ;...ion < "4.0"\n' == 'bar==1.1.0 ;...on == "2.7"\n' E E - bar==1.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==1.1.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/command/test_command_export.py:226: AssertionError _ test_export_groups[--with dev-baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw8] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, options = '--with dev' expected = 'baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "options, expected", [ ("", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--with dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n"), ("--with opt", f"foo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ; {MARKER_PY}\n"), ( "--with dev,opt", ( f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ;" f" {MARKER_PY}\n" ), ), (f"--without {MAIN_GROUP}", "\n"), ("--without dev", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--without opt", f"foo==1.0.0 ; {MARKER_PY}\n"), (f"--without {MAIN_GROUP},dev,opt", "\n"), (f"--only {MAIN_GROUP}", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--only dev", f"baz==2.0.0 ; {MARKER_PY}\n"), ( f"--only {MAIN_GROUP},dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n", ), ], ) def test_export_groups( tester: CommandTester, do_lock: None, options: str, expected: str ) -> None: tester.execute(options) > assert tester.io.fetch_output() == expected E assert 'baz==2.0.0 ;...ion < "4.0"\n' == 'baz==2.0.0 ;...on == "2.7"\n' E E - baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + baz==2.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/command/test_command_export.py:199: AssertionError __________ test_exporter_can_export_requirements_txt_pyinstaller[1.1] __________ [gw32] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw32/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_pyinstaller( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: """Regression test for #3254""" lock_data: dict[str, Any] = { "package": [ { "name": "pyinstaller", "version": "4.0", "optional": False, "python-versions": "*", "dependencies": { "altgraph": "*", "macholib": { "version": "*", "markers": "sys_platform == 'darwin'", }, }, }, { "name": "altgraph", "version": "0.17", "optional": False, "python-versions": "*", }, { "name": "macholib", "version": "1.8", "optional": False, "python-versions": "*", "dependencies": {"altgraph": ">=0.15"}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"pyinstaller": [], "altgraph": [], "macholib": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][2]["markers"] = "sys_platform == 'darwin'" poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, skip={"altgraph", "macholib"}) 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() # Rationale for the results: # * PyInstaller has an explicit dependency on altgraph, so it must always be # installed. # * PyInstaller requires macholib on Darwin, which in turn requires altgraph. # The dependency graph: # pyinstaller 4.0 PyInstaller bundles a Python application and all its # ├── altgraph * dependencies into a single package. # ├── macholib >=1.8 -- only on Darwin # │ └── altgraph >=0.15 expected = { "pyinstaller": Dependency.create_from_pep_508( f"pyinstaller==4.0 ; {MARKER_PY}" ), "altgraph": Dependency.create_from_pep_508( f"altgraph==0.17 ; {MARKER_PY.union(MARKER_PY_DARWIN)}" ), "macholib": Dependency.create_from_pep_508( f"macholib==1.8 ; {MARKER_PY_DARWIN}" ), } for line in content.strip().split("\n"): dependency = Dependency.create_from_pep_508(line) assert dependency.name in expected expected_dependency = expected.pop(dependency.name) assert dependency == expected_dependency > assert dependency.marker == expected_dependency.marker E assert = "3.6" and python_version < "4.0"> == = "3.6" and python_version < "4.0" or python_version == "2.7"> E + where = "3.6" and python_version < "4.0"> = .marker E + and = "3.6" and python_version < "4.0" or python_version == "2.7"> = .marker tests/test_exporter.py:421: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_omits_and_includes_extras_for_txt_formats[1.1-requirements.txt-expected1] _ [gw114] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw114/test_exporter_omits_and_includ0') poetry = , fmt = 'requirements.txt' expected = ['bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'bar[baz]==4.5.6 ; pyth...python_version == "2.7"', 'foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '1.1' @pytest.mark.parametrize( ["fmt", "expected"], [ ( "constraints.txt", [ f"bar==4.5.6 ; {MARKER_PY}", f"baz==7.8.9 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", ], ), ( "requirements.txt", [ f"bar==4.5.6 ; {MARKER_PY}", f"bar[baz]==4.5.6 ; {MARKER_PY}", f"baz==7.8.9 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_omits_and_includes_extras_for_txt_formats( tmp_path: Path, poetry: Poetry, fmt: str, expected: list[str], lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": { "bar": { "extras": ["baz"], "version": ">=0.1.0", } }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": { "baz": { "version": ">=0.1.0", "optional": True, "markers": "extra == 'baz'", } }, "extras": {"baz": ["baz (>=0.1.0)"]}, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.export(fmt, tmp_path, "exported.txt") with (tmp_path / "exported.txt").open(encoding="utf-8") as f: content = f.read() # It does not matter whether packages are exported with extras or not # because all dependencies are listed explicitly. if lock_version == "2.1": expected = [req for req in expected if not req.startswith("bar[baz]")] > assert content == "\n".join(expected) + "\n" E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - bar[baz]==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (10 lines hidden), use '-vv' to show tests/test_exporter.py:2703: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _________________________ test_export_with_all_extras __________________________ [gw23] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None def test_export_with_all_extras(tester: CommandTester, do_lock: None) -> None: tester.execute("--format requirements.txt --all-extras") output = tester.io.fetch_output() > assert f"bar==1.1.0 ; {MARKER_PY}" in output E assert 'bar==1.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"' in 'bar==1.1.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0"\nfoo==1.0.0 ; python_versi...d python_version < "4.0"\nqux==1.2.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0"\n' tests/command/test_command_export.py:239: AssertionError __________ test_exporter_can_export_requirements_txt_pyinstaller[2.1] __________ [gw40] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw40/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_pyinstaller( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: """Regression test for #3254""" lock_data: dict[str, Any] = { "package": [ { "name": "pyinstaller", "version": "4.0", "optional": False, "python-versions": "*", "dependencies": { "altgraph": "*", "macholib": { "version": "*", "markers": "sys_platform == 'darwin'", }, }, }, { "name": "altgraph", "version": "0.17", "optional": False, "python-versions": "*", }, { "name": "macholib", "version": "1.8", "optional": False, "python-versions": "*", "dependencies": {"altgraph": ">=0.15"}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"pyinstaller": [], "altgraph": [], "macholib": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][2]["markers"] = "sys_platform == 'darwin'" poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, skip={"altgraph", "macholib"}) 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() # Rationale for the results: # * PyInstaller has an explicit dependency on altgraph, so it must always be # installed. # * PyInstaller requires macholib on Darwin, which in turn requires altgraph. # The dependency graph: # pyinstaller 4.0 PyInstaller bundles a Python application and all its # ├── altgraph * dependencies into a single package. # ├── macholib >=1.8 -- only on Darwin # │ └── altgraph >=0.15 expected = { "pyinstaller": Dependency.create_from_pep_508( f"pyinstaller==4.0 ; {MARKER_PY}" ), "altgraph": Dependency.create_from_pep_508( f"altgraph==0.17 ; {MARKER_PY.union(MARKER_PY_DARWIN)}" ), "macholib": Dependency.create_from_pep_508( f"macholib==1.8 ; {MARKER_PY_DARWIN}" ), } for line in content.strip().split("\n"): dependency = Dependency.create_from_pep_508(line) assert dependency.name in expected expected_dependency = expected.pop(dependency.name) assert dependency == expected_dependency > assert dependency.marker == expected_dependency.marker E assert = "3.6" and python_version < "4.0"> == = "3.6" and python_version < "4.0" or python_version == "2.7"> E + where = "3.6" and python_version < "4.0"> = .marker E + and = "3.6" and python_version < "4.0" or python_version == "2.7"> = .marker tests/test_exporter.py:421: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_export_groups[--only main-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw17] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, options = '--only main' expected = 'foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "options, expected", [ ("", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--with dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n"), ("--with opt", f"foo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ; {MARKER_PY}\n"), ( "--with dev,opt", ( f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ;" f" {MARKER_PY}\n" ), ), (f"--without {MAIN_GROUP}", "\n"), ("--without dev", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--without opt", f"foo==1.0.0 ; {MARKER_PY}\n"), (f"--without {MAIN_GROUP},dev,opt", "\n"), (f"--only {MAIN_GROUP}", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--only dev", f"baz==2.0.0 ; {MARKER_PY}\n"), ( f"--only {MAIN_GROUP},dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n", ), ], ) def test_export_groups( tester: CommandTester, do_lock: None, options: str, expected: str ) -> None: tester.execute(options) > assert tester.io.fetch_output() == expected E assert 'foo==1.0.0 ;...ion < "4.0"\n' == 'foo==1.0.0 ;...on == "2.7"\n' E E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/command/test_command_export.py:199: AssertionError __ test_exporter_exports_requirements_txt_with_dev_extras[1.1-True-expected0] __ [gw88] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw88/test_exporter_exports_requirem0') poetry = , dev = True expected = ['bar==1.2.2 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'baz==1.2.3 ; python_ve...python_version == "2.7"', 'foo==1.2.1 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '1.1' @pytest.mark.parametrize( ["dev", "expected"], [ ( True, [ f"bar==1.2.2 ; {MARKER_PY}", f"baz==1.2.3 ; {MARKER_PY}", f"foo==1.2.1 ; {MARKER_PY}", ], ), ( False, [ f"bar==1.2.2 ; {MARKER_PY}", f"foo==1.2.1 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_dev_extras( tmp_path: Path, poetry: Poetry, dev: bool, expected: list[str], lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.1", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "1.2.2", "optional": False, "python-versions": "*", "dependencies": { "baz": { "version": ">=0.1.0", "optional": True, "markers": "extra == 'baz'", } }, "extras": {"baz": ["baz (>=0.1.0)"]}, }, { "name": "baz", "version": "1.2.3", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][2]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"baz"}) exporter = Exporter(poetry, NullIO()) if dev: exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() > assert content == "\n".join(expected) + "\n" E assert 'bar==1.2.2 ;...ion < "4.0"\n' == 'bar==1.2.2 ;...on == "2.7"\n' E E - bar==1.2.2 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==1.2.2 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:1880: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_omits_and_includes_extras_for_txt_formats[1.1-constraints.txt-expected0] _ [gw113] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw113/test_exporter_omits_and_includ0') poetry = , fmt = 'constraints.txt' expected = ['bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'baz==7.8.9 ; python_ve...python_version == "2.7"', 'foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '1.1' @pytest.mark.parametrize( ["fmt", "expected"], [ ( "constraints.txt", [ f"bar==4.5.6 ; {MARKER_PY}", f"baz==7.8.9 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", ], ), ( "requirements.txt", [ f"bar==4.5.6 ; {MARKER_PY}", f"bar[baz]==4.5.6 ; {MARKER_PY}", f"baz==7.8.9 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_omits_and_includes_extras_for_txt_formats( tmp_path: Path, poetry: Poetry, fmt: str, expected: list[str], lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": { "bar": { "extras": ["baz"], "version": ">=0.1.0", } }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": { "baz": { "version": ">=0.1.0", "optional": True, "markers": "extra == 'baz'", } }, "extras": {"baz": ["baz (>=0.1.0)"]}, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.export(fmt, tmp_path, "exported.txt") with (tmp_path / "exported.txt").open(encoding="utf-8") as f: content = f.read() # It does not matter whether packages are exported with extras or not # because all dependencies are listed explicitly. if lock_version == "2.1": expected = [req for req in expected if not req.startswith("bar[baz]")] > assert content == "\n".join(expected) + "\n" E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==7.8.9 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:2703: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ____________ test_exporter_can_export_requirements_txt_poetry[1.1] _____________ [gw31] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw31/test_exporter_can_export_requi0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_poetry( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: """Regression test for #3254""" lock_data: dict[str, Any] = { "package": [ { "name": "poetry", "version": "1.1.4", "optional": False, "python-versions": "*", "dependencies": {"keyring": "*"}, }, { "name": "junit-xml", "version": "1.9", "optional": False, "python-versions": "*", "dependencies": {"six": "*"}, }, { "name": "keyring", "version": "21.8.0", "optional": False, "python-versions": "*", "dependencies": { "SecretStorage": { "version": "*", "markers": "sys_platform == 'linux'", } }, }, { "name": "secretstorage", "version": "3.3.0", "optional": False, "python-versions": "*", "dependencies": {"cryptography": "*"}, }, { "name": "cryptography", "version": "3.2", "optional": False, "python-versions": "*", "dependencies": {"six": "*"}, }, { "name": "six", "version": "1.15.0", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "poetry": [], "keyring": [], "secretstorage": [], "cryptography": [], "six": [], "junit-xml": [], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][3]["markers"] = "sys_platform == 'linux'" lock_data["package"][4]["markers"] = "sys_platform == 'linux'" poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires( poetry, skip={"keyring", "secretstorage", "cryptography", "six"} ) 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() # The dependency graph: # junit-xml 1.9 Creates JUnit XML test result documents that can be read by tools # └── six * such as Jenkins # poetry 1.1.4 Python dependency management and packaging made easy. # ├── keyring >=21.2.0,<22.0.0 # │ ├── importlib-metadata >=1 # │ │ └── zipp >=0.5 # │ ├── jeepney >=0.4.2 # │ ├── pywin32-ctypes <0.1.0 || >0.1.0,<0.1.1 || >0.1.1 # │ └── secretstorage >=3.2 -- On linux only # │ ├── cryptography >=2.0 # │ │ └── six >=1.4.1 # │ └── jeepney >=0.6 (circular dependency aborted here) expected = { "poetry": Dependency.create_from_pep_508(f"poetry==1.1.4; {MARKER_PY}"), "junit-xml": Dependency.create_from_pep_508(f"junit-xml==1.9 ; {MARKER_PY}"), "keyring": Dependency.create_from_pep_508(f"keyring==21.8.0 ; {MARKER_PY}"), "secretstorage": Dependency.create_from_pep_508( f"secretstorage==3.3.0 ; {MARKER_PY_LINUX}" ), "cryptography": Dependency.create_from_pep_508( f"cryptography==3.2 ; {MARKER_PY_LINUX}" ), "six": Dependency.create_from_pep_508( f"six==1.15.0 ; {MARKER_PY.union(MARKER_PY_LINUX)}" ), } for line in content.strip().split("\n"): dependency = Dependency.create_from_pep_508(line) assert dependency.name in expected expected_dependency = expected.pop(dependency.name) assert dependency == expected_dependency > assert dependency.marker == expected_dependency.marker E assert = "3.6") and python_version < "4.0" and sys_platform == "linux"> == = "3.6" or python_version == "2.7") and sys_platform == "linux" and python_version < "4.0"> E + where = "3.6") and python_version < "4.0" and sys_platform == "linux"> = .marker E + and = "3.6" or python_version == "2.7") and sys_platform == "linux" and python_version < "4.0"> = .marker tests/test_exporter.py:338: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ________ test_exporter_exports_requirements_txt_to_standard_output[1.1] ________ [gw97] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw97/test_exporter_exports_requirem0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_to_standard_output( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) io = BufferedIO() exporter.export("requirements.txt", tmp_path, io) expected = f"""\ bar==4.5.6 ; {MARKER_PY} foo==1.2.3 ; {MARKER_PY} """ > assert io.fetch_output() == expected E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_exporter.py:2195: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_export_groups[--without dev-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw15] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, options = '--without dev' expected = 'foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "options, expected", [ ("", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--with dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n"), ("--with opt", f"foo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ; {MARKER_PY}\n"), ( "--with dev,opt", ( f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ;" f" {MARKER_PY}\n" ), ), (f"--without {MAIN_GROUP}", "\n"), ("--without dev", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--without opt", f"foo==1.0.0 ; {MARKER_PY}\n"), (f"--without {MAIN_GROUP},dev,opt", "\n"), (f"--only {MAIN_GROUP}", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--only dev", f"baz==2.0.0 ; {MARKER_PY}\n"), ( f"--only {MAIN_GROUP},dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n", ), ], ) def test_export_groups( tester: CommandTester, do_lock: None, options: str, expected: str ) -> None: tester.execute(options) > assert tester.io.fetch_output() == expected E assert 'foo==1.0.0 ;...ion < "4.0"\n' == 'foo==1.0.0 ;...on == "2.7"\n' E E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/command/test_command_export.py:199: AssertionError _________ test_exporter_exports_extra_index_url_and_trusted_host[1.1] __________ [gw117] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw117/test_exporter_exports_extra_in0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_extra_index_url_and_trusted_host( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom", "http://example.com/simple", ), priority=Priority.EXPLICIT, ) lock_data = { "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": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] 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 '--trusted-ho...ion < "4.0"\n' == '--trusted-ho...on == "2.7"\n' E E Skipping 90 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"... E E ...Full output truncated (3 lines hidden), use '-vv' to show tests/test_exporter.py:2965: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. ___________________ test_export_prints_to_stdout_by_default ____________________ [gw4] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None def test_export_prints_to_stdout_by_default( tester: CommandTester, do_lock: None ) -> None: tester.execute("--format requirements.txt") expected = f"""\ foo==1.0.0 ; {MARKER_PY} """ > assert tester.io.fetch_output() == expected E assert 'foo==1.0.0 ;...ion < "4.0"\n' == 'foo==1.0.0 ;...on == "2.7"\n' E E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/command/test_command_export.py:157: AssertionError _ test_exporter_prints_warning_for_constraints_txt_with_editable_packages[1.1] _ [gw110] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw110/test_exporter_prints_warning_f0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_prints_warning_for_constraints_txt_with_editable_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "git", "url": "https://github.com/foo/foo.git", "reference": "123456", }, "develop": True, }, { "name": "bar", "version": "7.8.9", "optional": False, "python-versions": "*", }, { "name": "baz", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project", "reference": "", }, "develop": True, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) io = BufferedIO() exporter = Exporter(poetry, io) exporter.export("constraints.txt", tmp_path, "constraints.txt") expected_error_out = ( "Warning: foo is locked in develop (editable) mode, which is " "incompatible with the constraints.txt format.\n" "Warning: baz is locked in develop (editable) mode, which is " "incompatible with the constraints.txt format.\n" ) assert io.fetch_error() == expected_error_out with (tmp_path / "constraints.txt").open(encoding="utf-8") as f: content = f.read() > assert content == f"bar==7.8.9 ; {MARKER_PY}\n" E assert 'bar==7.8.9 ;...ion < "4.0"\n' == 'bar==7.8.9 ;...on == "2.7"\n' E E - bar==7.8.9 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==7.8.9 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:2770: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[2.1-priorities2-expected2] ______________ [gw10] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw10/test_exporter_index_urls_2_1_p0') poetry = priorities = [('custom-b', ), ('custom-a', )] expected = ('a', 'b'), lock_version = '2.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 107 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_exports_requirements_txt_with_legacy_packages_trusted_host[2.1] _ [gw86] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw86/test_exporter_exports_requirem0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_exports_requirements_txt_with_legacy_packages_trusted_host( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: poetry.pool.add_repository( LegacyRepository( "custom", "http://example.com/simple", ) ) lock_data: dict[str, Any] = { "package": [ { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "http://example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) 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} \\ --hash=sha256:67890 """ > assert content == expected E assert '--trusted-ho...ha256:67890\n' == '--trusted-ho...ha256:67890\n' E E Skipping 90 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890 tests/test_exporter.py:1803: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[2.1-priorities6-expected6] ______________ [gw9] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw9/test_exporter_index_urls_2_1_p0') poetry = priorities = [('custom-a', ), ('custom-b', ), ('PyPI', )] expected = ('', 'a', 'b'), lock_version = '2.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 113 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_doesnt_confuse_repeated_packages[1.1] ______________ [gw94] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw94/test_exporter_doesnt_confuse_r0') poetry = , lock_version = '1.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_doesnt_confuse_repeated_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: # Testcase derived from . lock_data: dict[str, Any] = { "package": [ { "name": "celery", "version": "5.1.2", "optional": False, "python-versions": "<3.7", "dependencies": { "click": ">=7.0,<8.0", "click-didyoumean": ">=0.0.3", "click-plugins": ">=1.1.1", }, }, { "name": "celery", "version": "5.2.3", "optional": False, "python-versions": ">=3.7", "dependencies": { "click": ">=8.0.3,<9.0", "click-didyoumean": ">=0.0.3", "click-plugins": ">=1.1.1", }, }, { "name": "click", "version": "7.1.2", "optional": False, "python-versions": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*", }, { "name": "click", "version": "8.0.3", "optional": False, "python-versions": ">=3.6", "dependencies": {}, }, { "name": "click-didyoumean", "version": "0.0.3", "optional": False, "python-versions": "*", "dependencies": {"click": "*"}, }, { "name": "click-didyoumean", "version": "0.3.0", "optional": False, "python-versions": ">=3.6.2,<4.0.0", "dependencies": {"click": ">=7"}, }, { "name": "click-plugins", "version": "1.1.1", "optional": False, "python-versions": "*", "dependencies": {"click": ">=4.0"}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "^3.6", "content-hash": ( "832b13a88e5020c27cbcd95faa577bf0dbf054a65c023b45dc9442b640d414e6" ), "files": { "celery": [], "click-didyoumean": [], "click-plugins": [], "click": [], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["markers"] = "python_version < '3.7'" lock_data["package"][1]["markers"] = "python_version >= '3.7'" lock_data["package"][2]["markers"] = "python_version < '3.7'" lock_data["package"][3]["markers"] = "python_version >= '3.7'" lock_data["package"][4]["markers"] = "python_full_version < '3.6.2'" lock_data["package"][5]["markers"] = "python_full_version >= '3.6.2'" poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] root = poetry.package.with_dependency_groups([], only=True) root.python_versions = "^3.6" root.add_dependency( Factory.create_dependency( name="celery", constraint={"version": "5.1.2", "python": "<3.7"} ) ) root.add_dependency( Factory.create_dependency( name="celery", constraint={"version": "5.2.3", "python": ">=3.7"} ) ) poetry._package = root exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) io = BufferedIO() exporter.export("requirements.txt", tmp_path, io) expected = f"""\ celery==5.1.2 ; {MARKER_PY36_ONLY} celery==5.2.3 ; {MARKER_PY37} click-didyoumean==0.0.3 ; {MARKER_PY36_PY362} click-didyoumean==0.3.0 ; {MARKER_PY362_PY40} click-plugins==1.1.1 ; {MARKER_PY36} click==7.1.2 ; {MARKER_PY36_ONLY} click==8.0.3 ; {MARKER_PY37} """ > assert io.fetch_output() == expected E assert 'celery==5.1....ion < "4.0"\n' == 'celery==5.1....ion < "4.0"\n' E E Skipping 130 identical leading characters in diff, use -v to show E Skipping 256 identical trailing characters in diff, use -v to show E - ; python_version >= "3.6" and python_full_version < "3.6.2" E + ; python_full_version < "3.6.2" and python_version == "3.6" E click-d tests/test_exporter.py:2314: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_export_groups[--without opt-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw18] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, options = '--without opt' expected = 'foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "options, expected", [ ("", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--with dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n"), ("--with opt", f"foo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ; {MARKER_PY}\n"), ( "--with dev,opt", ( f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ;" f" {MARKER_PY}\n" ), ), (f"--without {MAIN_GROUP}", "\n"), ("--without dev", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--without opt", f"foo==1.0.0 ; {MARKER_PY}\n"), (f"--without {MAIN_GROUP},dev,opt", "\n"), (f"--only {MAIN_GROUP}", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--only dev", f"baz==2.0.0 ; {MARKER_PY}\n"), ( f"--only {MAIN_GROUP},dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n", ), ], ) def test_export_groups( tester: CommandTester, do_lock: None, options: str, expected: str ) -> None: tester.execute(options) > assert tester.io.fetch_output() == expected E assert 'foo==1.0.0 ;...ion < "4.0"\n' == 'foo==1.0.0 ;...on == "2.7"\n' E E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/command/test_command_export.py:199: AssertionError _ test_exporter_omits_and_includes_extras_for_txt_formats[2.1-constraints.txt-expected0] _ [gw104] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw104/test_exporter_omits_and_includ0') poetry = , fmt = 'constraints.txt' expected = ['bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"', 'baz==7.8.9 ; python_ve...python_version == "2.7"', 'foo==1.2.3 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"'] lock_version = '2.1' @pytest.mark.parametrize( ["fmt", "expected"], [ ( "constraints.txt", [ f"bar==4.5.6 ; {MARKER_PY}", f"baz==7.8.9 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", ], ), ( "requirements.txt", [ f"bar==4.5.6 ; {MARKER_PY}", f"bar[baz]==4.5.6 ; {MARKER_PY}", f"baz==7.8.9 ; {MARKER_PY}", f"foo==1.2.3 ; {MARKER_PY}", ], ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_omits_and_includes_extras_for_txt_formats( tmp_path: Path, poetry: Poetry, fmt: str, expected: list[str], lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": { "bar": { "extras": ["baz"], "version": ">=0.1.0", } }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "dependencies": { "baz": { "version": ">=0.1.0", "optional": True, "markers": "extra == 'baz'", } }, "extras": {"baz": ["baz (>=0.1.0)"]}, }, { "name": "baz", "version": "7.8.9", "optional": False, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.export(fmt, tmp_path, "exported.txt") with (tmp_path / "exported.txt").open(encoding="utf-8") as f: content = f.read() # It does not matter whether packages are exported with extras or not # because all dependencies are listed explicitly. if lock_version == "2.1": expected = [req for req in expected if not req.startswith("bar[baz]")] > assert content == "\n".join(expected) + "\n" E assert 'bar==4.5.6 ;...ion < "4.0"\n' == 'bar==4.5.6 ;...on == "2.7"\n' E E - bar==4.5.6 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==4.5.6 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==7.8.9 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_exporter.py:2703: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_markers[2.1] _ [gw67] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw67/test_exporter_can_export_requi0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_markers( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "dependencies": { "bar": [ { "version": ">=1.2.3,<7.8.10", "markers": 'platform_system != "Windows"', }, { "version": ">=4.5.6,<7.8.10", "markers": 'platform_system == "Windows"', }, ] }, }, { "name": "bar", "version": "7.8.9", "optional": True, "python-versions": "*", "dependencies": { "baz": { "version": "!=10.11.12", "markers": 'platform_system == "Windows"', } }, }, { "name": "baz", "version": "10.11.13", "optional": True, "python-versions": "*", }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][2]["markers"] = 'platform_system == "Windows"' poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) exporter = Exporter(poetry, NullIO()) exporter.with_hashes(False) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() marker_py_not_windows = MARKER_PY.intersect( parse_marker('platform_system != "Windows"') ) expected = f"""\ bar==7.8.9 ; {marker_py_not_windows.union(MARKER_PY_WINDOWS)} baz==10.11.13 ; {MARKER_PY_WINDOWS} foo==1.2.3 ; {MARKER_PY} """ > assert content == expected E assert 'bar==7.8.9 ;...ion < "4.0"\n' == 'bar==7.8.9 ;...on == "2.7"\n' E E - bar==7.8.9 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==7.8.9 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - baz==10.11.13 ; (python_version >= "3.6" or python_version == "2.7") and platform_system == "Windows" and python_version < "4.0" E + baz==10.11.13 ; (python_version == "2.7" or python_version >= "3.6") and python_version < "4.0" and platform_system == "Windows"... E E ...Full output truncated (4 lines hidden), use '-vv' to show tests/test_exporter.py:1289: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[1.1-priorities2-expected2] ______________ [gw122] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw122/test_exporter_index_urls_1_1_p0') poetry = priorities = [('custom-b', ), ('custom-a', )] expected = ('a', 'b'), lock_version = '1.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 107 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[2.1-priorities4-expected4] ______________ [gw8] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw8/test_exporter_index_urls_2_1_p0') poetry = priorities = [('PyPI', ), ('custom-a', ), ('custom-b', )] expected = ('', 'a', 'b'), lock_version = '2.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 113 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _ test_exporter_prints_warning_for_constraints_txt_with_editable_packages[2.1] _ [gw116] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw116/test_exporter_prints_warning_f0') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_prints_warning_for_constraints_txt_with_editable_packages( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: lock_data = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "git", "url": "https://github.com/foo/foo.git", "reference": "123456", }, "develop": True, }, { "name": "bar", "version": "7.8.9", "optional": False, "python-versions": "*", }, { "name": "baz", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "directory", "url": "sample_project", "reference": "", }, "develop": True, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": [], "baz": []}, }, } fix_lock_data(lock_data) poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry) io = BufferedIO() exporter = Exporter(poetry, io) exporter.export("constraints.txt", tmp_path, "constraints.txt") expected_error_out = ( "Warning: foo is locked in develop (editable) mode, which is " "incompatible with the constraints.txt format.\n" "Warning: baz is locked in develop (editable) mode, which is " "incompatible with the constraints.txt format.\n" ) assert io.fetch_error() == expected_error_out with (tmp_path / "constraints.txt").open(encoding="utf-8") as f: content = f.read() > assert content == f"bar==7.8.9 ; {MARKER_PY}\n" E assert 'bar==7.8.9 ;...ion < "4.0"\n' == 'bar==7.8.9 ;...on == "2.7"\n' E E - bar==7.8.9 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==7.8.9 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/test_exporter.py:2770: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[2.1-priorities3-expected3] ______________ [gw7] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw7/test_exporter_index_urls_2_1_p0') poetry = priorities = [('custom-b', ), ('custom-a', )] expected = ('a', 'b'), lock_version = '2.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 107 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_export_exports_requirements_txt_uses_lock_file ______________ [gw0] linux -- Python 3.13.3 /usr/bin/python tester = poetry = tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw0/test_export_exports_requiremen0') do_lock = None def test_export_exports_requirements_txt_uses_lock_file( tester: CommandTester, poetry: Poetry, tmp_path: Path, do_lock: None ) -> None: > _export_requirements(tester, poetry, tmp_path) tests/command/test_command_export.py:129: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tester = poetry = tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw0/test_export_exports_requiremen0') def _export_requirements(tester: CommandTester, poetry: Poetry, tmp_path: Path) -> None: from tests.helpers import as_cwd with as_cwd(tmp_path): tester.execute("--format requirements.txt --output requirements.txt") requirements = tmp_path / "requirements.txt" assert requirements.exists() with requirements.open(encoding="utf-8") as f: content = f.read() assert poetry.locker.lock.exists() expected = f"""\ foo==1.0.0 ; {MARKER_PY} """ > assert content == expected E assert 'foo==1.0.0 ;...ion < "4.0"\n' == 'foo==1.0.0 ;...on == "2.7"\n' E E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/command/test_command_export.py:115: AssertionError _ test_export_includes_extras_by_flag[feature_bar feature_qux-bar==1.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nqux==1.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw16] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, extras = 'feature_bar feature_qux' expected = 'bar==1.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_versi... python_version == "2.7"\nqux==1.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "extras, expected", [ ( "feature_bar", f"""\ bar==1.1.0 ; {MARKER_PY} foo==1.0.0 ; {MARKER_PY} """, ), ( "feature_bar feature_qux", f"""\ bar==1.1.0 ; {MARKER_PY} foo==1.0.0 ; {MARKER_PY} qux==1.2.0 ; {MARKER_PY} """, ), ], ) def test_export_includes_extras_by_flag( tester: CommandTester, do_lock: None, extras: str, expected: str ) -> None: tester.execute(f"--format requirements.txt --extras '{extras}'") > assert tester.io.fetch_output() == expected E assert 'bar==1.1.0 ;...ion < "4.0"\n' == 'bar==1.1.0 ;...on == "2.7"\n' E E - bar==1.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + bar==1.1.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/command/test_command_export.py:226: AssertionError _ test_export_groups[--with opt-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nopt==2.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] _ [gw2] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None, options = '--with opt' expected = 'foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nopt==2.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n' @pytest.mark.parametrize( "options, expected", [ ("", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--with dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n"), ("--with opt", f"foo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ; {MARKER_PY}\n"), ( "--with dev,opt", ( f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\nopt==2.2.0 ;" f" {MARKER_PY}\n" ), ), (f"--without {MAIN_GROUP}", "\n"), ("--without dev", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--without opt", f"foo==1.0.0 ; {MARKER_PY}\n"), (f"--without {MAIN_GROUP},dev,opt", "\n"), (f"--only {MAIN_GROUP}", f"foo==1.0.0 ; {MARKER_PY}\n"), ("--only dev", f"baz==2.0.0 ; {MARKER_PY}\n"), ( f"--only {MAIN_GROUP},dev", f"baz==2.0.0 ; {MARKER_PY}\nfoo==1.0.0 ; {MARKER_PY}\n", ), ], ) def test_export_groups( tester: CommandTester, do_lock: None, options: str, expected: str ) -> None: tester.execute(options) > assert tester.io.fetch_output() == expected E assert 'foo==1.0.0 ;...ion < "4.0"\n' == 'foo==1.0.0 ;...on == "2.7"\n' E E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E - opt==2.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/command/test_command_export.py:199: AssertionError _______________________ test_dependency_walk_error[2.1] ________________________ [gw15] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw15/test_dependency_walk_error_2_10') poetry = , lock_version = '2.1' @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_dependency_walk_error( tmp_path: Path, poetry: Poetry, lock_version: str ) -> None: """ With lock file version 2.1 we can export lock files that resulted in a DependencyWalkerError with lower lock file versions. root ├── foo >=0 ; python_version < "3.9" ├── foo >=1 ; python_version >= "3.9" ├── bar ==1 ; python_version < "3.9" │ └── foo ==1 ; python_version < "3.9" └── bar ==2 ; python_version >= "3.9" └── foo ==2 ; python_version >= "3.9" Only considering the root dependency, foo 2 is a valid solution for all environments. However, due to bar depending on foo, foo 1 must be chosen for Python 3.8 and lower. """ lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1", "optional": False, "python-versions": "*", }, { "name": "foo", "version": "2", "optional": False, "python-versions": "*", }, { "name": "bar", "version": "1", "optional": False, "python-versions": "*", "dependencies": {"foo": "1"}, }, { "name": "bar", "version": "2", "optional": False, "python-versions": "*", "dependencies": {"foo": "2"}, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": {"foo": [], "bar": []}, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["markers"] = "python_version < '3.9'" lock_data["package"][1]["markers"] = "python_version >= '3.9'" lock_data["package"][2]["markers"] = "python_version < '3.9'" lock_data["package"][3]["markers"] = "python_version >= '3.9'" poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] poetry.package.python_versions = "^3.8" poetry.package.add_dependency( Factory.create_dependency( name="foo", constraint={"version": ">=0", "python": "<3.9"} ) ) poetry.package.add_dependency( Factory.create_dependency( name="foo", constraint={"version": ">=1", "python": ">=3.9"} ) ) poetry.package.add_dependency( Factory.create_dependency( name="bar", constraint={"version": "1", "python": "<3.9"} ) ) poetry.package.add_dependency( Factory.create_dependency( name="bar", constraint={"version": "2", "python": ">=3.9"} ) ) exporter = Exporter(poetry, NullIO()) if lock_version == "1.1": with pytest.raises(DependencyWalkerError): exporter.export("requirements.txt", tmp_path, "requirements.txt") return exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected = """\ bar==1 ; python_version >= "3.8" and python_version < "3.9" bar==2 ; python_version >= "3.9" and python_version < "4.0" foo==1 ; python_version >= "3.8" and python_version < "3.9" foo==2 ; python_version >= "3.9" and python_version < "4.0" """ > assert content == expected E assert 'bar==1 ; pyt...ion < "4.0"\n' == 'bar==1 ; pyt...ion < "4.0"\n' E E - bar==1 ; python_version >= "3.8" and python_version < "3.9" E + bar==1 ; python_version == "3.8" E bar==2 ; python_version >= "3.9" and python_version < "4.0" E - foo==1 ; python_version >= "3.8" and python_version < "3.9" E + foo==1 ; python_version == "3.8" E foo==2 ; python_version >= "3.9" and python_version < "4.0" tests/test_exporter.py:3281: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _________________________ test_export_with_all_groups __________________________ [gw21] linux -- Python 3.13.3 /usr/bin/python tester = do_lock = None def test_export_with_all_groups(tester: CommandTester, do_lock: None) -> None: tester.execute("--format requirements.txt --all-groups") output = tester.io.fetch_output() > assert f"baz==2.0.0 ; {MARKER_PY}" in output E assert 'baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"' in 'baz==2.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0"\nfoo==1.0.0 ; python_versi...d python_version < "4.0"\nopt==2.2.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0"\n' tests/command/test_command_export.py:256: AssertionError _____________ test_exporter_index_urls[2.1-priorities1-expected1] ______________ [gw4] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw4/test_exporter_index_urls_2_1_p0') poetry = priorities = [('custom-b', ), ('custom-a', )] expected = ('b', 'a'), lock_version = '2.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 107 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[2.1-priorities0-expected0] ______________ [gw3] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw3/test_exporter_index_urls_2_1_p0') poetry = priorities = [('custom-a', ), ('custom-b', )] expected = ('a', 'b'), lock_version = '2.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--index-url ...ha256:12345\n' == '--index-url ...ha256:12345\n' E E Skipping 107 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[1.1-priorities5-expected5] ______________ [gw0] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw0/test_exporter_index_urls_1_1_p0') poetry = priorities = [('PyPI', ), ('custom-a', ), ('custom-b', )] expected = ('', 'a', 'b'), lock_version = '1.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 113 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[2.1-priorities5-expected5] ______________ [gw2] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw2/test_exporter_index_urls_2_1_p0') poetry = priorities = [('PyPI', ), ('custom-a', ), ('custom-b', )] expected = ('', 'a', 'b'), lock_version = '2.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 113 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _____________ test_exporter_index_urls[1.1-priorities6-expected6] ______________ [gw6] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw6/test_exporter_index_urls_1_1_p0') poetry = priorities = [('custom-a', ), ('custom-b', ), ('PyPI', )] expected = ('', 'a', 'b'), lock_version = '1.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 113 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. _______ test_export_exports_requirements_txt_file_locks_if_no_lock_file ________ [gw1] linux -- Python 3.13.3 /usr/bin/python tester = poetry = tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw1/test_export_exports_requiremen0') def test_export_exports_requirements_txt_file_locks_if_no_lock_file( tester: CommandTester, poetry: Poetry, tmp_path: Path ) -> None: assert not poetry.locker.lock.exists() > _export_requirements(tester, poetry, tmp_path) tests/command/test_command_export.py:122: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tester = poetry = tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw1/test_export_exports_requiremen0') def _export_requirements(tester: CommandTester, poetry: Poetry, tmp_path: Path) -> None: from tests.helpers import as_cwd with as_cwd(tmp_path): tester.execute("--format requirements.txt --output requirements.txt") requirements = tmp_path / "requirements.txt" assert requirements.exists() with requirements.open(encoding="utf-8") as f: content = f.read() assert poetry.locker.lock.exists() expected = f"""\ foo==1.0.0 ; {MARKER_PY} """ > assert content == expected E assert 'foo==1.0.0 ;...ion < "4.0"\n' == 'foo==1.0.0 ;...on == "2.7"\n' E E - foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7" E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + foo==1.0.0 ; python_version == "2.7" or python_version >= "3.6" and python_version < "4.0" E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ tests/command/test_command_export.py:115: AssertionError _____________ test_exporter_index_urls[1.1-priorities4-expected4] ______________ [gw1] linux -- Python 3.13.3 /usr/bin/python tmp_path = PosixPath('/tmp/pytest-of-builduser/pytest-0/popen-gw1/test_exporter_index_urls_1_1_p0') poetry = priorities = [('PyPI', ), ('custom-a', ), ('custom-b', )] expected = ('', 'a', 'b'), lock_version = '1.1' @pytest.mark.parametrize( ("priorities", "expected"), [ ([("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY)], ("a", "b")), ([("custom-b", Priority.PRIMARY), ("custom-a", Priority.PRIMARY)], ("b", "a")), ( [("custom-b", Priority.SUPPLEMENTAL), ("custom-a", Priority.PRIMARY)], ("a", "b"), ), ([("custom-b", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY)], ("a", "b")), ( [ ("PyPI", Priority.PRIMARY), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("PyPI", Priority.EXPLICIT), ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ], ("", "a", "b"), ), ( [ ("custom-a", Priority.PRIMARY), ("custom-b", Priority.PRIMARY), ("PyPI", Priority.SUPPLEMENTAL), ], ("", "a", "b"), ), ], ) @pytest.mark.parametrize("lock_version", ("1.1", "2.1")) def test_exporter_index_urls( tmp_path: Path, poetry: Poetry, priorities: list[tuple[str, Priority]], expected: tuple[str, ...], lock_version: str, ) -> None: pypi = poetry.pool.repository("PyPI") poetry.pool.remove_repository("PyPI") for name, prio in priorities: if name.lower() == "pypi": repo = pypi else: repo = LegacyRepository(name, f"https://{name[-1]}.example.com/simple") poetry.pool.add_repository(repo, priority=prio) lock_data: dict[str, Any] = { "package": [ { "name": "foo", "version": "1.2.3", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://a.example.com/simple", "reference": "", }, }, { "name": "bar", "version": "4.5.6", "optional": False, "python-versions": "*", "source": { "type": "legacy", "url": "https://b.example.com/simple", "reference": "", }, }, ], "metadata": { "lock-version": lock_version, "python-versions": "*", "content-hash": "123456789", "files": { "foo": [{"name": "foo.whl", "hash": "12345"}], "bar": [{"name": "bar.whl", "hash": "67890"}], }, }, } fix_lock_data(lock_data) if lock_version == "2.1": lock_data["package"][0]["groups"] = ["dev"] poetry.locker.mock_lock_data(lock_data) # type: ignore[attr-defined] set_package_requires(poetry, dev={"bar"}) exporter = Exporter(poetry, NullIO()) exporter.only_groups([MAIN_GROUP, "dev"]) exporter.export("requirements.txt", tmp_path, "requirements.txt") with (tmp_path / "requirements.txt").open(encoding="utf-8") as f: content = f.read() expected_urls = [ f"--extra-index-url https://{name[-1]}.example.com/simple" for name in expected[1:] ] if expected[0]: expected_urls = [ f"--index-url https://{expected[0]}.example.com/simple", *expected_urls, ] url_string = "\n".join(expected_urls) expected_content = f"""\ {url_string} bar==4.5.6 ; {MARKER_PY} \\ --hash=sha256:67890 foo==1.2.3 ; {MARKER_PY} \\ --hash=sha256:12345 """ > assert content == expected_content E assert '--extra-inde...ha256:12345\n' == '--extra-inde...ha256:12345\n' E E Skipping 113 identical leading characters in diff, use -v to show E - n_version >= "3.6" and python_version < "4.0" or python_version == "2.7" \ E ? - ^ ^ ^^^ ^ ^ ^ ^^ ^^ ^ ^ E + n_version == "2.7" or python_version >= "3.6" and python_version < "4.0" \ E ? + ^ ^ ^^ ^^ ^ ^ ^^^ ^ ^ ^ E --hash=sha256:67890... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_exporter.py:3175: AssertionError ------------------------------ Captured log setup ------------------------------ WARNING poetry.core.factory:factory.py:63 The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead. =========================== short test summary info ============================ FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes_disabled[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages_and_sorted_hashes[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages_and_markers[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages_and_sorted_hashes[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_file_packages[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any[2.1-False-lines0] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_url_false[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_directory_packages[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_circular_root_dependency[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_without_dev_packages_by_default[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_git_packages[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_directory_packages[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_directory_packages[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any[1.1-True-lines1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_dev_packages_if_opted_in[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_directory_packages[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_legacy_packages_trusted_host[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_legacy_packages[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages_and_hashes_disabled[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_git_packages[2.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_optional_packages[2.1-extras0-lines0] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_legacy_packages[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any[1.1-False-lines0] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_without_optional_packages[1.1] FAILED tests/test_exporter.py::test_exporter_index_urls[1.1-priorities3-expected3] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_to_standard_output[2.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_legacy_packages_and_credentials[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages_cyclic[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_without_optional_packages[2.1] FAILED tests/test_exporter.py::test_exporter_index_urls[1.1-priorities0-expected0] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_two_primary_sources[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_url_false[2.1] FAILED tests/test_exporter.py::test_exporter_omits_and_includes_extras_for_txt_formats[2.1-requirements.txt-expected1] FAILED tests/test_exporter.py::test_exporter_index_urls[1.1-priorities1-expected1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_poetry[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_directory_packages_editable[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_without_dev_packages_by_default[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages_and_markers[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_dev_extras[2.1-True-expected0] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_standard_packages[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_file_packages[1.1] FAILED tests/command/test_command_export.py::test_export_uses_requirements_txt_format_by_default FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_legacy_packages_and_duplicate_sources[2.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_legacy_packages_and_duplicate_sources[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_dev_extras[1.1-False-expected1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages_and_markers_any[2.1-True-lines1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_directory_packages_editable[2.1] FAILED tests/command/test_command_export.py::test_export_groups[--with dev,opt-baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nopt==2.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_legacy_packages_and_credentials[1.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_two_primary_sources[2.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_dev_packages_if_opted_in[2.1] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_circular_root_dependency[2.1] FAILED tests/command/test_command_export.py::test_export_groups[--only main,dev-baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages_cyclic[2.1] FAILED tests/command/test_command_export.py::test_export_groups[--only dev-baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_markers[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_optional_packages[1.1-extras0-lines0] FAILED tests/command/test_command_export.py::test_export_groups[-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_dev_extras[2.1-False-expected1] FAILED tests/test_exporter.py::test_exporter_exports_extra_index_url_and_trusted_host[2.1] FAILED tests/command/test_command_export.py::test_export_includes_extras_by_flag[feature_bar-bar==1.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/command/test_command_export.py::test_export_groups[--with dev-baz==2.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_pyinstaller[1.1] FAILED tests/test_exporter.py::test_exporter_omits_and_includes_extras_for_txt_formats[1.1-requirements.txt-expected1] FAILED tests/command/test_command_export.py::test_export_with_all_extras - as... FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_pyinstaller[2.1] FAILED tests/command/test_command_export.py::test_export_groups[--only main-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_dev_extras[1.1-True-expected0] FAILED tests/test_exporter.py::test_exporter_omits_and_includes_extras_for_txt_formats[1.1-constraints.txt-expected0] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_poetry[1.1] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_to_standard_output[1.1] FAILED tests/command/test_command_export.py::test_export_groups[--without dev-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/test_exporter.py::test_exporter_exports_extra_index_url_and_trusted_host[1.1] FAILED tests/command/test_command_export.py::test_export_prints_to_stdout_by_default FAILED tests/test_exporter.py::test_exporter_prints_warning_for_constraints_txt_with_editable_packages[1.1] FAILED tests/test_exporter.py::test_exporter_index_urls[2.1-priorities2-expected2] FAILED tests/test_exporter.py::test_exporter_exports_requirements_txt_with_legacy_packages_trusted_host[2.1] FAILED tests/test_exporter.py::test_exporter_index_urls[2.1-priorities6-expected6] FAILED tests/test_exporter.py::test_exporter_doesnt_confuse_repeated_packages[1.1] FAILED tests/command/test_command_export.py::test_export_groups[--without opt-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/test_exporter.py::test_exporter_omits_and_includes_extras_for_txt_formats[2.1-constraints.txt-expected0] FAILED tests/test_exporter.py::test_exporter_can_export_requirements_txt_with_nested_packages_and_multiple_markers[2.1] FAILED tests/test_exporter.py::test_exporter_index_urls[1.1-priorities2-expected2] FAILED tests/test_exporter.py::test_exporter_index_urls[2.1-priorities4-expected4] FAILED tests/test_exporter.py::test_exporter_prints_warning_for_constraints_txt_with_editable_packages[2.1] FAILED tests/test_exporter.py::test_exporter_index_urls[2.1-priorities3-expected3] FAILED tests/command/test_command_export.py::test_export_exports_requirements_txt_uses_lock_file FAILED tests/command/test_command_export.py::test_export_includes_extras_by_flag[feature_bar feature_qux-bar==1.1.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nfoo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nqux==1.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/command/test_command_export.py::test_export_groups[--with opt-foo==1.0.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\nopt==2.2.0 ; python_version >= "3.6" and python_version < "4.0" or python_version == "2.7"\n] FAILED tests/test_exporter.py::test_dependency_walk_error[2.1] - assert 'bar=... FAILED tests/command/test_command_export.py::test_export_with_all_groups - as... FAILED tests/test_exporter.py::test_exporter_index_urls[2.1-priorities1-expected1] FAILED tests/test_exporter.py::test_exporter_index_urls[2.1-priorities0-expected0] FAILED tests/test_exporter.py::test_exporter_index_urls[1.1-priorities5-expected5] FAILED tests/test_exporter.py::test_exporter_index_urls[2.1-priorities5-expected5] FAILED tests/test_exporter.py::test_exporter_index_urls[1.1-priorities6-expected6] FAILED tests/command/test_command_export.py::test_export_exports_requirements_txt_file_locks_if_no_lock_file FAILED tests/test_exporter.py::test_exporter_index_urls[1.1-priorities4-expected4] ================== 103 failed, 38 passed in 86.72s (0:01:26) =================== ==> ERROR: A failure occurred in check().  Aborting... ==> ERROR: Build failed, check /var/lib/archbuild/extra-riscv64/felix-2/build [?25h[?25h[?25hreceiving incremental file list python-poetry-plugin-export-1.9.0-1-riscv64-build.log python-poetry-plugin-export-1.9.0-1-riscv64-check.log sent 62 bytes received 22,665 bytes 45,454.00 bytes/sec total size is 388,640 speedup is 17.10