Skip to content

Commit dfd6ccf

Browse files
authored
Move maturin test coverage into CI (#3714)
This test can take over 60s to run, which is too much for a unit test. We'll run it in a separate CI job to retain coverage.
1 parent cf99708 commit dfd6ccf

File tree

5 files changed

+60
-42
lines changed

5 files changed

+60
-42
lines changed

.github/workflows/ci.yml

+25
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,31 @@ jobs:
436436
./uv venv
437437
./${{ matrix.command }}
438438
439+
integration-test-maturin:
440+
needs: build-binary-linux
441+
name: "integration test | maturin"
442+
runs-on: ubuntu-latest
443+
steps:
444+
- uses: actions/checkout@v4
445+
- uses: actions/setup-python@v5
446+
447+
- name: "Download binary"
448+
uses: actions/download-artifact@v4
449+
with:
450+
name: uv-linux-${{ github.sha }}
451+
452+
- name: "Prepare binary"
453+
run: chmod +x ./uv
454+
455+
- name: "Compile"
456+
run: |
457+
echo '-e ${PROJECT_ROOT}/scripts/packages/maturin_editable' | ./uv pip compile - -o requirements.txt
458+
459+
- name: "Sync"
460+
run: |
461+
./uv venv
462+
./uv pip sync requirements.txt
463+
439464
cache-test-ubuntu:
440465
needs: build-binary-linux
441466
name: "check cache | ubuntu"

crates/uv/Cargo.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ reqwest = { workspace = true, features = ["blocking"], default-features = false
9090
ignored = ["flate2"]
9191

9292
[features]
93-
default = ["flate2/zlib-ng", "python", "pypi", "git", "maturin", "python-patch"]
93+
default = ["flate2/zlib-ng", "python", "pypi", "git", "python-patch"]
9494
# Introduces a dependency on a local Python installation.
9595
python = []
9696
# Introduces a dependency on a local Python installation with specific patch versions.
@@ -99,8 +99,6 @@ python-patch = []
9999
pypi = []
100100
# Introduces a dependency on Git.
101101
git = []
102-
# Introduces a dependency on Maturin.
103-
maturin = []
104102
# Adds self-update functionality.
105103
self-update = ["axoupdater"]
106104

crates/uv/tests/pip_compile.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -3327,13 +3327,11 @@ fn respect_file_env_var() -> Result<()> {
33273327
}
33283328

33293329
#[test]
3330-
#[cfg(feature = "maturin")]
33313330
fn compile_editable() -> Result<()> {
33323331
let context = TestContext::new("3.12");
33333332
let requirements_in = context.temp_dir.child("requirements.in");
33343333
requirements_in.write_str(indoc! {r"
33353334
-e ../../scripts/packages/poetry_editable
3336-
-e ${PROJECT_ROOT}/../../scripts/packages/maturin_editable
33373335
-e file://../../scripts/packages/black_editable[dev]
33383336
boltons # normal dependency for comparison
33393337
"
@@ -3347,8 +3345,6 @@ fn compile_editable() -> Result<()> {
33473345
----- stdout -----
33483346
# This file was autogenerated by uv via the following command:
33493347
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z [TEMP_DIR]/requirements.in
3350-
-e ${PROJECT_ROOT}/../../scripts/packages/maturin_editable
3351-
# via -r [TEMP_DIR]/requirements.in
33523348
-e ../../scripts/packages/poetry_editable
33533349
# via -r [TEMP_DIR]/requirements.in
33543350
-e file://../../scripts/packages/black_editable
@@ -3383,8 +3379,8 @@ fn compile_editable() -> Result<()> {
33833379
# via aiohttp
33843380
33853381
----- stderr -----
3386-
Built 3 editables in [TIME]
3387-
Resolved 14 packages in [TIME]
3382+
Built 2 editables in [TIME]
3383+
Resolved 13 packages in [TIME]
33883384
"###);
33893385

33903386
Ok(())

crates/uv/tests/pip_sync.rs

+31-32
Original file line numberDiff line numberDiff line change
@@ -2123,19 +2123,25 @@ fn refresh_package() -> Result<()> {
21232123
}
21242124

21252125
#[test]
2126-
#[cfg(feature = "maturin")]
21272126
fn sync_editable() -> Result<()> {
21282127
let context = TestContext::new("3.12");
2128+
let poetry_editable = context.temp_dir.child("poetry_editable");
2129+
// Copy into the temporary directory so we can mutate it
2130+
copy_dir_all(
2131+
context
2132+
.workspace_root
2133+
.join("scripts/packages/poetry_editable"),
2134+
&poetry_editable,
2135+
)?;
21292136

21302137
let requirements_txt = context.temp_dir.child("requirements.txt");
21312138
requirements_txt.write_str(&indoc::formatdoc! {r"
21322139
boltons==23.1.1
2133-
-e {workspace_root}/scripts/packages/maturin_editable
21342140
numpy==1.26.2
21352141
# via poetry-editable
2136-
-e file://{workspace_root}/scripts/packages/poetry_editable
2142+
-e file://{poetry_editable}
21372143
",
2138-
workspace_root = context.workspace_root.simplified_display(),
2144+
poetry_editable = poetry_editable.display()
21392145
})?;
21402146

21412147
// Install the editable packages.
@@ -2146,14 +2152,13 @@ fn sync_editable() -> Result<()> {
21462152
----- stdout -----
21472153
21482154
----- stderr -----
2149-
Built 2 editables in [TIME]
2155+
Built 1 editable in [TIME]
21502156
Resolved 2 packages in [TIME]
21512157
Downloaded 2 packages in [TIME]
2152-
Installed 4 packages in [TIME]
2158+
Installed 3 packages in [TIME]
21532159
+ boltons==23.1.1
2154-
+ maturin-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/maturin_editable)
21552160
+ numpy==1.26.2
2156-
+ poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable)
2161+
+ poetry-editable==0.1.0 (from file://[TEMP_DIR]/poetry_editable)
21572162
"###
21582163
);
21592164

@@ -2170,58 +2175,52 @@ fn sync_editable() -> Result<()> {
21702175
Built 1 editable in [TIME]
21712176
Uninstalled 1 package in [TIME]
21722177
Installed 1 package in [TIME]
2173-
- poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable)
2174-
+ poetry-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/poetry_editable)
2178+
- poetry-editable==0.1.0 (from file://[TEMP_DIR]/poetry_editable)
2179+
+ poetry-editable==0.1.0 (from file://[TEMP_DIR]/poetry_editable)
21752180
"###
21762181
);
21772182

2178-
// Make sure we have the right base case.
2179-
let python_source_file = context
2180-
.workspace_root
2181-
.join("scripts/packages/maturin_editable/python/maturin_editable/__init__.py");
2182-
let python_version_1 = indoc::indoc! {r"
2183-
from .maturin_editable import *
2183+
let python_source_file = poetry_editable.path().join("poetry_editable/__init__.py");
2184+
let check_installed = indoc::indoc! {r#"
2185+
from poetry_editable import a
2186+
2187+
assert a() == "a", a()
2188+
"#};
2189+
context.assert_command(check_installed).success();
21842190

2191+
// Edit the sources and make sure the changes are respected without syncing again
2192+
let python_version_1 = indoc::indoc! {r"
21852193
version = 1
21862194
"};
21872195
fs_err::write(&python_source_file, python_version_1)?;
21882196

2189-
let check_installed = indoc::indoc! {r#"
2190-
from maturin_editable import sum_as_string, version
2197+
let check_installed = indoc::indoc! {r"
2198+
from poetry_editable import version
21912199
21922200
assert version == 1, version
2193-
assert sum_as_string(1, 2) == "3", sum_as_string(1, 2)
2194-
"#};
2201+
"};
21952202
context.assert_command(check_installed).success();
21962203

2197-
// Edit the sources.
21982204
let python_version_2 = indoc::indoc! {r"
2199-
from .maturin_editable import *
2200-
22012205
version = 2
22022206
"};
22032207
fs_err::write(&python_source_file, python_version_2)?;
22042208

2205-
let check_installed = indoc::indoc! {r#"
2206-
from maturin_editable import sum_as_string, version
2207-
from pathlib import Path
2209+
let check_installed = indoc::indoc! {r"
2210+
from poetry_editable import version
22082211
22092212
assert version == 2, version
2210-
assert sum_as_string(1, 2) == "3", sum_as_string(1, 2)
2211-
"#};
2213+
"};
22122214
context.assert_command(check_installed).success();
22132215

2214-
// Don't create a git diff.
2215-
fs_err::write(&python_source_file, python_version_1)?;
2216-
22172216
uv_snapshot!(context.filters(), command(&context)
22182217
.arg(requirements_txt.path()), @r###"
22192218
success: true
22202219
exit_code: 0
22212220
----- stdout -----
22222221
22232222
----- stderr -----
2224-
Audited 4 packages in [TIME]
2223+
Audited 3 packages in [TIME]
22252224
"###
22262225
);
22272226

Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
def a():
2-
pass
2+
return "a"

0 commit comments

Comments
 (0)