@@ -2123,19 +2123,25 @@ fn refresh_package() -> Result<()> {
2123
2123
}
2124
2124
2125
2125
#[ test]
2126
- #[ cfg( feature = "maturin" ) ]
2127
2126
fn sync_editable ( ) -> Result < ( ) > {
2128
2127
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
+ ) ?;
2129
2136
2130
2137
let requirements_txt = context. temp_dir . child ( "requirements.txt" ) ;
2131
2138
requirements_txt. write_str ( & indoc:: formatdoc! { r"
2132
2139
boltons==23.1.1
2133
- -e {workspace_root}/scripts/packages/maturin_editable
2134
2140
numpy==1.26.2
2135
2141
# via poetry-editable
2136
- -e file://{workspace_root}/scripts/packages/ poetry_editable
2142
+ -e file://{poetry_editable}
2137
2143
" ,
2138
- workspace_root = context . workspace_root . simplified_display ( ) ,
2144
+ poetry_editable = poetry_editable . display ( )
2139
2145
} ) ?;
2140
2146
2141
2147
// Install the editable packages.
@@ -2146,14 +2152,13 @@ fn sync_editable() -> Result<()> {
2146
2152
----- stdout -----
2147
2153
2148
2154
----- stderr -----
2149
- Built 2 editables in [TIME]
2155
+ Built 1 editable in [TIME]
2150
2156
Resolved 2 packages in [TIME]
2151
2157
Downloaded 2 packages in [TIME]
2152
- Installed 4 packages in [TIME]
2158
+ Installed 3 packages in [TIME]
2153
2159
+ boltons==23.1.1
2154
- + maturin-editable==0.1.0 (from file://[WORKSPACE]/scripts/packages/maturin_editable)
2155
2160
+ 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)
2157
2162
"###
2158
2163
) ;
2159
2164
@@ -2170,58 +2175,52 @@ fn sync_editable() -> Result<()> {
2170
2175
Built 1 editable in [TIME]
2171
2176
Uninstalled 1 package in [TIME]
2172
2177
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)
2175
2180
"###
2176
2181
) ;
2177
2182
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 ( ) ;
2184
2190
2191
+ // Edit the sources and make sure the changes are respected without syncing again
2192
+ let python_version_1 = indoc:: indoc! { r"
2185
2193
version = 1
2186
2194
" } ;
2187
2195
fs_err:: write ( & python_source_file, python_version_1) ?;
2188
2196
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
2191
2199
2192
2200
assert version == 1, version
2193
- assert sum_as_string(1, 2) == "3", sum_as_string(1, 2)
2194
- "# } ;
2201
+ " } ;
2195
2202
context. assert_command ( check_installed) . success ( ) ;
2196
2203
2197
- // Edit the sources.
2198
2204
let python_version_2 = indoc:: indoc! { r"
2199
- from .maturin_editable import *
2200
-
2201
2205
version = 2
2202
2206
" } ;
2203
2207
fs_err:: write ( & python_source_file, python_version_2) ?;
2204
2208
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
2208
2211
2209
2212
assert version == 2, version
2210
- assert sum_as_string(1, 2) == "3", sum_as_string(1, 2)
2211
- "# } ;
2213
+ " } ;
2212
2214
context. assert_command ( check_installed) . success ( ) ;
2213
2215
2214
- // Don't create a git diff.
2215
- fs_err:: write ( & python_source_file, python_version_1) ?;
2216
-
2217
2216
uv_snapshot ! ( context. filters( ) , command( & context)
2218
2217
. arg( requirements_txt. path( ) ) , @r###"
2219
2218
success: true
2220
2219
exit_code: 0
2221
2220
----- stdout -----
2222
2221
2223
2222
----- stderr -----
2224
- Audited 4 packages in [TIME]
2223
+ Audited 3 packages in [TIME]
2225
2224
"###
2226
2225
) ;
2227
2226
0 commit comments