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
7ca63cb7
Kaydet (Commit)
7ca63cb7
authored
Tem 16, 2016
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix regressions introduced by fixes for issue #27083.
üst
702b0460
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
22 deletions
+28
-22
_bootstrap_external.py
Lib/importlib/_bootstrap_external.py
+10
-4
test_case_sensitivity.py
Lib/test/test_importlib/extension/test_case_sensitivity.py
+6
-8
test_case_sensitivity.py
Lib/test/test_importlib/source/test_case_sensitivity.py
+3
-10
util.py
Lib/test/test_importlib/util.py
+9
-0
importlib_external.h
Python/importlib_external.h
+0
-0
No files found.
Lib/importlib/_bootstrap_external.py
Dosyayı görüntüle @
7ca63cb7
...
...
@@ -21,16 +21,22 @@ work. One should use importlib as the public-facing version of this module.
# anything specified at the class level.
# Bootstrap-related code ######################################################
_CASE_INSENSITIVE_PLATFORMS
=
'win'
,
'cygwin'
,
'darwin'
_CASE_INSENSITIVE_PLATFORMS_STR_KEY
=
'win'
,
_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY
=
'cygwin'
,
'darwin'
_CASE_INSENSITIVE_PLATFORMS
=
(
_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY
+
_CASE_INSENSITIVE_PLATFORMS_STR_KEY
)
def
_make_relax_case
():
if
sys
.
platform
.
startswith
(
_CASE_INSENSITIVE_PLATFORMS
):
if
sys
.
platform
.
startswith
(
_CASE_INSENSITIVE_PLATFORMS_STR_KEY
):
key
=
'PYTHONCASEOK'
else
:
key
=
b
'PYTHONCASEOK'
def
_relax_case
():
"""True if filenames must be checked case-insensitively."""
return
(
b
'PYTHONCASEOK'
in
_os
.
environ
or
'PYTHONCASEOK'
in
_os
.
environ
)
return
key
in
_os
.
environ
else
:
def
_relax_case
():
"""True if filenames must be checked case-insensitively."""
...
...
Lib/test/test_importlib/extension/test_case_sensitivity.py
Dosyayı görüntüle @
7ca63cb7
...
...
@@ -5,6 +5,7 @@ import unittest
from
..
import
util
importlib
=
util
.
import_importlib
(
'importlib'
)
machinery
=
util
.
import_importlib
(
'importlib.machinery'
)
...
...
@@ -12,7 +13,7 @@ machinery = util.import_importlib('importlib.machinery')
@unittest.skipIf
(
util
.
EXTENSIONS
.
filename
is
None
,
'_testcapi not available'
)
@util.case_insensitive_tests
class
ExtensionModuleCaseSensitivityTest
:
class
ExtensionModuleCaseSensitivityTest
(
util
.
CASEOKTestBase
)
:
def
find_module
(
self
):
good_name
=
util
.
EXTENSIONS
.
name
...
...
@@ -26,25 +27,22 @@ class ExtensionModuleCaseSensitivityTest:
def
test_case_sensitive
(
self
):
with
support
.
EnvironmentVarGuard
()
as
env
:
env
.
unset
(
'PYTHONCASEOK'
)
if
b
'PYTHONCASEOK'
in
_bootstrap_external
.
_os
.
environ
:
self
.
skipTest
(
'os.environ changes not reflected in '
'_os.environ'
)
self
.
caseok_env_changed
(
should_exist
=
False
)
loader
=
self
.
find_module
()
self
.
assertIsNone
(
loader
)
def
test_case_insensitivity
(
self
):
with
support
.
EnvironmentVarGuard
()
as
env
:
env
.
set
(
'PYTHONCASEOK'
,
'1'
)
if
b
'PYTHONCASEOK'
not
in
_bootstrap_external
.
_os
.
environ
:
self
.
skipTest
(
'os.environ changes not reflected in '
'_os.environ'
)
self
.
caseok_env_changed
(
should_exist
=
True
)
loader
=
self
.
find_module
()
self
.
assertTrue
(
hasattr
(
loader
,
'load_module'
))
(
Frozen_ExtensionCaseSensitivity
,
Source_ExtensionCaseSensitivity
)
=
util
.
test_both
(
ExtensionModuleCaseSensitivityTest
,
machinery
=
machinery
)
)
=
util
.
test_both
(
ExtensionModuleCaseSensitivityTest
,
importlib
=
importlib
,
machinery
=
machinery
)
if
__name__
==
'__main__'
:
...
...
Lib/test/test_importlib/source/test_case_sensitivity.py
Dosyayı görüntüle @
7ca63cb7
...
...
@@ -11,7 +11,7 @@ import unittest
@util.case_insensitive_tests
class
CaseSensitivityTest
:
class
CaseSensitivityTest
(
util
.
CASEOKTestBase
)
:
"""PEP 235 dictates that on case-preserving, case-insensitive file systems
that imports are case-sensitive unless the PYTHONCASEOK environment
...
...
@@ -39,17 +39,10 @@ class CaseSensitivityTest:
insensitive_finder
=
self
.
finder
(
insensitive_path
)
return
self
.
find
(
sensitive_finder
),
self
.
find
(
insensitive_finder
)
def
env_changed
(
self
,
*
,
should_exist
):
possibilities
=
b
'PYTHONCASEOK'
,
'PYTHONCASEOK'
if
any
(
x
in
self
.
importlib
.
_bootstrap_external
.
_os
.
environ
for
x
in
possibilities
)
==
should_exist
:
self
.
skipTest
(
'os.environ changes not reflected in '
'_os.environ'
)
def
test_sensitive
(
self
):
with
test_support
.
EnvironmentVarGuard
()
as
env
:
env
.
unset
(
'PYTHONCASEOK'
)
self
.
env_changed
(
should_exist
=
False
)
self
.
caseok_
env_changed
(
should_exist
=
False
)
sensitive
,
insensitive
=
self
.
sensitivity_test
()
self
.
assertIsNotNone
(
sensitive
)
self
.
assertIn
(
self
.
name
,
sensitive
.
get_filename
(
self
.
name
))
...
...
@@ -58,7 +51,7 @@ class CaseSensitivityTest:
def
test_insensitive
(
self
):
with
test_support
.
EnvironmentVarGuard
()
as
env
:
env
.
set
(
'PYTHONCASEOK'
,
'1'
)
self
.
env_changed
(
should_exist
=
True
)
self
.
caseok_
env_changed
(
should_exist
=
True
)
sensitive
,
insensitive
=
self
.
sensitivity_test
()
self
.
assertIsNotNone
(
sensitive
)
self
.
assertIn
(
self
.
name
,
sensitive
.
get_filename
(
self
.
name
))
...
...
Lib/test/test_importlib/util.py
Dosyayı görüntüle @
7ca63cb7
...
...
@@ -378,3 +378,12 @@ def mock_path_hook(*entries, importer):
raise
ImportError
return
importer
return
hook
class
CASEOKTestBase
:
def
caseok_env_changed
(
self
,
*
,
should_exist
):
possibilities
=
b
'PYTHONCASEOK'
,
'PYTHONCASEOK'
if
any
(
x
in
self
.
importlib
.
_bootstrap_external
.
_os
.
environ
for
x
in
possibilities
)
!=
should_exist
:
self
.
skipTest
(
'os.environ changes not reflected in _os.environ'
)
Python/importlib_external.h
Dosyayı görüntüle @
7ca63cb7
This diff is collapsed.
Click to expand it.
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