MCPcopy Index your code
hub / github.com/cloudpipe/cloudpickle / test_submodule_closure

Method test_submodule_closure

tests/cloudpickle_test.py:1106–1127  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1104 f() # smoke test
1105
1106 def test_submodule_closure(self):
1107 # Same as test_submodule except the xml package has not been imported
1108 def scope():
1109 import xml.etree.ElementTree
1110
1111 def example():
1112 _ = xml.etree.ElementTree.Comment # potential AttributeError
1113
1114 return example
1115
1116 example = scope()
1117 example() # smoke test
1118
1119 s = cloudpickle.dumps(example, protocol=self.protocol)
1120
1121 # refresh the environment (unimport dependency)
1122 for item in list(sys.modules):
1123 if item.split(".")[0] == "xml":
1124 del sys.modules[item]
1125
1126 f = cloudpickle.loads(s)
1127 f() # smoke test
1128
1129 def test_multiprocess(self):
1130 # running a function pickled by another process (a la dask.distributed)

Callers

nothing calls this directly

Calls 1

fFunction · 0.85

Tested by

no test coverage detected