fastws-cli 0.0.35__tar.gz → 0.0.36__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastws_cli-0.0.35/fastws_cli.egg-info → fastws_cli-0.0.36}/PKG-INFO +9 -3
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/README.md +8 -2
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/__init__.py +2 -1
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/cargo.py +59 -21
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/core.py +15 -17
- {fastws_cli-0.0.35 → fastws_cli-0.0.36/fastws_cli.egg-info}/PKG-INFO +9 -3
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_build.py +35 -6
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_integrate.py +6 -1
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_sync.py +5 -1
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/LICENSE +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/_toml.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/build_backend.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/integrate.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/news.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/procs.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/releases.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/store.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws/timelock.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws_cli.egg-info/SOURCES.txt +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws_cli.egg-info/dependency_links.txt +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws_cli.egg-info/entry_points.txt +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws_cli.egg-info/requires.txt +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/fastws_cli.egg-info/top_level.txt +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/pyproject.toml +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/setup.cfg +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_build_backend.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_news.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_procs.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_releases.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_setup.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_store.py +0 -0
- {fastws_cli-0.0.35 → fastws_cli-0.0.36}/tests/test_timelock.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastws-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.36
|
|
4
4
|
Summary: Fast workspace tools for multi-repo management
|
|
5
5
|
Author: Jeremy Howard
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -210,6 +210,12 @@ cargo develop --profile quick
|
|
|
210
210
|
|
|
211
211
|
Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path` and features from `[tool.maturin]`. `[tool.fastws] dev-profile = "quick"` selects a project's default for both `cargo develop` and `fastws.cargo.run_tests`. Without that setting they use `test`. An explicit `--profile NAME` overrides the project default. The project must produce a `cdylib` and set `python-source`. Define the selected profile in `Cargo.toml` and keep incremental compilation enabled for the local crate.
|
|
212
212
|
|
|
213
|
+
The workspace's `[tool.fastws] cargo = "/path/to/cargo"` optionally selects one explicit Cargo executable for fastws builds, checks, metadata and tests, including nextest's subordinate Cargo calls. A missing executable fails without falling back. With no selection, subprocess uses its normal PATH and working-directory rules. Upstream Cargo stays installed and usable; manifests, profiles, features and package selection are unchanged.
|
|
214
|
+
|
|
215
|
+
Optional workspace `cargo-target-dir` passes through Cargo's `CARGO_TARGET_DIR`. The path is absolute or relative to the fastws workspace; explicit caller/environment values win. Cargo's own `[unstable] root-dir` sets the actual common parent of local source repositories. Enable it with `fastws.core.cargo_setup(workspace, root_dir=True)`; later setup calls and integration snapshots keep it at their actual root, including sibling repositories. Cargo command-line/environment overrides keep their normal precedence. Sharing path-crate artifacts needs a Cargo that uses this root for metadata and source paths and tracks manifest-path dependencies: ordinary Cargo's `-Zroot-dir` alone is insufficient. A source root is not a virtual alias for another checkout.
|
|
216
|
+
|
|
217
|
+
Set `FASTWS_CARGO_LOG` to a file to append the raw Cargo output already captured by builds, checks and test-compilation/listing calls; no log is created by default.
|
|
218
|
+
|
|
213
219
|
Make the initial editable installation through `ws-sync` or maturin. Repeat that installation when package metadata or entry points change. Running Python processes keep the extension they loaded.
|
|
214
220
|
|
|
215
221
|
Cargo must already build a loadable Python extension. For PyO3 extension-module builds on macOS, configure the linker in `build.rs` with `pyo3_build_config::add_extension_module_link_args()`. This command does not inject maturin's extra compiler flags.
|
|
@@ -258,7 +264,7 @@ Use it when another process's unfinished edits stop the workspace compiling, suc
|
|
|
258
264
|
|
|
259
265
|
`fastws.cargo.run_tests` builds native tests once with Cargo, without a time limit, then runs the executables that Cargo reports directly from their package directories. Each binary gets its own `timeout`, 30 seconds by default, excluding compilation. Outside `FASTWS_JOB`, a timed-out binary is reported as a failed suite with `timed_out` set. Inside a marked job, its timeout raises so the job owner can clean up descendants. Source edits between building and running do not trigger another build: the results describe the compiled build, not necessarily the latest working tree. It supports directly runnable native tests, not cross-target runners.
|
|
260
266
|
|
|
261
|
-
Where a root has `.config/nextest.toml`, `cargo nextest
|
|
267
|
+
Where a root has `.config/nextest.toml`, preparation uses `cargo nextest list` to build the tests and capture Cargo and binary metadata. The metadata graph includes all features at the native platform, independently of the features selected for compilation. Each `cargo nextest run` consumes that metadata without building or waiting for Cargo's target lock. Nextest runs each test in its own process, every binary at once, with the config's slow-test timeouts and groups. `profiles` lists the nextest profiles to run one after another, `('default',)` unless given. `timeout` bounds each profile's execution, and each binary's results come from nextest's JUnit report, which lists no ignored tests. `--profile NAME` passes to the build as `--cargo-profile NAME`, and `test_args` follow `--`.
|
|
262
268
|
|
|
263
269
|
`root` can also be a list of roots, which build one after another. Roots without nextest then run their binaries in turn. Each profile then runs at the same time in every root whose config defines it: tests in different roots share a phase, and no phase starts before the previous one ends. Suite names start with the root's directory name, and with several profiles also with the profile, as in `app timed: tests/speed.rs`. A failure ends the run after its profile unless `--no-fail-fast` is given.
|
|
264
270
|
|
|
@@ -341,7 +347,7 @@ After `uv sync`, fastws runs `cargo develop` in each mixed Rust/Python project.
|
|
|
341
347
|
|
|
342
348
|
Fastws then runs `<tool> install` at the workspace root. It runs `<tool> run build` in each JavaScript package containing both `Cargo.toml` and a `build` script. Cargo handles incremental compilation. Other build steps still run.
|
|
343
349
|
|
|
344
|
-
For npm, sync hides
|
|
350
|
+
For npm, sync hides successful install output and build-command banners. Installs use error-only logging, so npm warnings are hidden while errors and failure output remain visible. Run `npm audit` at the workspace root to inspect audit findings. Build scripts retain their own output; configure their tools to suppress routine progress. Other package managers retain their normal output.
|
|
345
351
|
|
|
346
352
|
When Rust-backed JavaScript builds are present, fastws checks before dependency installation that `rustc` and `cargo` on `PATH` are rustup's proxies. Install rustup from https://rustup.rs and select a stable toolchain with `rustup default stable` if not already configured. If another Rust installation shadows rustup, put its bin directory first on `PATH` after Homebrew's shell setup: `export PATH="$HOME/.cargo/bin:$PATH"` (use `$CARGO_HOME/bin` for a custom Cargo home), then open a new shell. Homebrew Rust can remain installed for Homebrew's own use. Fastws reports missing or shadowed rustup without changing your shell or installing a different toolchain. Packages using wasm-pack can then install their WASM target and matching binding tools automatically as part of their build.
|
|
347
353
|
|
|
@@ -182,6 +182,12 @@ cargo develop --profile quick
|
|
|
182
182
|
|
|
183
183
|
Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path` and features from `[tool.maturin]`. `[tool.fastws] dev-profile = "quick"` selects a project's default for both `cargo develop` and `fastws.cargo.run_tests`. Without that setting they use `test`. An explicit `--profile NAME` overrides the project default. The project must produce a `cdylib` and set `python-source`. Define the selected profile in `Cargo.toml` and keep incremental compilation enabled for the local crate.
|
|
184
184
|
|
|
185
|
+
The workspace's `[tool.fastws] cargo = "/path/to/cargo"` optionally selects one explicit Cargo executable for fastws builds, checks, metadata and tests, including nextest's subordinate Cargo calls. A missing executable fails without falling back. With no selection, subprocess uses its normal PATH and working-directory rules. Upstream Cargo stays installed and usable; manifests, profiles, features and package selection are unchanged.
|
|
186
|
+
|
|
187
|
+
Optional workspace `cargo-target-dir` passes through Cargo's `CARGO_TARGET_DIR`. The path is absolute or relative to the fastws workspace; explicit caller/environment values win. Cargo's own `[unstable] root-dir` sets the actual common parent of local source repositories. Enable it with `fastws.core.cargo_setup(workspace, root_dir=True)`; later setup calls and integration snapshots keep it at their actual root, including sibling repositories. Cargo command-line/environment overrides keep their normal precedence. Sharing path-crate artifacts needs a Cargo that uses this root for metadata and source paths and tracks manifest-path dependencies: ordinary Cargo's `-Zroot-dir` alone is insufficient. A source root is not a virtual alias for another checkout.
|
|
188
|
+
|
|
189
|
+
Set `FASTWS_CARGO_LOG` to a file to append the raw Cargo output already captured by builds, checks and test-compilation/listing calls; no log is created by default.
|
|
190
|
+
|
|
185
191
|
Make the initial editable installation through `ws-sync` or maturin. Repeat that installation when package metadata or entry points change. Running Python processes keep the extension they loaded.
|
|
186
192
|
|
|
187
193
|
Cargo must already build a loadable Python extension. For PyO3 extension-module builds on macOS, configure the linker in `build.rs` with `pyo3_build_config::add_extension_module_link_args()`. This command does not inject maturin's extra compiler flags.
|
|
@@ -230,7 +236,7 @@ Use it when another process's unfinished edits stop the workspace compiling, suc
|
|
|
230
236
|
|
|
231
237
|
`fastws.cargo.run_tests` builds native tests once with Cargo, without a time limit, then runs the executables that Cargo reports directly from their package directories. Each binary gets its own `timeout`, 30 seconds by default, excluding compilation. Outside `FASTWS_JOB`, a timed-out binary is reported as a failed suite with `timed_out` set. Inside a marked job, its timeout raises so the job owner can clean up descendants. Source edits between building and running do not trigger another build: the results describe the compiled build, not necessarily the latest working tree. It supports directly runnable native tests, not cross-target runners.
|
|
232
238
|
|
|
233
|
-
Where a root has `.config/nextest.toml`, `cargo nextest
|
|
239
|
+
Where a root has `.config/nextest.toml`, preparation uses `cargo nextest list` to build the tests and capture Cargo and binary metadata. The metadata graph includes all features at the native platform, independently of the features selected for compilation. Each `cargo nextest run` consumes that metadata without building or waiting for Cargo's target lock. Nextest runs each test in its own process, every binary at once, with the config's slow-test timeouts and groups. `profiles` lists the nextest profiles to run one after another, `('default',)` unless given. `timeout` bounds each profile's execution, and each binary's results come from nextest's JUnit report, which lists no ignored tests. `--profile NAME` passes to the build as `--cargo-profile NAME`, and `test_args` follow `--`.
|
|
234
240
|
|
|
235
241
|
`root` can also be a list of roots, which build one after another. Roots without nextest then run their binaries in turn. Each profile then runs at the same time in every root whose config defines it: tests in different roots share a phase, and no phase starts before the previous one ends. Suite names start with the root's directory name, and with several profiles also with the profile, as in `app timed: tests/speed.rs`. A failure ends the run after its profile unless `--no-fail-fast` is given.
|
|
236
242
|
|
|
@@ -313,7 +319,7 @@ After `uv sync`, fastws runs `cargo develop` in each mixed Rust/Python project.
|
|
|
313
319
|
|
|
314
320
|
Fastws then runs `<tool> install` at the workspace root. It runs `<tool> run build` in each JavaScript package containing both `Cargo.toml` and a `build` script. Cargo handles incremental compilation. Other build steps still run.
|
|
315
321
|
|
|
316
|
-
For npm, sync hides
|
|
322
|
+
For npm, sync hides successful install output and build-command banners. Installs use error-only logging, so npm warnings are hidden while errors and failure output remain visible. Run `npm audit` at the workspace root to inspect audit findings. Build scripts retain their own output; configure their tools to suppress routine progress. Other package managers retain their normal output.
|
|
317
323
|
|
|
318
324
|
When Rust-backed JavaScript builds are present, fastws checks before dependency installation that `rustc` and `cargo` on `PATH` are rustup's proxies. Install rustup from https://rustup.rs and select a stable toolchain with `rustup default stable` if not already configured. If another Rust installation shadows rustup, put its bin directory first on `PATH` after Homebrew's shell setup: `export PATH="$HOME/.cargo/bin:$PATH"` (use `$CARGO_HOME/bin` for a custom Cargo home), then open a new shell. Homebrew Rust can remain installed for Homebrew's own use. Fastws reports missing or shadowed rustup without changing your shell or installing a different toolchain. Packages using wasm-pack can then install their WASM target and matching binding tools automatically as part of their build.
|
|
319
325
|
|
|
@@ -24,9 +24,21 @@ def _dev_profile(root):
|
|
|
24
24
|
return settings(root).get('fastws', {}).get('dev-profile', 'test') if (root/'pyproject.toml').exists() else 'test'
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
def
|
|
27
|
+
def _cargo_command(*args, env=None):
|
|
28
|
+
"One Cargo and optional shared paths for every launch, including nextest's subordinate Cargo calls."
|
|
29
|
+
from .core import _fastws_cfg, _ws_root
|
|
30
|
+
environment = os.environ | (env or {})
|
|
31
|
+
workspace = _ws_root()
|
|
32
|
+
cfg = _fastws_cfg(workspace)
|
|
33
|
+
configured = cfg.get('cargo')
|
|
34
|
+
executable = str(workspace/Path(configured).expanduser()) if configured else 'cargo'
|
|
35
|
+
if 'cargo-target-dir' in cfg: environment.setdefault('CARGO_TARGET_DIR', str(workspace/Path(cfg['cargo-target-dir']).expanduser()))
|
|
36
|
+
return [executable, *args], environment | {'CARGO': executable}
|
|
37
|
+
|
|
38
|
+
def cargo(root, *args, env=None):
|
|
28
39
|
"Run Cargo in the project and return its standard output. A failure raises `CalledProcessError`, holding Cargo's standard error."
|
|
29
|
-
|
|
40
|
+
cmd, env = _cargo_command(*args, env=env)
|
|
41
|
+
return subprocess.run(cmd, cwd=Path(root).expanduser(), env=env, text=True, capture_output=True, check=True).stdout
|
|
30
42
|
|
|
31
43
|
|
|
32
44
|
def members(root):
|
|
@@ -47,19 +59,25 @@ class Diagnostic(NamedTuple):
|
|
|
47
59
|
|
|
48
60
|
def _run(root, args, env=None, diagnostics=True):
|
|
49
61
|
"Run the Cargo subcommand and options `args` in `root`, with the environment variables `env` set: its exit status, its output, each `Diagnostic` once, and Cargo's other JSON messages, such as artifacts. With `diagnostics`, Cargo writes JSON messages and the output renders each compiler message short; without, the output is as Cargo printed it."
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
62
|
+
nextest = args[0] == 'nextest'
|
|
63
|
+
flags = (('--cargo-message-format=json,json-diagnostic-short' if nextest else '--message-format=json-diagnostic-short'),) if diagnostics else ()
|
|
64
|
+
at = 2 if nextest else 1
|
|
65
|
+
cmd, env = _cargo_command(*args[:at], *flags, *args[at:], env=env)
|
|
66
|
+
# nextest's final JSON can lack a newline; stderr must not join its records.
|
|
67
|
+
p = bounded(cmd, seconds=None, merge=False, cwd=root, env=env)
|
|
68
|
+
if log := env.get('FASTWS_CARGO_LOG'):
|
|
69
|
+
with Path(log).expanduser().open('a') as capture: capture.write(p.stdout + '\n' + p.stderr)
|
|
70
|
+
if not diagnostics: return p.returncode, p.stdout + p.stderr, [], []
|
|
53
71
|
text, found, rest = [], [], []
|
|
54
72
|
for line in p.stdout.splitlines(keepends=True):
|
|
55
73
|
if not line.startswith('{'): text.append(line); continue
|
|
56
74
|
m = json.loads(line)
|
|
57
|
-
if m
|
|
75
|
+
if m.get('reason') != 'compiler-message': rest.append(m); continue
|
|
58
76
|
msg = m['message']
|
|
59
77
|
text.append(msg['rendered'])
|
|
60
78
|
if s := next((s for s in msg['spans'] if s['is_primary']), None):
|
|
61
79
|
found.append(Diagnostic(s['file_name'], s['line_start'], s['column_start'], msg['level'], msg['message'], (msg['code'] or {}).get('code')))
|
|
62
|
-
return p.returncode, ''.join(text), list(dict.fromkeys(found)), rest
|
|
80
|
+
return p.returncode, ''.join(text) + p.stderr, list(dict.fromkeys(found)), rest
|
|
63
81
|
|
|
64
82
|
|
|
65
83
|
def _lines(text, n=20, tail=False):
|
|
@@ -181,17 +199,23 @@ def _junit(path, names):
|
|
|
181
199
|
return suites
|
|
182
200
|
|
|
183
201
|
|
|
184
|
-
def _nextest(root, args, test_args, env, timeout, artifacts, profile='default'):
|
|
185
|
-
"Run
|
|
186
|
-
|
|
202
|
+
def _nextest(root, args, test_args, env, timeout, artifacts, reuse, profile='default'):
|
|
203
|
+
"Run captured test binaries without entering Cargo's build phase, under the profile's execution timeout."
|
|
204
|
+
metadata, binaries = reuse
|
|
205
|
+
packages = {p['id']: p['name'] for p in metadata['packages']}
|
|
187
206
|
names = {_binary_id(m, packages): _suite_name(m) for m in artifacts}
|
|
188
|
-
args = [re.sub(r'^--profile(?==|$)', '--cargo-profile', a) for a in map(str, args)]
|
|
189
207
|
with tempfile.TemporaryDirectory() as d:
|
|
190
208
|
report, tool = Path(d)/'junit.xml', Path(d)/'fastws.toml'
|
|
209
|
+
cargo_meta, binary_meta = Path(d)/'cargo.json', Path(d)/'binaries.json'
|
|
210
|
+
cargo_meta.write_text(json.dumps(metadata))
|
|
211
|
+
binary_meta.write_text(json.dumps(binaries))
|
|
191
212
|
tool.write_text(f'[profile.{profile}.junit]\npath = {json.dumps(str(report))}\n')
|
|
192
|
-
|
|
213
|
+
flags = ('--no-fail-fast',) if '--no-fail-fast' in args else ()
|
|
214
|
+
cmd, env = _cargo_command('nextest', 'run', '--cargo-metadata', cargo_meta, '--binaries-metadata', binary_meta,
|
|
215
|
+
'--tool-config-file', f'fastws:{tool}', '--profile', profile, '--show-progress=none', '--color=never', *flags,
|
|
216
|
+
*(('--', *test_args) if test_args else ()), env=env)
|
|
193
217
|
start = time.monotonic()
|
|
194
|
-
p, late = _bounded(cmd, timeout, cwd=root, env=
|
|
218
|
+
p, late = _bounded(cmd, timeout, cwd=root, env=env)
|
|
195
219
|
suites = _junit(report, names) if report.exists() else [Suite('nextest', p.stdout, {}, {}, '', True, late)]
|
|
196
220
|
return p.returncode, p.stdout, suites, time.monotonic() - start
|
|
197
221
|
|
|
@@ -231,26 +255,37 @@ def run_tests(
|
|
|
231
255
|
text, found, built = '', [], []
|
|
232
256
|
for r in roots:
|
|
233
257
|
rargs = args if has_profile else (*args, '--profile', _dev_profile(r))
|
|
234
|
-
|
|
258
|
+
defined, reuse = _nextest_profiles(r), None
|
|
259
|
+
if defined is None: code, out, diags, rest = _run(r, ('test', '--no-run', *rargs), env)
|
|
260
|
+
else:
|
|
261
|
+
flags = [re.sub(r'^--profile(?==|$)', '--cargo-profile', str(a)) for a in rargs if a != '--no-fail-fast']
|
|
262
|
+
code, out, diags, rest = _run(r, ('nextest', 'list', '--list-type=binaries-only', '--message-format=json', '--ignore-default-filter', *flags), env)
|
|
263
|
+
if not code:
|
|
264
|
+
binaries, = (m for m in rest if 'reason' not in m)
|
|
265
|
+
host = binaries['rust-build-meta']['platforms']['host']['platform']['triple']
|
|
266
|
+
# Package filters use nextest's all-feature graph, not the features selected for compilation.
|
|
267
|
+
try: metadata = json.loads(cargo(r, 'metadata', '--format-version', '1', '--all-features', '--filter-platform', host, env=env))
|
|
268
|
+
except subprocess.CalledProcessError as e: return Results('test', e.returncode, text + out + e.stderr, found + diags)
|
|
269
|
+
reuse = metadata, binaries
|
|
235
270
|
text, found = text + out, found + diags
|
|
236
271
|
if code: return Results('test', code, text, found)
|
|
237
|
-
artifacts = [m for m in rest if m
|
|
238
|
-
built.append((r, rargs, artifacts,
|
|
272
|
+
artifacts = [m for m in rest if m.get('reason') == 'compiler-artifact' and m['profile']['test'] and m.get('executable')]
|
|
273
|
+
built.append((r, rargs, artifacts, defined, reuse))
|
|
239
274
|
def named(r, p, suites):
|
|
240
275
|
"`suites`, freshly read, renamed for root `r` and profile `p` where several roots or profiles ran"
|
|
241
276
|
t = ' '.join(x for x in (r.name if len(roots) > 1 else '', p if p and len(profiles) > 1 else '') if x)
|
|
242
277
|
for s in suites: s.name = f'{t}: {s.name}' if t else s.name
|
|
243
278
|
return t, suites
|
|
244
279
|
fail_fast, code, suites, start = '--no-fail-fast' not in args, 0, [], time.monotonic()
|
|
245
|
-
for r, rargs, artifacts, defined in built:
|
|
280
|
+
for r, rargs, artifacts, defined, reuse in built:
|
|
246
281
|
if defined is not None: continue
|
|
247
282
|
c, out, ss = _libtest(r, rargs, test_args, env, timeout, artifacts)
|
|
248
283
|
text, suites, code = text + out, suites + named(r, None, ss)[1], code or c
|
|
249
284
|
if code and fail_fast: return Results('test', code, text, found, suites, time.monotonic() - start)
|
|
250
285
|
for p in profiles:
|
|
251
|
-
jobs = [(r, rargs, artifacts) for r, rargs, artifacts, defined in built if p in (defined or ())]
|
|
252
|
-
with ThreadPoolExecutor(max(len(jobs), 1)) as ex: runs = list(ex.map(lambda j: _nextest(j[0], j[1], test_args, env, timeout, j[2], p), jobs))
|
|
253
|
-
for (r, _, _), (c, out, ss, _) in zip(jobs, runs):
|
|
286
|
+
jobs = [(r, rargs, artifacts, reuse) for r, rargs, artifacts, defined, reuse in built if p in (defined or ())]
|
|
287
|
+
with ThreadPoolExecutor(max(len(jobs), 1)) as ex: runs = list(ex.map(lambda j: _nextest(j[0], j[1], test_args, env, timeout, j[2], j[3], p), jobs))
|
|
288
|
+
for (r, _, _, _), (c, out, ss, _) in zip(jobs, runs):
|
|
254
289
|
t, ss = named(r, p, ss)
|
|
255
290
|
text, suites, code = text + (f' Nextest profile {p} in {r}\n' if t else '') + out, suites + ss, code or c
|
|
256
291
|
if code and fail_fast: break
|
|
@@ -311,7 +346,10 @@ def build(
|
|
|
311
346
|
for flag, active in [('all-features', all_features), ('no-default-features', no_default_features)]:
|
|
312
347
|
if active or cfg.get(flag): cmd.append('--' + flag)
|
|
313
348
|
extra, env = _maturin_flags(target, os.environ) if for_maturin else ([], None)
|
|
314
|
-
|
|
349
|
+
cmd, env = _cargo_command(*cmd, *extra, env=env)
|
|
350
|
+
result = subprocess.run(cmd, cwd=root, stdout=subprocess.PIPE, text=True, env=env)
|
|
351
|
+
if log := env.get('FASTWS_CARGO_LOG'):
|
|
352
|
+
with Path(log).expanduser().open('a') as capture: capture.write(result.stdout)
|
|
315
353
|
messages = [json.loads(line) for line in result.stdout.splitlines()]
|
|
316
354
|
for m in messages:
|
|
317
355
|
if m.get('reason') != 'compiler-message': continue
|
|
@@ -265,9 +265,9 @@ def _replace_array(content: str, table: str, key: str, values: list[str]) -> str
|
|
|
265
265
|
return content[:start] + section + content[end:]
|
|
266
266
|
|
|
267
267
|
def _table_span(content: str, name: str) -> tuple[int,int]|None:
|
|
268
|
-
m = re.search(rf"(?m)
|
|
268
|
+
m = re.search(rf"(?m)^[ \t]*\[{re.escape(name)}\][ \t]*(?:#[^\r\n]*)?\r?$", content)
|
|
269
269
|
if not m: return None
|
|
270
|
-
n = re.search(r"(?m)
|
|
270
|
+
n = re.search(r"(?m)^[ \t]*\[", content[m.end():])
|
|
271
271
|
end = m.end()+n.start() if n else len(content)
|
|
272
272
|
return m.start(), end
|
|
273
273
|
|
|
@@ -743,20 +743,21 @@ def _entry_changes(current, new):
|
|
|
743
743
|
"Added and removed keys, in the order supplied."
|
|
744
744
|
return [k for k in new if k not in current], [k for k in current if k not in new]
|
|
745
745
|
|
|
746
|
-
def cargo_setup(root):
|
|
747
|
-
"Regenerate local Cargo patches and the compile-lock wrapper without pulling or building."
|
|
746
|
+
def cargo_setup(root, *, root_dir=False):
|
|
747
|
+
"Regenerate local Cargo patches and the compile-lock wrapper without pulling or building; root_dir enables Cargo's common source root."
|
|
748
748
|
root = Path(root).expanduser().resolve()
|
|
749
749
|
_sync_cargo_wrapper(root)
|
|
750
|
-
return _sync_cargo_patches(root)
|
|
750
|
+
return _sync_cargo_patches(root, root_dir=root_dir)
|
|
751
751
|
|
|
752
|
-
def _sync_cargo_patches(root: Path) -> tuple[list[str], list[str]]:
|
|
752
|
+
def _sync_cargo_patches(root: Path, root_dir=False) -> tuple[list[str], list[str]]:
|
|
753
753
|
"""Regenerate workspace Cargo patches, default to quiet output, and return (added, removed).
|
|
754
754
|
|
|
755
755
|
A local crate gets a `[patch.crates-io]` entry only where some local manifest requires it from crates.io
|
|
756
756
|
(`_registry_requirements`); Cargo uses no other patch. A member's git dep on a local crate gets an entry under
|
|
757
757
|
that URL. Builds anywhere under `root` then use the checkouts: the cargo analog of editable installs. Only
|
|
758
758
|
entries whose path is inside `root` are managed; entries pointing elsewhere (and any other config sections) are
|
|
759
|
-
kept as-is, and a kept entry wins over a generated one of the same name.
|
|
759
|
+
kept as-is, and a kept entry wins over a generated one of the same name. An enabled `[unstable] root-dir`
|
|
760
|
+
follows the actual root; `root_dir` enables it."""
|
|
760
761
|
root = root.resolve()
|
|
761
762
|
pkgs = _local_crates(root)
|
|
762
763
|
crates = {pkg["name"]: d for pkg, d in pkgs}
|
|
@@ -767,6 +768,11 @@ def _sync_cargo_patches(root: Path) -> tuple[list[str], list[str]]:
|
|
|
767
768
|
original = content = config.read_text() if config.exists() else ""
|
|
768
769
|
data = tomllib.loads(content) if content else {}
|
|
769
770
|
old = data.get("patch", {})
|
|
771
|
+
if root_dir or 'root-dir' in data.get('unstable', {}):
|
|
772
|
+
span = _table_span(content, 'unstable')
|
|
773
|
+
body = content[span[0]:span[1]].partition('\n')[2] if span else ''
|
|
774
|
+
body = re.sub(r'(?m)^[ \t]*root-dir[ \t]*=.*(?:\n|$)', '', body)
|
|
775
|
+
content = _replace_table(content, 'unstable', f'root-dir = {json.dumps(str(root))}\n{body}')
|
|
770
776
|
if "quiet" not in data.get("term", {}):
|
|
771
777
|
if match := re.search(r"(?m)^\[term\][^\n]*(?:\n|$)", content):
|
|
772
778
|
content = content[:match.end()].rstrip("\n") + "\nquiet = true\n" + content[match.end():]
|
|
@@ -948,19 +954,11 @@ def _check_rustup():
|
|
|
948
954
|
"Homebrew Rust can remain installed. Open a new shell and rerun ws-sync.")
|
|
949
955
|
|
|
950
956
|
def _npm_install(root: Path):
|
|
951
|
-
"Hide npm
|
|
952
|
-
try:
|
|
957
|
+
"Hide successful npm install output and warnings, but retain errors and failure diagnostics."
|
|
958
|
+
try: subprocess.run(["npm", "install", "--loglevel=error"], check=True, cwd=root, stdout=subprocess.PIPE, text=True)
|
|
953
959
|
except subprocess.CalledProcessError as e:
|
|
954
960
|
if e.stdout: print(e.stdout, file=sys.stderr, end="")
|
|
955
961
|
raise
|
|
956
|
-
try: data = json.loads(res.stdout)
|
|
957
|
-
except json.JSONDecodeError:
|
|
958
|
-
print(res.stdout, file=sys.stderr, end="")
|
|
959
|
-
raise
|
|
960
|
-
findings = {}
|
|
961
|
-
if data.get("audit", {}).get("vulnerabilities", {}).get("total"): findings["audit"] = data["audit"]
|
|
962
|
-
if data.get("unreviewedScripts"): findings["unreviewedScripts"] = data["unreviewedScripts"]
|
|
963
|
-
if findings: print(f"npm install findings ({root}):\n{json.dumps(findings, indent=2)}", file=sys.stderr)
|
|
964
962
|
|
|
965
963
|
def _sync_js(root: Path, members: list[Path]) -> list[Path]:
|
|
966
964
|
"Install the JS workspace, run every native member's build script, and return those members. Cargo handles incremental compilation."
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastws-cli
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.36
|
|
4
4
|
Summary: Fast workspace tools for multi-repo management
|
|
5
5
|
Author: Jeremy Howard
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -210,6 +210,12 @@ cargo develop --profile quick
|
|
|
210
210
|
|
|
211
211
|
Run from the project root, or give its directory with `--path`. The command reads `python-source`, `module-name`, `manifest-path` and features from `[tool.maturin]`. `[tool.fastws] dev-profile = "quick"` selects a project's default for both `cargo develop` and `fastws.cargo.run_tests`. Without that setting they use `test`. An explicit `--profile NAME` overrides the project default. The project must produce a `cdylib` and set `python-source`. Define the selected profile in `Cargo.toml` and keep incremental compilation enabled for the local crate.
|
|
212
212
|
|
|
213
|
+
The workspace's `[tool.fastws] cargo = "/path/to/cargo"` optionally selects one explicit Cargo executable for fastws builds, checks, metadata and tests, including nextest's subordinate Cargo calls. A missing executable fails without falling back. With no selection, subprocess uses its normal PATH and working-directory rules. Upstream Cargo stays installed and usable; manifests, profiles, features and package selection are unchanged.
|
|
214
|
+
|
|
215
|
+
Optional workspace `cargo-target-dir` passes through Cargo's `CARGO_TARGET_DIR`. The path is absolute or relative to the fastws workspace; explicit caller/environment values win. Cargo's own `[unstable] root-dir` sets the actual common parent of local source repositories. Enable it with `fastws.core.cargo_setup(workspace, root_dir=True)`; later setup calls and integration snapshots keep it at their actual root, including sibling repositories. Cargo command-line/environment overrides keep their normal precedence. Sharing path-crate artifacts needs a Cargo that uses this root for metadata and source paths and tracks manifest-path dependencies: ordinary Cargo's `-Zroot-dir` alone is insufficient. A source root is not a virtual alias for another checkout.
|
|
216
|
+
|
|
217
|
+
Set `FASTWS_CARGO_LOG` to a file to append the raw Cargo output already captured by builds, checks and test-compilation/listing calls; no log is created by default.
|
|
218
|
+
|
|
213
219
|
Make the initial editable installation through `ws-sync` or maturin. Repeat that installation when package metadata or entry points change. Running Python processes keep the extension they loaded.
|
|
214
220
|
|
|
215
221
|
Cargo must already build a loadable Python extension. For PyO3 extension-module builds on macOS, configure the linker in `build.rs` with `pyo3_build_config::add_extension_module_link_args()`. This command does not inject maturin's extra compiler flags.
|
|
@@ -258,7 +264,7 @@ Use it when another process's unfinished edits stop the workspace compiling, suc
|
|
|
258
264
|
|
|
259
265
|
`fastws.cargo.run_tests` builds native tests once with Cargo, without a time limit, then runs the executables that Cargo reports directly from their package directories. Each binary gets its own `timeout`, 30 seconds by default, excluding compilation. Outside `FASTWS_JOB`, a timed-out binary is reported as a failed suite with `timed_out` set. Inside a marked job, its timeout raises so the job owner can clean up descendants. Source edits between building and running do not trigger another build: the results describe the compiled build, not necessarily the latest working tree. It supports directly runnable native tests, not cross-target runners.
|
|
260
266
|
|
|
261
|
-
Where a root has `.config/nextest.toml`, `cargo nextest
|
|
267
|
+
Where a root has `.config/nextest.toml`, preparation uses `cargo nextest list` to build the tests and capture Cargo and binary metadata. The metadata graph includes all features at the native platform, independently of the features selected for compilation. Each `cargo nextest run` consumes that metadata without building or waiting for Cargo's target lock. Nextest runs each test in its own process, every binary at once, with the config's slow-test timeouts and groups. `profiles` lists the nextest profiles to run one after another, `('default',)` unless given. `timeout` bounds each profile's execution, and each binary's results come from nextest's JUnit report, which lists no ignored tests. `--profile NAME` passes to the build as `--cargo-profile NAME`, and `test_args` follow `--`.
|
|
262
268
|
|
|
263
269
|
`root` can also be a list of roots, which build one after another. Roots without nextest then run their binaries in turn. Each profile then runs at the same time in every root whose config defines it: tests in different roots share a phase, and no phase starts before the previous one ends. Suite names start with the root's directory name, and with several profiles also with the profile, as in `app timed: tests/speed.rs`. A failure ends the run after its profile unless `--no-fail-fast` is given.
|
|
264
270
|
|
|
@@ -341,7 +347,7 @@ After `uv sync`, fastws runs `cargo develop` in each mixed Rust/Python project.
|
|
|
341
347
|
|
|
342
348
|
Fastws then runs `<tool> install` at the workspace root. It runs `<tool> run build` in each JavaScript package containing both `Cargo.toml` and a `build` script. Cargo handles incremental compilation. Other build steps still run.
|
|
343
349
|
|
|
344
|
-
For npm, sync hides
|
|
350
|
+
For npm, sync hides successful install output and build-command banners. Installs use error-only logging, so npm warnings are hidden while errors and failure output remain visible. Run `npm audit` at the workspace root to inspect audit findings. Build scripts retain their own output; configure their tools to suppress routine progress. Other package managers retain their normal output.
|
|
345
351
|
|
|
346
352
|
When Rust-backed JavaScript builds are present, fastws checks before dependency installation that `rustc` and `cargo` on `PATH` are rustup's proxies. Install rustup from https://rustup.rs and select a stable toolchain with `rustup default stable` if not already configured. If another Rust installation shadows rustup, put its bin directory first on `PATH` after Homebrew's shell setup: `export PATH="$HOME/.cargo/bin:$PATH"` (use `$CARGO_HOME/bin` for a custom Cargo home), then open a new shell. Homebrew Rust can remain installed for Homebrew's own use. Fastws reports missing or shadowed rustup without changing your shell or installing a different toolchain. Packages using wasm-pack can then install their WASM target and matching binding tools automatically as part of their build.
|
|
347
353
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import shutil, subprocess, pytest, fastws.core as core
|
|
1
|
+
import json, shutil, subprocess, pytest, fastws.core as core
|
|
2
2
|
from fastws.cargo import build, check, run_tests, Suite
|
|
3
3
|
|
|
4
4
|
|
|
@@ -26,8 +26,10 @@ requires = ["external"]''')
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
@pytest.mark.parametrize('body, diagnostic', [('', ''), ('let unused = 1;', 'warning'), ('compile_error!("broken");', 'error')])
|
|
29
|
-
def test_build_diagnostics(tmp_path, capfd, body, diagnostic):
|
|
30
|
-
(tmp_path/'pyproject.toml').write_text('[tool.maturin]\n')
|
|
29
|
+
def test_build_diagnostics(tmp_path, capfd, monkeypatch, body, diagnostic):
|
|
30
|
+
(tmp_path/'pyproject.toml').write_text('[tool.maturin]\n[tool.fastws]\ncargo = '+json.dumps(shutil.which('cargo'))+'\n')
|
|
31
|
+
monkeypatch.delenv('UV_PROJECT_ENVIRONMENT', raising=False)
|
|
32
|
+
monkeypatch.setenv('VIRTUAL_ENV', str(tmp_path/'.venv'))
|
|
31
33
|
(tmp_path/'Cargo.toml').write_text('[package]\nname = "app"\nversion = "0.1.0"\n[dependencies]\ndep = { path = "dep" }\n')
|
|
32
34
|
(tmp_path/'src').mkdir()
|
|
33
35
|
(tmp_path/'src/lib.rs').write_text('extern crate dep; pub use dep::run;')
|
|
@@ -90,8 +92,11 @@ def test_run_tests(tmp_path):
|
|
|
90
92
|
|
|
91
93
|
|
|
92
94
|
@pytest.mark.skipif(not shutil.which('cargo-nextest'), reason='needs cargo-nextest')
|
|
93
|
-
def test_run_tests_nextest(tmp_path):
|
|
95
|
+
def test_run_tests_nextest(tmp_path, monkeypatch):
|
|
94
96
|
_test_crate(tmp_path)
|
|
97
|
+
(tmp_path/'pyproject.toml').write_text('[tool.fastws]\ncargo = '+json.dumps(shutil.which('cargo'))+'\n')
|
|
98
|
+
monkeypatch.delenv('UV_PROJECT_ENVIRONMENT', raising=False)
|
|
99
|
+
monkeypatch.setenv('VIRTUAL_ENV', str(tmp_path/'.venv'))
|
|
95
100
|
(tmp_path/'.config').mkdir()
|
|
96
101
|
(tmp_path/'.config/nextest.toml').write_text('[profile.default]\nfail-fast = false\n')
|
|
97
102
|
r = run_tests(tmp_path)
|
|
@@ -105,6 +110,17 @@ def test_run_tests_nextest(tmp_path):
|
|
|
105
110
|
s, = slow.suites
|
|
106
111
|
assert not slow.ok and s.timed_out and str(s) == 'nextest: ran out of time'
|
|
107
112
|
|
|
113
|
+
# Editing the working tree after capture must not trigger another Cargo build.
|
|
114
|
+
import fastws.cargo as cargo
|
|
115
|
+
captured = cargo._nextest
|
|
116
|
+
def edit_then_run(*args, **kwargs):
|
|
117
|
+
(tmp_path/'src/lib.rs').write_text('compile_error!("changed after capture");')
|
|
118
|
+
return captured(*args, **kwargs)
|
|
119
|
+
monkeypatch.setattr(cargo, '_nextest', edit_then_run)
|
|
120
|
+
assert run_tests(tmp_path, '--test', 'more').ok
|
|
121
|
+
(tmp_path/'Cargo.toml').write_text('[package]')
|
|
122
|
+
assert not run_tests(tmp_path).ok
|
|
123
|
+
|
|
108
124
|
|
|
109
125
|
@pytest.mark.skipif(not shutil.which('cargo-nextest'), reason='needs cargo-nextest')
|
|
110
126
|
def test_run_tests_profiles(tmp_path):
|
|
@@ -117,11 +133,24 @@ def test_run_tests_profiles(tmp_path):
|
|
|
117
133
|
(b/'src/lib.rs').write_text('')
|
|
118
134
|
(b/'tests').mkdir()
|
|
119
135
|
(b/'tests/fine.rs').write_text('#[test] fn fine() {}\n')
|
|
120
|
-
|
|
136
|
+
# Package filters use the all-feature graph, including dependencies disabled in this build.
|
|
137
|
+
dep = b/'optional'
|
|
138
|
+
(dep/'src').mkdir(parents=True)
|
|
139
|
+
(dep/'Cargo.toml').write_text((b/'Cargo.toml').read_text().replace('name = "b"', 'name = "optional"'))
|
|
140
|
+
(dep/'src/lib.rs').write_text('')
|
|
141
|
+
with (b/'Cargo.toml').open('a') as f: f.write(r'''[workspace]
|
|
142
|
+
members = ["optional"]
|
|
143
|
+
default-members = ["."]
|
|
144
|
+
[dependencies]
|
|
145
|
+
optional = { path = "optional", optional = true }
|
|
146
|
+
''')
|
|
147
|
+
(b/'.config/nextest.toml').write_text(r'''[profile.one]
|
|
148
|
+
default-filter = "rdeps(optional)"
|
|
149
|
+
''')
|
|
121
150
|
r = run_tests([a, b], profiles=('one', 'two'))
|
|
122
151
|
tests = {s.name: s.tests for s in r.suites if s.tests}
|
|
123
152
|
assert not r.ok and tests == {'a one: unittests src/lib.rs': {'t::passes': 'ok'}, 'a one: tests/more.rs': {'other': 'ok'},
|
|
124
|
-
'b one: tests/fine.rs': {'fine': 'ok'}, 'a two: unittests src/lib.rs': {'t::fails': 'FAILED'}}
|
|
153
|
+
'b one: tests/fine.rs': {'fine': 'ok'}, 'a two: unittests src/lib.rs': {'t::fails': 'FAILED'}}, r.text
|
|
125
154
|
first = run_tests([a, b], profiles=('two', 'one'))
|
|
126
155
|
assert not first.ok and {s.name for s in first.suites if s.tests} == {'a two: unittests src/lib.rs'}
|
|
127
156
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import subprocess
|
|
1
|
+
import json, subprocess
|
|
2
2
|
from fastws._toml import tomllib
|
|
3
3
|
from fastws.integrate import _config, code_lines, owners, snapshot
|
|
4
|
+
from fastws.core import _replace_table
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
def git(repo, *args): return subprocess.run(["git", *args], cwd=repo, check=True, capture_output=True, text=True).stdout
|
|
@@ -25,6 +26,9 @@ def test_config_points_only_the_roots_crates_at_the_root(tmp_path):
|
|
|
25
26
|
(workspace/".cargo").mkdir(parents=True)
|
|
26
27
|
(workspace/".cargo"/"config.toml").write_text(
|
|
27
28
|
f'[build]\nrustc-wrapper = "/lock"\n\n[patch.crates-io]\na = {{ path = "{workspace}/a" }}\nb = {{ path = "{workspace}/b" }}\n')
|
|
29
|
+
source = workspace/".cargo"/"config.toml"
|
|
30
|
+
content = _replace_table(source.read_text(), "unstable", f" root-dir = {json.dumps(str(workspace))}")
|
|
31
|
+
source.write_text(content.replace("[unstable]", "[unstable] # common source root"))
|
|
28
32
|
(root/"a").mkdir(parents=True)
|
|
29
33
|
(root/"a"/"Cargo.toml").write_text('[package]\nname = "a"\nversion = "0.1.0"\n')
|
|
30
34
|
(root/"c").mkdir()
|
|
@@ -33,6 +37,7 @@ def test_config_points_only_the_roots_crates_at_the_root(tmp_path):
|
|
|
33
37
|
config = tomllib.loads((root/".cargo"/"config.toml").read_text())
|
|
34
38
|
assert config["build"]["rustc-wrapper"] == "/lock"
|
|
35
39
|
assert config["patch"]["crates-io"] == {"a": {"path": str(root/"a")}, "b": {"path": f"{workspace}/b"}}
|
|
40
|
+
assert config["unstable"]["root-dir"] == str(root)
|
|
36
41
|
|
|
37
42
|
|
|
38
43
|
def test_code_lines_skips_blanks_and_comments(tmp_path):
|
|
@@ -171,6 +171,7 @@ def test_sync_cargo_patches_generates_and_preserves(tmp_path):
|
|
|
171
171
|
config = tmp_path/'.cargo'/'config.toml'
|
|
172
172
|
config.write_text('[term]\nquiet = true\n\n[patch.crates-io]\n'
|
|
173
173
|
f'foreign = {{ path = "/elsewhere/foreign" }}\ngone = {{ path = "{tmp_path}/gone" }}\n')
|
|
174
|
+
config.write_text(core._replace_table(config.read_text(), 'unstable', 'checksum-freshness = true'))
|
|
174
175
|
crate1, helper = tmp_path/'crate1', tmp_path/'helper'
|
|
175
176
|
crate1.mkdir(); helper.mkdir()
|
|
176
177
|
(crate1/'Cargo.toml').write_text('[package]\nname = "crate1"\nversion = "0.1.0"\n\n[dependencies]\nfamily = { git = "https://example.com/family" }\n'
|
|
@@ -182,7 +183,7 @@ def test_sync_cargo_patches_generates_and_preserves(tmp_path):
|
|
|
182
183
|
'\n[workspace.dependencies]\nhelper = "0.1"\ncrate1 = { path = "../crate1", version = "0.1" }\n')
|
|
183
184
|
(family/'sub'/'Cargo.toml').write_text('[package]\nname = "family-sub"\nversion = "0.1.0"\n')
|
|
184
185
|
|
|
185
|
-
added, removed = core._sync_cargo_patches(tmp_path)
|
|
186
|
+
added, removed = core._sync_cargo_patches(tmp_path, root_dir=True)
|
|
186
187
|
data = core.tomllib.loads(config.read_text())
|
|
187
188
|
cio = data['patch']['crates-io']
|
|
188
189
|
assert set(cio) == {'foreign', 'family-sub', 'helper'} # only crates that a local manifest requires from crates.io; `crate1` is required by path
|
|
@@ -192,6 +193,9 @@ def test_sync_cargo_patches_generates_and_preserves(tmp_path):
|
|
|
192
193
|
assert data['patch']['https://example.com/family']['family']['path'] == str(family) # git deps on local crates get their URL table, published or not
|
|
193
194
|
assert data['term']['quiet'] is True # other sections untouched
|
|
194
195
|
assert set(added) == {'family', 'family-sub', 'helper'} and removed == ['gone']
|
|
196
|
+
assert data['unstable'] == {'root-dir': str(tmp_path), 'checksum-freshness': True}
|
|
197
|
+
before = config.read_text()
|
|
198
|
+
assert core._sync_cargo_patches(tmp_path) == ([], []) and config.read_text() == before
|
|
195
199
|
|
|
196
200
|
|
|
197
201
|
def test_sync_ws_package_json_preserves_local_and_merges_shared(tmp_path):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|