changing tests to use context managers