Skip to content

Commit

Permalink
fix test_integrations_pytest: fetch CARGO_MANIFEST_DIR at runtime (#571)
Browse files Browse the repository at this point in the history
* fix test_integrations_pytest: fetch CARGO_MANIFEST_DIR at runtime

* fix current dir for script

* fix issue with UNC path in windows
  • Loading branch information
erratic-pattern authored Oct 21, 2023
1 parent 4bc7202 commit 3ea2264
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ serial_test = "0.5"
trycmd = "0.14"
const_format = "0.2.30"
maplit = "1.0"
dunce = "1.0.4"

[profile.release]
debug = "line-tables-only"
20 changes: 10 additions & 10 deletions tests/test_integrations.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use std::process::Command;

macro_rules! pytest_dir {
() => {
concat!(env!("CARGO_MANIFEST_DIR"), "/pytest")
};
}
use std::{env, error::Error, path::PathBuf, process::Command};

#[test]
fn test_integrations_pytest() -> std::io::Result<()> {
fn test_integrations_pytest() -> Result<(), Box<dyn Error>> {
let cargo_manifest_dir = dunce::canonicalize(PathBuf::from(env::var("CARGO_MANIFEST_DIR")?))?;
let live_test = cargo_manifest_dir.join("pytest/live_test.py");
let mut handle = Command::new("python3")
.current_dir(pytest_dir!())
.args(["live_test.py", "--file", "test_integrations.py"])
.current_dir(cargo_manifest_dir)
.args([
live_test.to_string_lossy().as_ref(),
"--file",
"test_integrations.py",
])
.spawn()?;
let status = handle.wait()?;
assert!(status.success());
Expand Down

0 comments on commit 3ea2264

Please sign in to comment.