pyart.testing.InTemporaryDirectory¶
- class pyart.testing.InTemporaryDirectory(suffix='', prefix='tmp', dir=None)[source]¶
Create, return, and change directory to a temporary directory.
Examples
>>> import os >>> my_cwd = os.getcwd() >>> with InTemporaryDirectory() as tmpdir: ... _ = open('test.txt', 'wt').write('some text') ... assert os.path.isfile('test.txt') ... assert os.path.isfile(os.path.join(tmpdir, 'test.txt')) >>> os.path.exists(tmpdir) False >>> os.getcwd() == my_cwd True
|