Add a unit test function for overriding the environment.
Review Request #13070 — Created May 25, 2023 and submitted
This introduces a
TestCase.envcontext manager that takes in a
dictionary of new environment settings, sets them, and then unsets them
after the context is run.
Through this, we should be able to safely work with the environment
without tests having to take special care to reset state.
Made use of this in upcoming unit tests.