mirror of https://github.com/astral-sh/uv
Use faster test case
This commit is contained in:
parent
5108c1ecd0
commit
190a40cd36
|
|
@ -1533,80 +1533,66 @@ fn sync_build_isolation_fail() -> Result<()> {
|
||||||
let context = TestContext::new("3.12").with_filtered_counts();
|
let context = TestContext::new("3.12").with_filtered_counts();
|
||||||
|
|
||||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||||
pyproject_toml.write_str(
|
pyproject_toml.write_str(indoc! {r#"
|
||||||
r#"
|
|
||||||
[project]
|
[project]
|
||||||
name = "myproject"
|
name = "project"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.9"
|
||||||
dependencies = ["fasttext==0.9.2"]
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools >= 40.9.0"]
|
requires = ["hatchling"]
|
||||||
build-backend = "setuptools.build_meta"
|
backend-path = ["."]
|
||||||
"#,
|
build-backend = "build_backend"
|
||||||
)?;
|
"#})?;
|
||||||
let filters = std::iter::once((r"exit code: 1", "exit status: 1"))
|
let build_backend = context.temp_dir.child("build_backend.py");
|
||||||
.chain(context.filters())
|
build_backend.write_str(indoc! {r#"
|
||||||
.collect::<Vec<_>>();
|
import sys
|
||||||
|
|
||||||
|
from hatchling.build import *
|
||||||
|
|
||||||
|
try:
|
||||||
|
import anyio
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
print("Missing `anyio` module to build package", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
"#})?;
|
||||||
|
context.temp_dir.child("src/project/__init__.py").touch()?;
|
||||||
|
|
||||||
// Running `uv sync` should fail due to missing build-dependencies
|
// Running `uv sync` should fail due to missing build-dependencies
|
||||||
uv_snapshot!(&filters, context.sync(), @r#"
|
uv_snapshot!(context.filters(), context.sync(), @r"
|
||||||
success: false
|
success: false
|
||||||
exit_code: 1
|
exit_code: 1
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
× Failed to build `fasttext==0.9.2`
|
Resolved [N] packages in [TIME]
|
||||||
|
× Failed to build `project @ file://[TEMP_DIR]/`
|
||||||
├─▶ The build backend returned an error
|
├─▶ The build backend returned an error
|
||||||
╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)
|
╰─▶ Call to `build_backend.build_editable` failed (exit status: 1)
|
||||||
|
|
||||||
[stderr]
|
[stderr]
|
||||||
[CACHE_DIR]/builds-v0/[TMP]/python: No module named pip
|
Missing `anyio` module to build package
|
||||||
Traceback (most recent call last):
|
|
||||||
File "<string>", line 38, in __init__
|
|
||||||
ModuleNotFoundError: No module named 'pybind11'
|
|
||||||
|
|
||||||
During handling of the above exception, another exception occurred:
|
|
||||||
|
|
||||||
Traceback (most recent call last):
|
|
||||||
File "<string>", line 14, in <module>
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/build_meta.py", line 325, in get_requires_for_build_wheel
|
|
||||||
return self._get_build_requires(config_settings, requirements=['wheel'])
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/build_meta.py", line 295, in _get_build_requires
|
|
||||||
self.run_setup()
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/build_meta.py", line 487, in run_setup
|
|
||||||
super().run_setup(setup_script=setup_script)
|
|
||||||
File "[CACHE_DIR]/builds-v0/[TMP]/build_meta.py", line 311, in run_setup
|
|
||||||
exec(code, locals())
|
|
||||||
File "<string>", line 72, in <module>
|
|
||||||
File "<string>", line 41, in __init__
|
|
||||||
RuntimeError: pybind11 install failed.
|
|
||||||
|
|
||||||
hint: This usually indicates a problem with the package or the build environment.
|
hint: This usually indicates a problem with the package or the build environment.
|
||||||
help: `fasttext` (v0.9.2) was included because `myproject` (v0.1.0) depends on `fasttext==0.9.2`
|
");
|
||||||
"#);
|
|
||||||
|
|
||||||
// Adding extra-build-dependencies should solve the issue
|
// Adding extra-build-dependencies should solve the issue
|
||||||
pyproject_toml.write_str(
|
pyproject_toml.write_str(indoc! {r#"
|
||||||
r#"
|
|
||||||
[project]
|
[project]
|
||||||
name = "myproject"
|
name = "project"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.9"
|
||||||
dependencies = ["fasttext==0.9.2"]
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["setuptools >= 40.9.0"]
|
requires = ["hatchling"]
|
||||||
build-backend = "setuptools.build_meta"
|
backend-path = ["."]
|
||||||
|
build-backend = "build_backend"
|
||||||
|
|
||||||
[tool.uv.extra-build-dependencies]
|
[tool.uv.extra-build-dependencies]
|
||||||
fasttext = ["setuptools", "wheel", "pybind11"]
|
project = ["anyio"]
|
||||||
"#,
|
"#})?;
|
||||||
)?;
|
|
||||||
|
|
||||||
uv_snapshot!(&filters, context.sync(), @r"
|
uv_snapshot!(context.filters(), context.sync(), @r"
|
||||||
success: true
|
success: true
|
||||||
exit_code: 0
|
exit_code: 0
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
@ -1615,11 +1601,7 @@ fn sync_build_isolation_fail() -> Result<()> {
|
||||||
Resolved [N] packages in [TIME]
|
Resolved [N] packages in [TIME]
|
||||||
Prepared [N] packages in [TIME]
|
Prepared [N] packages in [TIME]
|
||||||
Installed [N] packages in [TIME]
|
Installed [N] packages in [TIME]
|
||||||
+ fasttext==0.9.2
|
+ project==0.1.0 (from file://[TEMP_DIR]/)
|
||||||
+ myproject==0.1.0 (from file://[TEMP_DIR]/)
|
|
||||||
+ numpy==1.26.4
|
|
||||||
+ pybind11==2.11.1
|
|
||||||
+ setuptools==69.2.0
|
|
||||||
");
|
");
|
||||||
|
|
||||||
assert!(context.temp_dir.child("uv.lock").exists());
|
assert!(context.temp_dir.child("uv.lock").exists());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue