Not a change you should make in this PR, but I recently hit a case on something I was working on that required writing to environment variables and what I did was switch to nextest. It has several nice properties, including each test is run in its own process, and there's even a nice section in their docs that goes over the safety of altering environment variables. It also happens to have a lot of other nice features like enforcing timeouts on slow/deadlocked tests, for example.
Anyway, I think this looks good and depending on serial_test is fine, but nextest might provide a more pleasant experience.
Originally posted by @jeremycline in #225 (review)