Allow global setup code in tests (before threads spawn)
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
I have some setup code that I'd like to run that requires the process be single threaded when it runs. std::sync::Once called at the top of each #[test] isn't enough, as threads have already spawned by that point. My workaround is to use harness = false but I either lose nice reporting or opt into #[feature(test)] and require nightly.
I'm aware of #816, but I'm hoping that a limited improvement might be allowed to the stable interface of the existing test crate... :-)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading this issue alongside the referenced #816 and the stable test crate interface. Examine how #[test], harness = false, and process startup interact before test threads are spawned. Done means a concrete, accepted design for global setup code that preserves stable test reporting and does not require nightly features.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100