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

Method test_obj_del

IPython/core/tests/test_run.py:239–255  ·  view source on GitHub ↗

Test that object's __del__ methods are called on exit.

(self)

Source from the content-addressed store, hash-verified

237 nt.assert_true(_ip.user_ns['t'])
238
239 def test_obj_del(self):
240 """Test that object's __del__ methods are called on exit."""
241 if sys.platform == 'win32':
242 try:
243 import win32api
244 except ImportError:
245 raise SkipTest("Test requires pywin32")
246 src = ("class A(object):\n"
247 " def __del__(self):\n"
248 " print('object A deleted')\n"
249 "a = A()\n")
250 self.mktmp(src)
251 if dec.module_not_available('sqlite3'):
252 err = 'WARNING: IPython History requires SQLite, your history will not be saved\n'
253 else:
254 err = None
255 tt.ipexec_validate(self.fname, 'object A deleted', err)
256
257 def test_aggressive_namespace_cleanup(self):
258 """Test that namespace cleanup is not too aggressive GH-238

Callers

nothing calls this directly

Calls 1

mktmpMethod · 0.80

Tested by

no test coverage detected