MCPcopy Index your code
hub / github.com/RustPython/RustPython / setUpClass

Method setUpClass

Lib/test/test_import/__init__.py:2693–2716  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

2691
2692 @classmethod
2693 def setUpClass(cls):
2694 spec = importlib.util.find_spec(cls.NAME)
2695 cls.LOADER = type(spec.loader)
2696
2697 # Apple extensions must be distributed as frameworks. This requires
2698 # a specialist loader, and we need to differentiate between the
2699 # spec.origin and the original file location.
2700 if is_apple_mobile:
2701 assert cls.LOADER is AppleFrameworkLoader
2702
2703 cls.ORIGIN = spec.origin
2704 with open(spec.origin + ".origin", "r") as f:
2705 cls.FILE = os.path.join(
2706 os.path.dirname(sys.executable),
2707 f.read().strip()
2708 )
2709 else:
2710 assert cls.LOADER is ExtensionFileLoader
2711
2712 cls.ORIGIN = spec.origin
2713 cls.FILE = spec.origin
2714
2715 # Start fresh.
2716 cls.clean_up()
2717
2718 def tearDown(self):
2719 # Clean up the module.

Callers

nothing calls this directly

Calls 6

clean_upMethod · 0.80
openFunction · 0.50
find_specMethod · 0.45
joinMethod · 0.45
stripMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected