Skip to content

Commit 9d86f6c

Browse files
committed
temp: fix failing integration tests by searching from manifest_path?
1 parent 40613bd commit 9d86f6c

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

cargo-nextest/src/dispatch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ impl BaseApp {
838838
});
839839
}
840840

841-
let cargo_configs = CargoConfigs::new(&cargo_opts.config)?;
841+
let cargo_configs = CargoConfigs::new(&cargo_opts.config, manifest_path.clone())?;
842842

843843
Ok(Self {
844844
output,

cargo-nextest/src/tests_integration/fixtures.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,23 @@ pub(super) fn set_env_vars() {
138138
// This environment variable is required to test the #[bench] fixture. Note that THIS IS FOR
139139
// TEST CODE ONLY. NEVER USE THIS IN PRODUCTION.
140140
std::env::set_var("RUSTC_BOOTSTRAP", "1");
141+
142+
std::env::set_var(
143+
"__NEXTEST_ENV_VAR_FOR_TESTING_IN_PARENT_ENV_NO_OVERRIDE",
144+
"if-this-value-is-present-then-test-passed",
145+
);
146+
std::env::set_var(
147+
"__NEXTEST_ENV_VAR_FOR_TESTING_IN_PARENT_ENV_OVERRIDDEN",
148+
"if-this-value-is-present-then-test-failed",
149+
);
150+
std::env::set_var(
151+
"__NEXTEST_ENV_VAR_FOR_TESTING_IN_PARENT_ENV_RELATIVE_NO_OVERRIDE",
152+
"if-this-value-is-present-then-test-passed",
153+
);
154+
std::env::set_var(
155+
"__NEXTEST_ENV_VAR_FOR_TESTING_IN_PARENT_ENV_RELATIVE_OVERRIDDEN",
156+
"if-this-value-is-present-then-test-failed",
157+
);
141158
}
142159

143160
#[track_caller]

nextest-runner/src/cargo_config.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,17 @@ impl CargoConfigs {
203203
/// Discover Cargo config files using the same algorithm that Cargo uses.
204204
pub fn new(
205205
cli_configs: impl IntoIterator<Item = impl AsRef<str>>,
206+
manifest_path: Option<Utf8PathBuf>,
206207
) -> Result<Self, CargoConfigError> {
207-
let cwd = std::env::current_dir()
208-
.map_err(CargoConfigError::GetCurrentDir)
209-
.and_then(|cwd| {
210-
Utf8PathBuf::try_from(cwd).map_err(CargoConfigError::CurrentDirInvalidUtf8)
211-
})?;
208+
let cwd = match manifest_path {
209+
Some(manifest_path) => manifest_path.parent().map(|path| path.to_owned()).unwrap_or_default(),
210+
None =>
211+
std::env::current_dir()
212+
.map_err(CargoConfigError::GetCurrentDir)
213+
.and_then(|cwd| {
214+
Utf8PathBuf::try_from(cwd).map_err(CargoConfigError::CurrentDirInvalidUtf8)
215+
})?
216+
};
212217
let cli_configs = parse_cli_configs(&cwd, cli_configs.into_iter())?;
213218

214219
Ok(Self {

0 commit comments

Comments
 (0)