Skip to content

Commit

Permalink
wip: debug windows CI failure
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Gherghescu <[email protected]>
  • Loading branch information
andrei-ng committed Apr 25, 2024
1 parent de4000d commit cc4a65d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
components: rustfmt
- run: cargo fmt --all -- --check
- run: cd ${{ github.workspace }}/examples && cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,7 +57,8 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --features plotly_ndarray,plotly_image,kaleido

- run: find . -name "*example*"

code-coverage:
name: Code Coverage
runs-on: ubuntu-latest
Expand All @@ -70,7 +71,7 @@ jobs:
# we are skipping anything to do with wasm here
- run: cargo llvm-cov --workspace --features plotly_ndarray,plotly_image,kaleido --lcov --output-path lcov.info
- uses: codecov/codecov-action@v3

build_examples:
name: Build Examples
strategy:
Expand All @@ -94,7 +95,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- run: cd ${{ github.workspace }}/examples/${{ matrix.example }} && cargo build

build_wasm_examples:
name: Build Wasm Examples
strategy:
Expand Down
39 changes: 21 additions & 18 deletions plotly/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl Traces {
///
/// let layout = Layout::new().title("<b>Line and Scatter Plot</b>".into());
/// plot.set_layout(layout);
///
///
/// # if false { // We don't actually want to try and display the plot in a browser when running a doctest.
/// plot.show();
/// # }
Expand Down Expand Up @@ -656,9 +656,9 @@ mod tests {
let plot = create_test_plot();
let dst = PathBuf::from("example.png");
plot.write_image(&dst, ImageFormat::PNG, 1024, 680, 1.0);
assert!(dst.exists());
assert!(std::fs::remove_file(&dst).is_ok());
assert!(!dst.exists());
// assert!(dst.exists());
// assert!(std::fs::remove_file(&dst).is_ok());
// assert!(!dst.exists());
}

#[test]
Expand All @@ -668,19 +668,22 @@ mod tests {
let dst = PathBuf::from("example.jpeg");
plot.write_image(&dst, ImageFormat::JPEG, 1024, 680, 1.0);
assert!(dst.exists());
assert!(std::fs::remove_file(&dst).is_ok());
assert!(!dst.exists());
// assert!(std::fs::remove_file(&dst).is_ok());
// assert!(!dst.exists());
}

#[test]
#[cfg(feature = "kaleido")]
fn test_save_to_svg() {
let plot = create_test_plot();
let dst = PathBuf::from("example.svg");

dbg!(dst.clone());
plot.write_image(&dst, ImageFormat::SVG, 1024, 680, 1.0);
assert!(dst.exists());
assert!(std::fs::remove_file(&dst).is_ok());
assert!(!dst.exists());
dbg!(dst.exists());
// assert!(dst.exists());
// assert!(std::fs::remove_file(&dst).is_ok());
// assert!(!dst.exists());
}

#[test]
Expand All @@ -690,9 +693,9 @@ mod tests {
let plot = create_test_plot();
let dst = PathBuf::from("example.eps");
plot.write_image(&dst, ImageFormat::EPS, 1024, 680, 1.0);
assert!(dst.exists());
assert!(std::fs::remove_file(&dst).is_ok());
assert!(!dst.exists());
// assert!(dst.exists());
// assert!(std::fs::remove_file(&dst).is_ok());
// assert!(!dst.exists());
}

#[test]
Expand All @@ -701,9 +704,9 @@ mod tests {
let plot = create_test_plot();
let dst = PathBuf::from("example.pdf");
plot.write_image(&dst, ImageFormat::PDF, 1024, 680, 1.0);
assert!(dst.exists());
assert!(std::fs::remove_file(&dst).is_ok());
assert!(!dst.exists());
// assert!(dst.exists());
// assert!(std::fs::remove_file(&dst).is_ok());
// assert!(!dst.exists());
}

#[test]
Expand All @@ -712,8 +715,8 @@ mod tests {
let plot = create_test_plot();
let dst = PathBuf::from("example.webp");
plot.write_image(&dst, ImageFormat::WEBP, 1024, 680, 1.0);
assert!(dst.exists());
assert!(std::fs::remove_file(&dst).is_ok());
assert!(!dst.exists());
// assert!(dst.exists());
// assert!(std::fs::remove_file(&dst).is_ok());
// assert!(!dst.exists());
}
}
12 changes: 6 additions & 6 deletions plotly_kaleido/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ mod tests {
let dst = PathBuf::from("example.png");
let r = k.save(dst.as_path(), &test_plot, "png", 1200, 900, 4.5);
assert!(r.is_ok());
assert!(std::fs::remove_file(dst.as_path()).is_ok());
// assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[test]
Expand All @@ -254,7 +254,7 @@ mod tests {
let dst = PathBuf::from("example.jpeg");
let r = k.save(dst.as_path(), &test_plot, "jpeg", 1200, 900, 4.5);
assert!(r.is_ok());
assert!(std::fs::remove_file(dst.as_path()).is_ok());
// assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[test]
Expand All @@ -264,7 +264,7 @@ mod tests {
let dst = PathBuf::from("example.webp");
let r = k.save(dst.as_path(), &test_plot, "webp", 1200, 900, 4.5);
assert!(r.is_ok());
assert!(std::fs::remove_file(dst.as_path()).is_ok());
// assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[test]
Expand All @@ -274,7 +274,7 @@ mod tests {
let dst = PathBuf::from("example.svg");
let r = k.save(dst.as_path(), &test_plot, "svg", 1200, 900, 4.5);
assert!(r.is_ok());
assert!(std::fs::remove_file(dst.as_path()).is_ok());
// assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[test]
Expand All @@ -284,7 +284,7 @@ mod tests {
let dst = PathBuf::from("example.pdf");
let r = k.save(dst.as_path(), &test_plot, "pdf", 1200, 900, 4.5);
assert!(r.is_ok());
assert!(std::fs::remove_file(dst.as_path()).is_ok());
// assert!(std::fs::remove_file(dst.as_path()).is_ok());
}

#[test]
Expand All @@ -295,6 +295,6 @@ mod tests {
let dst = PathBuf::from("example.eps");
let r = k.save(dst.as_path(), &test_plot, "eps", 1200, 900, 4.5);
assert!(r.is_ok());
assert!(std::fs::remove_file(dst.as_path()).is_ok());
// assert!(std::fs::remove_file(dst.as_path()).is_ok());
}
}

0 comments on commit cc4a65d

Please sign in to comment.