Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdonszelmann committed Jun 4, 2024
1 parent 07313b0 commit ca7f63c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions scopegraphs-render-docs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ proc-macro-error = { version = "1", default-features = false }
itertools = "0.10"
syn = "2"
include_dir = "0.7"
uuid = { version = "1.8.0", features = ["v4"] }

[dev-dependencies]
pretty_assertions = "1"
6 changes: 5 additions & 1 deletion scopegraphs-render-docs/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::path::PathBuf;
use std::process::{Command, Stdio};
use std::{fs, io};
use syn::{Attribute, Ident, MetaNameValue};
use uuid::Uuid;

// embedded JS code being inserted as html script elmenets
static MERMAID_JS_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/doc/js/");
Expand Down Expand Up @@ -327,7 +328,7 @@ fn run_code(code: &str) -> Result<Vec<String>, EvalError> {
Ok(())
}

let code_hash = hash_str(code).to_string();
let code_hash = Uuid::new_v4().to_string();
let out_dir = &temp_dir().join("render-docs").join(&code_hash);
println!("testing in {out_dir:?}");

Expand All @@ -341,12 +342,14 @@ fn run_code(code: &str) -> Result<Vec<String>, EvalError> {
let _ = fs::remove_file(sg_target_dir.join("debug").join(".fingerprint"));
let _ = fs::remove_file(sg_target_dir.join("debug").join("tmp"));
let _ = fs::remove_file(sg_target_dir.join("debug").join("incremental"));
// let _ = fs::remove_file(sg_target_dir.join("debug").join("build"));
}
if sg_target_dir.join("release").exists() {
let _ = fs::remove_file(sg_target_dir.join("release").join(".cargo-lock"));
let _ = fs::remove_file(sg_target_dir.join("release").join(".fingerprint"));
let _ = fs::remove_file(sg_target_dir.join("release").join("tmp"));
let _ = fs::remove_file(sg_target_dir.join("release").join("incremental"));
// let _ = fs::remove_file(sg_target_dir.join("release").join("build"));
}

let cargo = PathBuf::from(std::env::var("CARGO").expect("$CARGO is set during compilation"));
Expand Down Expand Up @@ -392,6 +395,7 @@ fn documented() {{}}
let command = command
.current_dir(out_dir)
.env("CARGO_TARGET_DIR", sg_target_dir)
.env_remove("CARGO_MAKEFLAGS")
.arg("test");

let output = if offline {
Expand Down

0 comments on commit ca7f63c

Please sign in to comment.