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
dfc13e06
Kaydet (Commit)
dfc13e06
authored
Kas 17, 2016
tarafından
Xavier de Gaye
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue 26931: Skip the test_distutils tests using a compiler executable
that is not found
üst
00305ade
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
25 deletions
+46
-25
test_build_clib.py
Lib/distutils/tests/test_build_clib.py
+6
-14
test_build_ext.py
Lib/distutils/tests/test_build_ext.py
+6
-0
test_config_cmd.py
Lib/distutils/tests/test_config_cmd.py
+4
-1
test_install.py
Lib/distutils/tests/test_install.py
+4
-0
test_sysconfig.py
Lib/distutils/tests/test_sysconfig.py
+0
-9
__init__.py
Lib/test/support/__init__.py
+26
-1
No files found.
Lib/distutils/tests/test_build_clib.py
Dosyayı görüntüle @
dfc13e06
...
@@ -3,7 +3,7 @@ import unittest
...
@@ -3,7 +3,7 @@ import unittest
import
os
import
os
import
sys
import
sys
from
test.support
import
run_unittest
from
test.support
import
run_unittest
,
missing_compiler_executable
from
distutils.command.build_clib
import
build_clib
from
distutils.command.build_clib
import
build_clib
from
distutils.errors
import
DistutilsSetupError
from
distutils.errors
import
DistutilsSetupError
...
@@ -116,19 +116,11 @@ class BuildCLibTestCase(support.TempdirManager,
...
@@ -116,19 +116,11 @@ class BuildCLibTestCase(support.TempdirManager,
cmd
.
build_temp
=
build_temp
cmd
.
build_temp
=
build_temp
cmd
.
build_clib
=
build_temp
cmd
.
build_clib
=
build_temp
# before we run the command, we want to make sure
# Before we run the command, we want to make sure
# all commands are present on the system
# all commands are present on the system.
# by creating a compiler and checking its executables
ccmd
=
missing_compiler_executable
()
from
distutils.ccompiler
import
new_compiler
if
ccmd
is
not
None
:
from
distutils.sysconfig
import
customize_compiler
self
.
skipTest
(
'The
%
r command is not found'
%
ccmd
)
compiler
=
new_compiler
()
customize_compiler
(
compiler
)
for
ccmd
in
compiler
.
executables
.
values
():
if
ccmd
is
None
:
continue
if
find_executable
(
ccmd
[
0
])
is
None
:
self
.
skipTest
(
'The
%
r command is not found'
%
ccmd
[
0
])
# this should work
# this should work
cmd
.
run
()
cmd
.
run
()
...
...
Lib/distutils/tests/test_build_ext.py
Dosyayı görüntüle @
dfc13e06
...
@@ -41,6 +41,9 @@ class BuildExtTestCase(TempdirManager,
...
@@ -41,6 +41,9 @@ class BuildExtTestCase(TempdirManager,
return
build_ext
(
*
args
,
**
kwargs
)
return
build_ext
(
*
args
,
**
kwargs
)
def
test_build_ext
(
self
):
def
test_build_ext
(
self
):
cmd
=
support
.
missing_compiler_executable
()
if
cmd
is
not
None
:
self
.
skipTest
(
'The
%
r command is not found'
%
cmd
)
global
ALREADY_TESTED
global
ALREADY_TESTED
copy_xxmodule_c
(
self
.
tmp_dir
)
copy_xxmodule_c
(
self
.
tmp_dir
)
xx_c
=
os
.
path
.
join
(
self
.
tmp_dir
,
'xxmodule.c'
)
xx_c
=
os
.
path
.
join
(
self
.
tmp_dir
,
'xxmodule.c'
)
...
@@ -295,6 +298,9 @@ class BuildExtTestCase(TempdirManager,
...
@@ -295,6 +298,9 @@ class BuildExtTestCase(TempdirManager,
self
.
assertEqual
(
cmd
.
compiler
,
'unix'
)
self
.
assertEqual
(
cmd
.
compiler
,
'unix'
)
def
test_get_outputs
(
self
):
def
test_get_outputs
(
self
):
cmd
=
support
.
missing_compiler_executable
()
if
cmd
is
not
None
:
self
.
skipTest
(
'The
%
r command is not found'
%
cmd
)
tmp_dir
=
self
.
mkdtemp
()
tmp_dir
=
self
.
mkdtemp
()
c_file
=
os
.
path
.
join
(
tmp_dir
,
'foo.c'
)
c_file
=
os
.
path
.
join
(
tmp_dir
,
'foo.c'
)
self
.
write_file
(
c_file
,
'void PyInit_foo(void) {}
\n
'
)
self
.
write_file
(
c_file
,
'void PyInit_foo(void) {}
\n
'
)
...
...
Lib/distutils/tests/test_config_cmd.py
Dosyayı görüntüle @
dfc13e06
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
unittest
import
unittest
import
os
import
os
import
sys
import
sys
from
test.support
import
run_unittest
from
test.support
import
run_unittest
,
missing_compiler_executable
from
distutils.command.config
import
dump_file
,
config
from
distutils.command.config
import
dump_file
,
config
from
distutils.tests
import
support
from
distutils.tests
import
support
...
@@ -39,6 +39,9 @@ class ConfigTestCase(support.LoggingSilencer,
...
@@ -39,6 +39,9 @@ class ConfigTestCase(support.LoggingSilencer,
@unittest.skipIf
(
sys
.
platform
==
'win32'
,
"can't test on Windows"
)
@unittest.skipIf
(
sys
.
platform
==
'win32'
,
"can't test on Windows"
)
def
test_search_cpp
(
self
):
def
test_search_cpp
(
self
):
cmd
=
missing_compiler_executable
([
'preprocessor'
])
if
cmd
is
not
None
:
self
.
skipTest
(
'The
%
r command is not found'
%
cmd
)
pkg_dir
,
dist
=
self
.
create_dist
()
pkg_dir
,
dist
=
self
.
create_dist
()
cmd
=
config
(
dist
)
cmd
=
config
(
dist
)
...
...
Lib/distutils/tests/test_install.py
Dosyayı görüntüle @
dfc13e06
...
@@ -17,6 +17,7 @@ from distutils.errors import DistutilsOptionError
...
@@ -17,6 +17,7 @@ from distutils.errors import DistutilsOptionError
from
distutils.extension
import
Extension
from
distutils.extension
import
Extension
from
distutils.tests
import
support
from
distutils.tests
import
support
from
test
import
support
as
test_support
def
_make_ext_name
(
modname
):
def
_make_ext_name
(
modname
):
...
@@ -196,6 +197,9 @@ class InstallTestCase(support.TempdirManager,
...
@@ -196,6 +197,9 @@ class InstallTestCase(support.TempdirManager,
self
.
assertEqual
(
found
,
expected
)
self
.
assertEqual
(
found
,
expected
)
def
test_record_extensions
(
self
):
def
test_record_extensions
(
self
):
cmd
=
test_support
.
missing_compiler_executable
()
if
cmd
is
not
None
:
self
.
skipTest
(
'The
%
r command is not found'
%
cmd
)
install_dir
=
self
.
mkdtemp
()
install_dir
=
self
.
mkdtemp
()
project_dir
,
dist
=
self
.
create_dist
(
ext_modules
=
[
project_dir
,
dist
=
self
.
create_dist
(
ext_modules
=
[
Extension
(
'xx'
,
[
'xxmodule.c'
])])
Extension
(
'xx'
,
[
'xxmodule.c'
])])
...
...
Lib/distutils/tests/test_sysconfig.py
Dosyayı görüntüle @
dfc13e06
...
@@ -39,15 +39,6 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
...
@@ -39,15 +39,6 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
self
.
assertNotEqual
(
sysconfig
.
get_python_lib
(),
self
.
assertNotEqual
(
sysconfig
.
get_python_lib
(),
sysconfig
.
get_python_lib
(
prefix
=
TESTFN
))
sysconfig
.
get_python_lib
(
prefix
=
TESTFN
))
def
test_get_python_inc
(
self
):
inc_dir
=
sysconfig
.
get_python_inc
()
# This is not much of a test. We make sure Python.h exists
# in the directory returned by get_python_inc() but we don't know
# it is the correct file.
self
.
assertTrue
(
os
.
path
.
isdir
(
inc_dir
),
inc_dir
)
python_h
=
os
.
path
.
join
(
inc_dir
,
"Python.h"
)
self
.
assertTrue
(
os
.
path
.
isfile
(
python_h
),
python_h
)
def
test_get_config_vars
(
self
):
def
test_get_config_vars
(
self
):
cvars
=
sysconfig
.
get_config_vars
()
cvars
=
sysconfig
.
get_config_vars
()
self
.
assertIsInstance
(
cvars
,
dict
)
self
.
assertIsInstance
(
cvars
,
dict
)
...
...
Lib/test/support/__init__.py
Dosyayı görüntüle @
dfc13e06
...
@@ -105,7 +105,7 @@ __all__ = [
...
@@ -105,7 +105,7 @@ __all__ = [
"check_warnings"
,
"check_no_resource_warning"
,
"EnvironmentVarGuard"
,
"check_warnings"
,
"check_no_resource_warning"
,
"EnvironmentVarGuard"
,
"run_with_locale"
,
"swap_item"
,
"run_with_locale"
,
"swap_item"
,
"swap_attr"
,
"Matcher"
,
"set_memlimit"
,
"SuppressCrashReport"
,
"sortdict"
,
"swap_attr"
,
"Matcher"
,
"set_memlimit"
,
"SuppressCrashReport"
,
"sortdict"
,
"run_with_tz"
,
"PGO"
,
"run_with_tz"
,
"PGO"
,
"missing_compiler_executable"
,
]
]
class
Error
(
Exception
):
class
Error
(
Exception
):
...
@@ -2491,3 +2491,28 @@ def check_free_after_iterating(test, iter, cls, args=()):
...
@@ -2491,3 +2491,28 @@ def check_free_after_iterating(test, iter, cls, args=()):
# The sequence should be deallocated just after the end of iterating
# The sequence should be deallocated just after the end of iterating
gc_collect
()
gc_collect
()
test
.
assertTrue
(
done
)
test
.
assertTrue
(
done
)
def
missing_compiler_executable
(
cmd_names
=
[]):
"""Check if the compiler components used to build the interpreter exist.
Check for the existence of the compiler executables whose names are listed
in 'cmd_names' or all the compiler executables when 'cmd_names' is empty
and return the first missing executable or None when none is found
missing.
"""
from
distutils
import
ccompiler
,
sysconfig
,
spawn
compiler
=
ccompiler
.
new_compiler
()
sysconfig
.
customize_compiler
(
compiler
)
for
name
in
compiler
.
executables
:
if
cmd_names
and
name
not
in
cmd_names
:
continue
cmd
=
getattr
(
compiler
,
name
)
if
cmd_names
:
assert
cmd
is
not
None
,
\
"the '
%
s' executable is not configured"
%
name
elif
cmd
is
None
:
continue
if
spawn
.
find_executable
(
cmd
[
0
])
is
None
:
return
cmd
[
0
]
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