Skip to content

Commit 6085dba

Browse files
committed
Switch test to using a minimal crate published specifically for it
1 parent 142128b commit 6085dba

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/docbuilder/rustwide_builder.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,8 +1035,33 @@ mod tests {
10351035
wrapper(|env| {
10361036
env.override_config(|cfg| cfg.include_default_targets = false);
10371037

1038-
let crate_ = "stm32f7xx-hal";
1039-
let version = "0.6.0";
1038+
// if the corrected dependency of the crate was already downloaded we need to remove it
1039+
let crate_file = env.config().rustwide_workspace.join(
1040+
"cargo-home/registry/cache/git.cakeli.workers.dev-1ecc6299db9ec823/rand_core-0.5.1.crate",
1041+
);
1042+
let src_dir = env
1043+
.config()
1044+
.rustwide_workspace
1045+
.join("cargo-home/registry/src/git.cakeli.workers.dev-1ecc6299db9ec823/rand_core-0.5.1");
1046+
1047+
if crate_file.exists() {
1048+
info!("deleting {}", crate_file.display());
1049+
std::fs::remove_file(crate_file)?;
1050+
}
1051+
if src_dir.exists() {
1052+
info!("deleting {}", src_dir.display());
1053+
std::fs::remove_dir_all(src_dir)?;
1054+
}
1055+
1056+
// Specific setup required:
1057+
// * crate has a binary so that it is published with a lockfile
1058+
// * crate has a library so that it is documented by docs.rs
1059+
// * crate has an optional dependency
1060+
// * metadata enables the optional dependency for docs.rs
1061+
// * `cargo doc` fails with the version of the dependency in the lockfile
1062+
// * there is a newer version of the dependency available that correctly builds
1063+
let crate_ = "docs_rs_test_incorrect_lockfile";
1064+
let version = "0.1.2";
10401065
let mut builder = RustwideBuilder::init(env).unwrap();
10411066
assert!(builder.build_package(crate_, version, PackageKind::CratesIo)?);
10421067

0 commit comments

Comments
 (0)