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
6ee96952
Kaydet (Commit)
6ee96952
authored
Tem 20, 2012
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #15091: Call importlib.invalidate_caches() and reactivate a test
of importing a symlinked package.
üst
ba52586f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
28 deletions
+19
-28
test_import.py
Lib/test/test_import.py
+15
-27
NEWS
Misc/NEWS
+4
-1
No files found.
Lib/test/test_import.py
Dosyayı görüntüle @
6ee96952
...
@@ -704,36 +704,34 @@ class PycacheTests(unittest.TestCase):
...
@@ -704,36 +704,34 @@ class PycacheTests(unittest.TestCase):
class
TestSymbolicallyLinkedPackage
(
unittest
.
TestCase
):
class
TestSymbolicallyLinkedPackage
(
unittest
.
TestCase
):
package_name
=
'sample'
package_name
=
'sample'
tagged
=
package_name
+
'-tagged'
def
setUp
(
self
):
def
setUp
(
self
):
if
os
.
path
.
exists
(
self
.
tagged
):
test
.
support
.
rmtree
(
self
.
tagged
)
shutil
.
rmtree
(
self
.
tagged
)
test
.
support
.
rmtree
(
self
.
package_name
)
if
os
.
path
.
exists
(
self
.
package_name
):
os
.
remove
(
self
.
package_name
)
self
.
orig_sys_path
=
sys
.
path
[:]
self
.
orig_sys_path
=
sys
.
path
[:]
# create a sample package; imagine you have a package with a tag and
# create a sample package; imagine you have a package with a tag and
# you want to symbolically link it from its untagged name.
# you want to symbolically link it from its untagged name.
os
.
mkdir
(
self
.
tagged
)
os
.
mkdir
(
self
.
tagged
)
self
.
addCleanup
(
test
.
support
.
rmtree
,
self
.
tagged
)
init_file
=
os
.
path
.
join
(
self
.
tagged
,
'__init__.py'
)
init_file
=
os
.
path
.
join
(
self
.
tagged
,
'__init__.py'
)
open
(
init_file
,
'w'
)
.
close
(
)
test
.
support
.
create_empty_file
(
init_file
)
self
.
assertEqual
(
os
.
path
.
exists
(
init_file
),
Tru
e
)
assert
os
.
path
.
exists
(
init_fil
e
)
# now create a symlink to the tagged package
# now create a symlink to the tagged package
# sample -> sample-tagged
# sample -> sample-tagged
os
.
symlink
(
self
.
tagged
,
self
.
package_name
)
os
.
symlink
(
self
.
tagged
,
self
.
package_name
)
self
.
addCleanup
(
test
.
support
.
unlink
,
self
.
package_name
)
importlib
.
invalidate_caches
()
# disabled because os.isdir currently fails (see issue 15093)
# disabled because os.isdir currently fails (see issue 15093)
# self.assertEqual(os.path.isdir(self.package_name), True)
# self.assertEqual(os.path.isdir(self.package_name), True)
self
.
assertEqual
(
assert
os
.
path
.
isfile
(
os
.
path
.
join
(
self
.
package_name
,
'__init__.py'
))
os
.
path
.
isfile
(
os
.
path
.
join
(
self
.
package_name
,
'__init__.py'
)),
True
,
)
@property
def
tearDown
(
self
):
def
tagged
(
self
):
sys
.
path
[:]
=
self
.
orig_sys_path
return
self
.
package_name
+
'-tagged'
# regression test for issue6727
# regression test for issue6727
@unittest.skipUnless
(
@unittest.skipUnless
(
...
@@ -741,24 +739,14 @@ class TestSymbolicallyLinkedPackage(unittest.TestCase):
...
@@ -741,24 +739,14 @@ class TestSymbolicallyLinkedPackage(unittest.TestCase):
or
sys
.
getwindowsversion
()
>=
(
6
,
0
),
or
sys
.
getwindowsversion
()
>=
(
6
,
0
),
"Windows Vista or later required"
)
"Windows Vista or later required"
)
@test.support.skip_unless_symlink
@test.support.skip_unless_symlink
@unittest.skipUnless
(
sys
.
platform
==
'win32'
,
"Test failing on Unix (see issue15091)"
)
def
test_symlinked_dir_importable
(
self
):
def
test_symlinked_dir_importable
(
self
):
# make sure sample can only be imported from the current directory.
# make sure sample can only be imported from the current directory.
sys
.
path
[:]
=
[
'.'
]
sys
.
path
[:]
=
[
'.'
]
assert
os
.
path
.
exists
(
self
.
package_name
)
assert
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
package_name
,
'__init__.py'
))
# and try to import the package
# Try to import the package
__import__
(
self
.
package_name
)
importlib
.
import_module
(
self
.
package_name
)
def
tearDown
(
self
):
# now cleanup
if
os
.
path
.
exists
(
self
.
package_name
):
os
.
remove
(
self
.
package_name
)
if
os
.
path
.
exists
(
self
.
tagged
):
shutil
.
rmtree
(
self
.
tagged
)
sys
.
path
[:]
=
self
.
orig_sys_path
@cpython_only
@cpython_only
...
...
Misc/NEWS
Dosyayı görüntüle @
6ee96952
...
@@ -181,7 +181,10 @@ Documentation
...
@@ -181,7 +181,10 @@ Documentation
Tests
Tests
-----
-----
-
Issue
#
15230
:
Adopted
a
more
systematic
approach
in
the
runpy
tests
-
Issue
#
15091
:
Reactivate
a
test
on
UNIX
which
was
failing
thanks
to
a
forgotten
importlib
.
invalidate_caches
()
call
.
-
Issue
#
15230
:
Adopted
a
more
systematic
approach
in
the
runpy
tests
.
-
Issue
#
15300
:
Ensure
the
temporary
test
working
directories
are
in
the
same
-
Issue
#
15300
:
Ensure
the
temporary
test
working
directories
are
in
the
same
parent
folder
when
running
tests
in
multiprocess
mode
from
a
Python
build
.
parent
folder
when
running
tests
in
multiprocess
mode
from
a
Python
build
.
...
...
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