Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
0e17f8cd
Kaydet (Commit)
0e17f8cd
authored
Ock 23, 2006
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Convenience function to remove a possibly non-existant file
üst
9730bcb4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
14 deletions
+10
-14
test_support.py
Lib/test/test_support.py
+10
-14
No files found.
Lib/test/test_support.py
Dosyayı görüntüle @
0e17f8cd
...
...
@@ -49,23 +49,24 @@ def unload(name):
except
KeyError
:
pass
def
unlink
(
filename
):
import
os
try
:
os
.
unlink
(
filename
)
except
OSError
:
pass
def
forget
(
modname
):
'''"Forget" a module was ever imported by removing it from sys.modules and
deleting any .pyc and .pyo files.'''
unload
(
modname
)
import
os
for
dirname
in
sys
.
path
:
try
:
os
.
unlink
(
os
.
path
.
join
(
dirname
,
modname
+
os
.
extsep
+
'pyc'
))
except
os
.
error
:
pass
unlink
(
os
.
path
.
join
(
dirname
,
modname
+
os
.
extsep
+
'pyc'
))
# Deleting the .pyo file cannot be within the 'try' for the .pyc since
# the chance exists that there is no .pyc (and thus the 'try' statement
# is exited) but there is a .pyo file.
try
:
os
.
unlink
(
os
.
path
.
join
(
dirname
,
modname
+
os
.
extsep
+
'pyo'
))
except
os
.
error
:
pass
unlink
(
os
.
path
.
join
(
dirname
,
modname
+
os
.
extsep
+
'pyo'
))
def
is_resource_enabled
(
resource
):
"""Test whether a resource is enabled. Known resources are set by
...
...
@@ -175,14 +176,9 @@ except IOError:
(
TESTFN
,
TMP_TESTFN
))
if
fp
is
not
None
:
fp
.
close
()
try
:
os
.
unlink
(
TESTFN
)
except
:
pass
unlink
(
TESTFN
)
del
os
,
fp
from
os
import
unlink
def
findfile
(
file
,
here
=
__file__
):
"""Try to find a file on sys.path and the working directory. If it is not
found the argument passed to the function is returned (this does not
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment