MCPcopy Index your code
hub / github.com/python/cpython / test_subinterps

Method test_subinterps

Lib/test/test_capi/test_misc.py:1691–1704  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1689
1690 @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
1691 def test_subinterps(self):
1692 import builtins
1693 r, w = os.pipe()
1694 code = """if 1:
1695 import sys, builtins, pickle
1696 with open({:d}, "wb") as f:
1697 pickle.dump(id(sys.modules), f)
1698 pickle.dump(id(builtins), f)
1699 """.format(w)
1700 with open(r, "rb") as f:
1701 ret = support.run_in_subinterp(code)
1702 self.assertEqual(ret, 0)
1703 self.assertNotEqual(pickle.load(f), id(sys.modules))
1704 self.assertNotEqual(pickle.load(f), id(builtins))
1705
1706 @unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
1707 def test_subinterps_recent_language_features(self):

Callers

nothing calls this directly

Calls 7

idFunction · 0.85
assertNotEqualMethod · 0.80
openFunction · 0.50
pipeMethod · 0.45
formatMethod · 0.45
assertEqualMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected