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
5501e6a7
Kaydet (Commit)
5501e6a7
authored
Mar 06, 2010
tarafından
Tarek Ziadé
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
fixed various failures and environment alterations in distutils.test_build_ext
üst
895ee241
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
27 deletions
+35
-27
test_build_ext.py
Lib/distutils/tests/test_build_ext.py
+35
-27
No files found.
Lib/distutils/tests/test_build_ext.py
Dosyayı görüntüle @
5501e6a7
...
@@ -19,10 +19,15 @@ ALREADY_TESTED = False
...
@@ -19,10 +19,15 @@ ALREADY_TESTED = False
def
_get_source_filename
():
def
_get_source_filename
():
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
srcdir
=
sysconfig
.
get_config_var
(
'srcdir'
)
fallback_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'xxmodule.c'
)
if
srcdir
is
None
:
if
srcdir
is
None
:
# local fallback
return
fallback_path
return
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'xxmodule.c'
)
locations
=
(
srcdir
,
os
.
path
.
dirname
(
sys
.
executable
))
return
os
.
path
.
join
(
srcdir
,
'Modules'
,
'xxmodule.c'
)
for
location
in
locations
:
path
=
os
.
path
.
join
(
location
,
'Modules'
,
'xxmodule.c'
)
if
os
.
path
.
exists
(
path
):
return
path
return
fallback_path
class
BuildExtTestCase
(
support
.
TempdirManager
,
class
BuildExtTestCase
(
support
.
TempdirManager
,
support
.
LoggingSilencer
,
support
.
LoggingSilencer
,
...
@@ -81,7 +86,7 @@ class BuildExtTestCase(support.TempdirManager,
...
@@ -81,7 +86,7 @@ class BuildExtTestCase(support.TempdirManager,
def
tearDown
(
self
):
def
tearDown
(
self
):
# Get everything back to normal
# Get everything back to normal
test_support
.
unload
(
'xx'
)
test_support
.
unload
(
'xx'
)
sys
.
path
=
self
.
sys_path
sys
.
path
[:]
=
self
.
sys_path
# XXX on Windows the test leaves a directory with xx module in TEMP
# XXX on Windows the test leaves a directory with xx module in TEMP
shutil
.
rmtree
(
self
.
tmp_dir
,
os
.
name
==
'nt'
or
sys
.
platform
==
'cygwin'
)
shutil
.
rmtree
(
self
.
tmp_dir
,
os
.
name
==
'nt'
or
sys
.
platform
==
'cygwin'
)
super
(
BuildExtTestCase
,
self
)
.
tearDown
()
super
(
BuildExtTestCase
,
self
)
.
tearDown
()
...
@@ -350,22 +355,31 @@ class BuildExtTestCase(support.TempdirManager,
...
@@ -350,22 +355,31 @@ class BuildExtTestCase(support.TempdirManager,
self
.
assertEquals
(
wanted
,
path
)
self
.
assertEquals
(
wanted
,
path
)
def
test_setuptools_compat
(
self
):
def
test_setuptools_compat
(
self
):
from
setuptools_build_ext
import
build_ext
as
setuptools_build_ext
import
distutils.core
,
distutils
.
extension
,
distutils
.
command
.
build_ext
from
setuptools_extension
import
Extension
saved_ext
=
distutils
.
extension
.
Extension
try
:
etree_c
=
os
.
path
.
join
(
self
.
tmp_dir
,
'lxml.etree.c'
)
# theses import patch Distutils' Extension class
etree_ext
=
Extension
(
'lxml.etree'
,
[
etree_c
])
from
setuptools_build_ext
import
build_ext
as
setuptools_build_ext
dist
=
Distribution
({
'name'
:
'lxml'
,
'ext_modules'
:
[
etree_ext
]})
from
setuptools_extension
import
Extension
cmd
=
setuptools_build_ext
(
dist
)
cmd
.
ensure_finalized
()
etree_c
=
os
.
path
.
join
(
self
.
tmp_dir
,
'lxml.etree.c'
)
cmd
.
inplace
=
1
etree_ext
=
Extension
(
'lxml.etree'
,
[
etree_c
])
cmd
.
distribution
.
package_dir
=
{
''
:
'src'
}
dist
=
Distribution
({
'name'
:
'lxml'
,
'ext_modules'
:
[
etree_ext
]})
cmd
.
distribution
.
packages
=
[
'lxml'
,
'lxml.html'
]
cmd
=
setuptools_build_ext
(
dist
)
curdir
=
os
.
getcwd
()
cmd
.
ensure_finalized
()
ext
=
sysconfig
.
get_config_var
(
"SO"
)
cmd
.
inplace
=
1
wanted
=
os
.
path
.
join
(
curdir
,
'src'
,
'lxml'
,
'etree'
+
ext
)
cmd
.
distribution
.
package_dir
=
{
''
:
'src'
}
path
=
cmd
.
get_ext_fullpath
(
'lxml.etree'
)
cmd
.
distribution
.
packages
=
[
'lxml'
,
'lxml.html'
]
self
.
assertEquals
(
wanted
,
path
)
curdir
=
os
.
getcwd
()
ext
=
sysconfig
.
get_config_var
(
"SO"
)
wanted
=
os
.
path
.
join
(
curdir
,
'src'
,
'lxml'
,
'etree'
+
ext
)
path
=
cmd
.
get_ext_fullpath
(
'lxml.etree'
)
self
.
assertEquals
(
wanted
,
path
)
finally
:
# restoring Distutils' Extension class otherwise its broken
distutils
.
extension
.
Extension
=
saved_ext
distutils
.
core
.
Extension
=
saved_ext
distutils
.
command
.
build_ext
.
Extension
=
saved_ext
def
test_build_ext_path_with_os_sep
(
self
):
def
test_build_ext_path_with_os_sep
(
self
):
dist
=
Distribution
({
'name'
:
'UpdateManager'
})
dist
=
Distribution
({
'name'
:
'UpdateManager'
})
...
@@ -391,13 +405,7 @@ class BuildExtTestCase(support.TempdirManager,
...
@@ -391,13 +405,7 @@ class BuildExtTestCase(support.TempdirManager,
self
.
assertEquals
(
ext_path
,
wanted
)
self
.
assertEquals
(
ext_path
,
wanted
)
def
test_suite
():
def
test_suite
():
src
=
_get_source_filename
()
return
unittest
.
makeSuite
(
BuildExtTestCase
)
if
not
os
.
path
.
exists
(
src
):
if
test_support
.
verbose
:
print
(
'test_build_ext: Cannot find source code (test'
' must run in python build dir)'
)
return
unittest
.
TestSuite
()
else
:
return
unittest
.
makeSuite
(
BuildExtTestCase
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
test_support
.
run_unittest
(
test_suite
())
test_support
.
run_unittest
(
test_suite
())
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