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
f1cfb622
Kaydet (Commit)
f1cfb622
authored
May 04, 2003
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
'forget' now also deletes any proper .pyo files.
Added some docstrings.
üst
015dd821
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
test_support.py
Lib/test/test_support.py
+19
-1
No files found.
Lib/test/test_support.py
Dosyayı görüntüle @
f1cfb622
"""Supporting definitions for the Python regression test."""
"""Supporting definitions for the Python regression test
s
."""
if
__name__
!=
'test.test_support'
:
raise
ImportError
,
'test_support must be imported from the test package'
...
...
@@ -50,6 +50,8 @@ def unload(name):
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
:
...
...
@@ -57,11 +59,24 @@ def forget(modname):
os
.
unlink
(
os
.
path
.
join
(
dirname
,
modname
+
'.pyc'
))
except
os
.
error
:
pass
# 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
+
'.pyo'
))
except
os
.
error
:
pass
def
is_resource_enabled
(
resource
):
"""Test whether a resource is enabled. Known resources are set by
regrtest.py."""
return
use_resources
is
not
None
and
resource
in
use_resources
def
requires
(
resource
,
msg
=
None
):
"""Raise ResourceDenied if the specified resource is not available.
If the caller's module is __main__ then automatically return True. The
possibility of False being returned occurs when regrtest.py is executing."""
# see if the caller's module is __main__ - if so, treat as if
# the resource was set
if
sys
.
_getframe
()
.
f_back
.
f_globals
.
get
(
"__name__"
)
==
"__main__"
:
...
...
@@ -141,6 +156,9 @@ 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
necessarily signal failure; could still be the legitimate path)."""
import
os
if
os
.
path
.
isabs
(
file
):
return
file
...
...
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