MCPcopy Create free account
hub / github.com/ipython/ipython / teardown_environment

Function teardown_environment

IPython/utils/tests/test_path.py:87–99  ·  view source on GitHub ↗

Restore things that were remembered by the setup_environment function

()

Source from the content-addressed store, hash-verified

85 oldstuff = (env.copy(), os.name, sys.platform, path.get_home_dir, IPython.__file__, os.getcwd())
86
87def teardown_environment():
88 """Restore things that were remembered by the setup_environment function
89 """
90 (oldenv, os.name, sys.platform, path.get_home_dir, IPython.__file__, old_wd) = oldstuff
91 os.chdir(old_wd)
92 reload(path)
93
94 for key in list(env):
95 if key not in oldenv:
96 del env[key]
97 env.update(oldenv)
98 if hasattr(sys, 'frozen'):
99 del sys.frozen
100
101# Build decorator that uses the setup_environment/setup_environment
102with_environment = with_setup(setup_environment, teardown_environment)

Callers

nothing calls this directly

Calls 2

reloadFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected