-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#[once] incompatibility with nexte.st #147
Comments
Can you provide a simple example to expose the issue? |
Yes, I wanted to provide one with the original submission, but don't have time right now to extract something minimal. I'll try to give you an example without too much delay. |
Here is an example of the failure. The code that generated it is here.
|
Maybe I found the issue
https://nexte.st/book/how-it-works.html That means the |
... which is why I tried sleeping while writing and running multiple cases, in order to maximize the chances of some kind of collision (maybe file corruption) that I could detect later on ... but the produced files always came out OK. While HDF5 goes out of its way to avoid such corruptions and locks to ensure unique access, which is why the tests fail with HDF5. Still don't understand why they pass on Linux on GHA. An obvious explanation would be that the GHA Linux runners have only one core, but a quick search through documentation suggested that they have 2 (while the Mac OS ones have 3). Coming back to the main issue, I struggle to see what could be done on the Shame, because that's not going to be implemented any time soon, and using Many, many thanks for |
Well yes, you have a hidden data dependency between the fixture and the test, where you assume another test won't clobber the file. Tests may or may not run in parallel depending on the framework as you have found out. Running tests in same process but multiple threads, or multi processes, you should assume tests can collide and so race conditions on file names are always possible. Same goes with db tests and collisions over rows/tables/schemas. #[fixture]
#[once]
fn generate_and_write() -> (PathBuf,Vec<i32>) {
let data: Vec<_> = (1..100).collect();
let filename = std::path::PathBuf::from(/* generate a random name using your favorite method */);
hdf5::File::create(filename).unwrap();
(file_name,data)
} Use a random filename, and return the name with the expected data. |
Thank you very much for this crate, which is a huge boon to productivity in testing Rust projects.
I've stumbled across something which looks like an incompatibility between
#[once]
andcargo nextest
.nextest
has its own test execution model, and I guess that it works around the protections against multiple execution on which#[once]
relies.I wonder whether there is any chance of getting these two excellent projects to be compatible in this particular case.
I've opened a similar issue in
nexte.st
.The text was updated successfully, but these errors were encountered: