Skip to content

Commit 5d5b04f

Browse files
committed
try one more time on macos
Signed-off-by: Andrei Gherghescu <[email protected]>
1 parent 285036a commit 5d5b04f

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

plotly/src/plot.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ mod tests {
761761
assert!(!dst.exists());
762762
}
763763

764-
#[cfg(not(target_os = "macos"))]
764+
// #[cfg(not(target_os = "macos"))]
765765
#[test]
766766
#[cfg(feature = "kaleido")]
767767
fn test_save_to_jpeg() {
@@ -773,7 +773,7 @@ mod tests {
773773
assert!(!dst.exists());
774774
}
775775

776-
#[cfg(not(target_os = "macos"))]
776+
// #[cfg(not(target_os = "macos"))]
777777
#[test]
778778
#[cfg(feature = "kaleido")]
779779
fn test_save_to_svg() {
@@ -822,7 +822,6 @@ mod tests {
822822
}
823823

824824
#[test]
825-
#[ignore] // Fails in the CI
826825
#[cfg(not(target_os = "macos"))]
827826
#[cfg(feature = "kaleido")]
828827
fn test_image_to_base64() {
@@ -851,7 +850,6 @@ mod tests {
851850
}
852851

853852
#[test]
854-
#[ignore] // Fails in the CI
855853
#[cfg(not(target_os = "macos"))]
856854
#[cfg(feature = "kaleido")]
857855
fn test_image_to_svg_string() {

plotly_kaleido/src/lib.rs

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ impl Kaleido {
198198
"--disable-software-rasterizer",
199199
"--single-process",
200200
"--disable-gpu",
201-
"--timeout 2000",
201+
"--no-sandbox",
202+
"--allow-silent-push",
203+
"-allow-third-party-modules",
204+
"--allow-running-insecure-content",
202205
])
203206
.stdin(Stdio::piped())
204207
.stdout(Stdio::piped())
@@ -227,16 +230,29 @@ impl Kaleido {
227230
let output_lines = BufReader::new(process.stdout.take().unwrap()).lines();
228231
for line in output_lines.map_while(Result::ok) {
229232
let res = KaleidoResult::from(line.as_str());
230-
if let Some(image_data) = res.result {
231-
// TODO: this should be refactored
232-
// The assumption is that KaleidoResult contains a single image.
233-
// We should end the loop on the first valid one.
234-
// If that is not the case, prior implementation would have returned the last
235-
// valid image
236-
return Ok(image_data);
233+
match res.result {
234+
Some(image_data) => {
235+
// TODO: this should be refactored
236+
// The assumption is that KaleidoResult contains a single image.
237+
// We should end the loop on the first valid one.
238+
// If that is not the case, prior implementation would have returned the last
239+
// valid image
240+
return Ok(image_data);
241+
}
242+
None => {
243+
println!("empty line from Kaleido");
244+
}
237245
}
238246
}
239247

248+
// Don't eat up Kaleido/Chromiu erros but show them in the terminal
249+
let stderr = process.stderr.take().unwrap();
250+
let stderr_lines = BufReader::new(stderr).lines();
251+
for line in stderr_lines {
252+
let line = line.unwrap();
253+
eprintln!("{}", line);
254+
}
255+
240256
Ok(String::default())
241257
}
242258
}
@@ -355,18 +371,18 @@ mod tests {
355371
let dst = PathBuf::from("example.pdf");
356372
let r = k.save(dst.as_path(), &test_plot, "pdf", 1200, 900, 4.5);
357373
assert!(r.is_ok());
358-
assert!(std::fs::remove_file(dst.as_path()).is_ok());
374+
// assert!(std::fs::remove_file(dst.as_path()).is_ok());
359375
}
360376

361377
// This generates empty eps files for some reason
362378
#[test]
363-
#[ignore]
379+
// #[ignore]
364380
fn test_save_eps() {
365381
let test_plot = create_test_plot();
366382
let k = Kaleido::new();
367383
let dst = PathBuf::from("example.eps");
368384
let r = k.save(dst.as_path(), &test_plot, "eps", 1200, 900, 4.5);
369385
assert!(r.is_ok());
370-
assert!(std::fs::remove_file(dst.as_path()).is_ok());
386+
// assert!(std::fs::remove_file(dst.as_path()).is_ok());
371387
}
372388
}

0 commit comments

Comments
 (0)