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
9529fbfd
Kaydet (Commit)
9529fbfd
authored
Haz 15, 2013
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17177: Stop using imp in a bunch of tests
üst
8a2a902f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
15 deletions
+17
-15
script_helper.py
Lib/test/script_helper.py
+1
-1
support.py
Lib/test/support.py
+4
-4
test_pdb.py
Lib/test/test_pdb.py
+2
-2
test_pkgimport.py
Lib/test/test_pkgimport.py
+1
-1
test_pkgutil.py
Lib/test/test_pkgutil.py
+2
-2
test_reprlib.py
Lib/test/test_reprlib.py
+3
-2
test_zipimport.py
Lib/test/test_zipimport.py
+4
-3
No files found.
Lib/test/script_helper.py
Dosyayı görüntüle @
9529fbfd
...
...
@@ -12,7 +12,7 @@ import contextlib
import
shutil
import
zipfile
from
imp
import
source_from_cache
from
imp
ortlib.util
import
source_from_cache
from
test.support
import
make_legacy_pyc
,
strip_python_stderr
# Executing the interpreter in a subprocess
...
...
Lib/test/support.py
Dosyayı görüntüle @
9529fbfd
...
...
@@ -15,10 +15,10 @@ import shutil
import
warnings
import
unittest
import
importlib
import
importlib.util
import
collections.abc
import
re
import
subprocess
import
imp
import
time
import
sysconfig
import
fnmatch
...
...
@@ -316,7 +316,7 @@ def make_legacy_pyc(source):
does not need to exist, however the PEP 3147 pyc file must exist.
:return: The file system path to the legacy pyc file.
"""
pyc_file
=
imp
.
cache_from_source
(
source
)
pyc_file
=
imp
ortlib
.
util
.
cache_from_source
(
source
)
up_one
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
source
))
legacy_pyc
=
os
.
path
.
join
(
up_one
,
source
+
(
'c'
if
__debug__
else
'o'
))
os
.
rename
(
pyc_file
,
legacy_pyc
)
...
...
@@ -335,8 +335,8 @@ def forget(modname):
# combinations of PEP 3147 and legacy pyc and pyo files.
unlink
(
source
+
'c'
)
unlink
(
source
+
'o'
)
unlink
(
imp
.
cache_from_source
(
source
,
debug_override
=
True
))
unlink
(
imp
.
cache_from_source
(
source
,
debug_override
=
False
))
unlink
(
imp
ortlib
.
util
.
cache_from_source
(
source
,
debug_override
=
True
))
unlink
(
imp
ortlib
.
util
.
cache_from_source
(
source
,
debug_override
=
False
))
# On some platforms, should not run gui test even if it is allowed
# in `use_resources'.
...
...
Lib/test/test_pdb.py
Dosyayı görüntüle @
9529fbfd
# A test suite for pdb; not very comprehensive at the moment.
import
doctest
import
imp
import
pdb
import
sys
import
types
import
unittest
import
subprocess
import
textwrap
...
...
@@ -464,7 +464,7 @@ def test_pdb_skip_modules():
# Module for testing skipping of module that makes a callback
mod
=
imp
.
new_modul
e
(
'module_to_skip'
)
mod
=
types
.
ModuleTyp
e
(
'module_to_skip'
)
exec
(
'def foo_pony(callback): x = 1; callback(); return None'
,
mod
.
__dict__
)
...
...
Lib/test/test_pkgimport.py
Dosyayı görüntüle @
9529fbfd
...
...
@@ -6,7 +6,7 @@ import random
import
tempfile
import
unittest
from
imp
import
cache_from_source
from
imp
ortlib.util
import
cache_from_source
from
test.support
import
run_unittest
,
create_empty_file
class
TestImport
(
unittest
.
TestCase
):
...
...
Lib/test/test_pkgutil.py
Dosyayı görüntüle @
9529fbfd
from
test.support
import
run_unittest
,
unload
,
check_warnings
import
unittest
import
sys
import
imp
import
importlib
import
pkgutil
import
os
import
os.path
import
tempfile
import
types
import
shutil
import
zipfile
...
...
@@ -105,7 +105,7 @@ class PkgutilPEP302Tests(unittest.TestCase):
class
MyTestLoader
(
object
):
def
load_module
(
self
,
fullname
):
# Create an empty module
mod
=
sys
.
modules
.
setdefault
(
fullname
,
imp
.
new_modul
e
(
fullname
))
mod
=
sys
.
modules
.
setdefault
(
fullname
,
types
.
ModuleTyp
e
(
fullname
))
mod
.
__file__
=
"<
%
s>"
%
self
.
__class__
.
__name__
mod
.
__loader__
=
self
# Make it a package
...
...
Lib/test/test_reprlib.py
Dosyayı görüntüle @
9529fbfd
...
...
@@ -3,11 +3,11 @@
Nick Mathewson
"""
import
imp
import
sys
import
os
import
shutil
import
importlib
import
importlib.util
import
unittest
from
test.support
import
run_unittest
,
create_empty_file
,
verbose
...
...
@@ -241,7 +241,8 @@ class LongReprTest(unittest.TestCase):
source_path_len
+=
2
*
(
len
(
self
.
longname
)
+
1
)
# a path separator + `module_name` + ".py"
source_path_len
+=
len
(
module_name
)
+
1
+
len
(
".py"
)
cached_path_len
=
source_path_len
+
len
(
imp
.
cache_from_source
(
"x.py"
))
-
len
(
"x.py"
)
cached_path_len
=
(
source_path_len
+
len
(
importlib
.
util
.
cache_from_source
(
"x.py"
))
-
len
(
"x.py"
))
if
os
.
name
==
'nt'
and
cached_path_len
>=
258
:
# Under Windows, the max path len is 260 including C's terminating
# NUL character.
...
...
Lib/test/test_zipimport.py
Dosyayı görüntüle @
9529fbfd
import
sys
import
os
import
marshal
import
imp
import
imp
ortlib.util
import
struct
import
time
import
unittest
...
...
@@ -34,7 +34,8 @@ def make_pyc(co, mtime, size):
mtime
=
int
(
mtime
)
else
:
mtime
=
int
(
-
0x100000000
+
int
(
mtime
))
pyc
=
imp
.
get_magic
()
+
struct
.
pack
(
"<ii"
,
int
(
mtime
),
size
&
0xFFFFFFFF
)
+
data
pyc
=
(
importlib
.
util
.
MAGIC_NUMBER
+
struct
.
pack
(
"<ii"
,
int
(
mtime
),
size
&
0xFFFFFFFF
)
+
data
)
return
pyc
def
module_path_to_dotted_name
(
path
):
...
...
@@ -49,7 +50,7 @@ TESTPACK = "ziptestpackage"
TESTPACK2
=
"ziptestpackage2"
TEMP_ZIP
=
os
.
path
.
abspath
(
"junk95142.zip"
)
pyc_file
=
imp
.
cache_from_source
(
TESTMOD
+
'.py'
)
pyc_file
=
imp
ortlib
.
util
.
cache_from_source
(
TESTMOD
+
'.py'
)
pyc_ext
=
(
'.pyc'
if
__debug__
else
'.pyo'
)
...
...
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