diff options
author | David Hewitt <1939362+davidhewitt@users.noreply.github.com> | 2020-07-28 09:16:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-28 09:16:43 +0100 |
commit | f6e60fd51103cae1e5d71f1ed102d2238beaf0fa (patch) | |
tree | 29c56b10fda712c5a321ed3ddcd4a50d3cc92878 /tests | |
parent | 57044567d60490285f7ad319d7baaff59d2752c4 (diff) | |
download | tox-git-f6e60fd51103cae1e5d71f1ed102d2238beaf0fa.tar.gz |
Fix isolated build helper scripts (#1629)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/package/test_package.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/unit/package/test_package.py b/tests/unit/package/test_package.py index fc8da8bc..d546ecc0 100644 --- a/tests/unit/package/test_package.py +++ b/tests/unit/package/test_package.py @@ -1,4 +1,5 @@ import re +import sys from tox.config import parseconfig from tox.package import get_package @@ -106,6 +107,48 @@ def test_make_sdist(initproj): assert sdist_new.stat().size > 10 +def test_build_backend_without_submodule(initproj, cmd): + # The important part of this test is that the build backend + # "inline_backend" is just a base package without a submodule. + # (Regression test for #1344) + initproj( + "magic-0.1", + filedefs={ + "tox.ini": """\ + [tox] + isolated_build = true + [testenv:.package] + basepython = {} + [testenv] + setenv = PYTHONPATH = {{toxinidir}} + """.format( + sys.executable, + ), + "pyproject.toml": """\ + [build-system] + requires = [] + build-backend = "inline_backend" + """, + # To trigger original bug, must be package with __init__.py + "inline_backend": { + "__init__.py": """\ + def get_requires_for_build_sdist(*args, **kwargs): + return ["pathlib2"] + + def build_sdist(sdist_directory, config_settings=None): + import pathlib2 + (pathlib2.Path(sdist_directory) / "magic-0.1.0.tar.gz").touch() + return "magic-0.1.0.tar.gz" + """, + }, + ".gitignore": ".tox", + }, + add_missing_setup_py=False, + ) + result = cmd("--sdistonly", "-e", "py", "-v", "-v") + result.assert_success(is_run_test_env=False) + + def test_package_inject(initproj, cmd, monkeypatch, tmp_path): monkeypatch.delenv(str("PYTHONPATH"), raising=False) initproj( |