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

Method __enter__

extra_tests/snippets/stdlib_os.py:84–97  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

82
83class TestWithTempDir:
84 def __enter__(self):
85 if os.name == "nt":
86 base_folder = os.environ["TEMP"]
87 else:
88 base_folder = "/tmp"
89
90 name = os.path.join(base_folder, "rustpython_test_os_" + str(int(time.time())))
91
92 while os.path.isdir(name):
93 name = name + "_"
94
95 os.mkdir(name)
96 self.name = name
97 return name
98
99 def __exit__(self, exc_type, exc_val, exc_tb):
100 pass

Callers

nothing calls this directly

Calls 5

strFunction · 0.85
joinMethod · 0.45
timeMethod · 0.45
isdirMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected