Closed azzamsa closed 1 year ago
Tests are multithreaded by default, which results in time
returning the error on Unix-like systems for safety reasons.
❯ cargo test -- --test-threads 1
running 1 test
test tests::test_date ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
@jhpratt Thanks. It news to me that I need to pass --test-threads 1
. I don't have this issue with chrono::Local::today()
or chrono::Local::now()
.
Would you like to give me more hints why in the chrono side, they did not have this issue?
The soundness issue still exists there. They have just chosen to implement a very expensive workaround that still has significant flaws and soundness holes.
Ooh, I see.
Do we have any alternative other than passing --test-threads 1
so that we don't slow down the tests?
Cargo does not have the option to run a specific test serially, so unfortunately no.
Cargo does not have the option to run a specific test serially, so unfortunately no.
Thanks a lot! I will play with nextest
and report back here the alternative.
I want to say thank you for maintaining time. Thank you so much! :heart:
Hi.
I am migrating all my crates from
chrono
totime
. It is a great and fun experience. I find the API is simpler than passingUTC
orLocal
type around as chrono did.One issue that I can't solve is that using
OffsetDateTime::now_local()
intest
module always results in the errorError: The system's UTC offset could not be determined
but it works incargo run
.