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

Method clear_directory

Lib/test/test_venv.py:404–410  ·  view source on GitHub ↗
(self, path)

Source from the content-addressed store, hash-verified

402 self.assertFalse(os.path.exists(fn))
403
404 def clear_directory(self, path):
405 for fn in os.listdir(path):
406 fn = os.path.join(path, fn)
407 if os.path.islink(fn) or os.path.isfile(fn):
408 os.remove(fn)
409 elif os.path.isdir(fn):
410 rmtree(fn)
411
412 def test_unoverwritable_fails(self):
413 #create a file clashing with directories in the env dir

Callers 1

Calls 7

rmtreeFunction · 0.90
listdirMethod · 0.80
islinkMethod · 0.80
joinMethod · 0.45
isfileMethod · 0.45
removeMethod · 0.45
isdirMethod · 0.45

Tested by

no test coverage detected