Lint: each shared test fixture loads once per test binary, and xtask names its step list type

This commit is contained in:
aiongg committed 2026-11-18 21:20:35 +00:00
1 parent 6dd50bf11a
commit bd3712d114
8 files changed
+19 -13

No files matched your search

+4
View File
@@ -25,3 +25,7 @@ mod save_snapshot;
mod scratch_save;
mod smart_filter_authorization;
mod smart_filter_stack_cache;
// Shared by smart_filter_authorization and smart_filter_stack_cache.
#[path = "../support/smart_filter_fixture.rs"]
mod smart_filter_fixture;
@@ -2,8 +2,7 @@
use std::path::Path;
use std::sync::Arc;
#[path = "../support/smart_filter_fixture.rs"]
mod fixture;
use crate::smart_filter_fixture as fixture;
use fixture::{Fixture, assert_denied, cube, path_params};
use photocraft_automation::{Headless, workspace::authorize_desktop_engine_step};
@@ -4,8 +4,7 @@ use photocraft_automation::workspace::authorize_desktop_engine_step;
use photocraft_engine::{Session, smart_cmds};
use serde_json::json;
#[path = "../support/smart_filter_fixture.rs"]
mod fixture;
use crate::smart_filter_fixture as fixture;
use fixture::{Fixture, assert_denied};
@@ -1,6 +1,6 @@
//! The smart filter authorization tests' fixture: a workspace with a striped image to place and
//! maps and LUTs outside it (`#[path]`-included by `it/smart_filter_authorization.rs` and
//! `smart_filter_stack_cache.rs`).
//! maps and LUTs outside it (`#[path]`-included once by `it/main.rs`, used by
//! `smart_filter_authorization` and `smart_filter_stack_cache`).
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicU64, Ordering};
+1 -2
View File
@@ -5,8 +5,7 @@ use photocraft_engine::actions_cmds::{ActionList, ActionsFile};
use photocraft_engine::{Session, atn_cmds};
use serde_json::json;
#[path = "../common/csh_fixture.rs"]
mod csh_fixture;
use crate::csh_fixture;
const SHAPE_ID: &str = "original-fixture-square";
+1 -2
View File
@@ -4,8 +4,7 @@
use photocraft_engine::Session;
use serde_json::json;
#[path = "../common/csh_fixture.rs"]
mod fixture;
use crate::csh_fixture as fixture;
use fixture::{polygon_csh, triangle_csh};
#[test]
+4
View File
@@ -133,3 +133,7 @@ mod vector_paste_options;
mod wand_transparent_copy;
mod working_rgb_profile;
mod xmp_charref;
// Shared by atn_shape_blur and csh_import.
#[path = "../common/csh_fixture.rs"]
mod csh_fixture;
+5 -3
View File
@@ -290,6 +290,8 @@ struct CiOptions {
}
type StepFn = fn(&CiOptions) -> Result<(), String>;
/// The steps a `cargo xtask ci` call runs, in order, by name.
type CiPlan = Vec<(&'static str, StepFn)>;
/// The CI gate's steps, in the order `cargo xtask ci` runs them.
const CI_STEPS: [(&str, Part, StepFn); 12] = [
@@ -462,7 +464,7 @@ fn ci_exclude() -> Vec<String> {
/// The steps `cargo xtask ci <args>` runs, and how: no argument runs every step; a part (`lint`,
/// `build`, `tests`) runs the steps of one gate job; a step's name runs that step.
fn ci_from_args(args: &[&str], exclude: Vec<String>) -> Result<(Vec<(&'static str, StepFn)>, CiOptions), String> {
fn ci_from_args(args: &[&str], exclude: Vec<String>) -> Result<(CiPlan, CiOptions), String> {
let mut options = CiOptions { build_only: false, partition: None, selection: Selection::All, exclude };
let mut what = None;
for &arg in args {
@@ -506,8 +508,8 @@ fn tests_partition(selection: Selection, env: Option<String>) -> Option<String>
/// The steps of `parts`, in CI_STEPS order. When the tests are only built, the test steps become
/// that one build.
fn ci_plan(parts: &[Part], build_only: bool) -> Vec<(&'static str, StepFn)> {
let mut plan: Vec<(&'static str, StepFn)> = Vec::new();
fn ci_plan(parts: &[Part], build_only: bool) -> CiPlan {
let mut plan: CiPlan = Vec::new();
for &(name, part, f) in &CI_STEPS {
if !parts.contains(&part) {
continue;