|
1 | 1 | import re
|
| 2 | +import sys |
2 | 3 |
|
3 | 4 | from tox.config import parseconfig
|
4 | 5 | from tox.package import get_package
|
@@ -106,6 +107,48 @@ def test_make_sdist(initproj):
|
106 | 107 | assert sdist_new.stat().size > 10
|
107 | 108 |
|
108 | 109 |
|
| 110 | +def test_build_backend_without_submodule(initproj, cmd): |
| 111 | + # The important part of this test is that the build backend |
| 112 | + # "inline_backend" is just a base package without a submodule. |
| 113 | + # (Regression test for #1344) |
| 114 | + initproj( |
| 115 | + "magic-0.1", |
| 116 | + filedefs={ |
| 117 | + "tox.ini": """\ |
| 118 | + [tox] |
| 119 | + isolated_build = true |
| 120 | + [testenv:.package] |
| 121 | + basepython = {} |
| 122 | + [testenv] |
| 123 | + setenv = PYTHONPATH = {{toxinidir}} |
| 124 | + """.format( |
| 125 | + sys.executable, |
| 126 | + ), |
| 127 | + "pyproject.toml": """\ |
| 128 | + [build-system] |
| 129 | + requires = [] |
| 130 | + build-backend = "inline_backend" |
| 131 | + """, |
| 132 | + # To trigger original bug, must be package with __init__.py |
| 133 | + "inline_backend": { |
| 134 | + "__init__.py": """\ |
| 135 | + def get_requires_for_build_sdist(*args, **kwargs): |
| 136 | + return ["pathlib2"] |
| 137 | +
|
| 138 | + def build_sdist(sdist_directory, config_settings=None): |
| 139 | + import pathlib2 |
| 140 | + (pathlib2.Path(sdist_directory) / "magic-0.1.0.tar.gz").touch() |
| 141 | + return "magic-0.1.0.tar.gz" |
| 142 | + """, |
| 143 | + }, |
| 144 | + ".gitignore": ".tox", |
| 145 | + }, |
| 146 | + add_missing_setup_py=False, |
| 147 | + ) |
| 148 | + result = cmd("--sdistonly", "-e", "py", "-v", "-v") |
| 149 | + result.assert_success(is_run_test_env=False) |
| 150 | + |
| 151 | + |
109 | 152 | def test_package_inject(initproj, cmd, monkeypatch, tmp_path):
|
110 | 153 | monkeypatch.delenv(str("PYTHONPATH"), raising=False)
|
111 | 154 | initproj(
|
|
0 commit comments