MCPcopy Create free account
hub / github.com/numpy/numpy / temp_cwd

Function temp_cwd

tools/refguide_check.py:799–807  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

797
798 @contextmanager
799 def temp_cwd():
800 cwd = os.getcwd()
801 tmpdir = tempfile.mkdtemp()
802 try:
803 os.chdir(tmpdir)
804 yield tmpdir
805 finally:
806 os.chdir(cwd)
807 shutil.rmtree(tmpdir)
808
809 # Run tests, trying to restore global state afterward
810 cwd = os.getcwd()

Callers 1

_run_doctestsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected