Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
18c69b1c
Commit
18c69b1c
authored
Jan 28, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release'
parents
56d9591a
8ff1807d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
152 additions
and
74 deletions
+152
-74
Cython/Debugger/Tests/TestLibCython.py
Cython/Debugger/Tests/TestLibCython.py
+129
-69
Cython/__init__.py
Cython/__init__.py
+1
-1
runtests.py
runtests.py
+22
-4
No files found.
Cython/Debugger/Tests/TestLibCython.py
View file @
18c69b1c
...
...
@@ -29,6 +29,49 @@ with open(codefile) as f:
# can't access the module anymore. Get it from sys.modules instead.
build_ext
=
sys
.
modules
[
'Cython.Distutils.build_ext'
]
have_gdb
=
None
def
test_gdb
():
global
have_gdb
if
have_gdb
is
None
:
try
:
p
=
subprocess
.
Popen
([
'gdb'
,
'-v'
],
stdout
=
subprocess
.
PIPE
)
have_gdb
=
True
except
OSError
:
# gdb was not installed
have_gdb
=
False
else
:
gdb_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
p
.
wait
()
p
.
stdout
.
close
()
if
have_gdb
:
# Based on Lib/test/test_gdb.py
regex
=
"^GNU gdb [^
\
d]*(
\
d+)
\
.(
\
d+)"
gdb_version_number
=
list
(
map
(
int
,
re
.
search
(
regex
,
gdb_version
).
groups
()))
if
gdb_version_number
>=
[
7
,
2
]:
python_version_script
=
tempfile
.
NamedTemporaryFile
(
mode
=
'w+'
)
python_version_script
.
write
(
'python import sys; print("%s %s" % sys.version_info[:2])'
)
python_version_script
.
flush
()
p
=
subprocess
.
Popen
([
'gdb'
,
'-batch'
,
'-x'
,
python_version_script
.
name
],
stdout
=
subprocess
.
PIPE
)
python_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
p
.
wait
()
python_version_number
=
list
(
map
(
int
,
python_version
.
split
()))
# Be Python 3 compatible
if
(
not
have_gdb
or
gdb_version_number
<
[
7
,
2
]
or
python_version_number
<
[
2
,
6
]):
warnings
.
warn
(
'Skipping gdb tests, need gdb >= 7.2 with Python >= 2.6'
)
have_gdb
=
False
return
have_gdb
class
DebuggerTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -36,6 +79,9 @@ class DebuggerTestCase(unittest.TestCase):
Run gdb and have cygdb import the debug information from the code
defined in TestParseTreeTransforms's setUp method
"""
if
not
test_gdb
():
return
self
.
tempdir
=
tempfile
.
mkdtemp
()
self
.
destfile
=
os
.
path
.
join
(
self
.
tempdir
,
'codefile.pyx'
)
self
.
debug_dest
=
os
.
path
.
join
(
self
.
tempdir
,
...
...
@@ -44,6 +90,7 @@ class DebuggerTestCase(unittest.TestCase):
self
.
cfuncs_destfile
=
os
.
path
.
join
(
self
.
tempdir
,
'cfuncs'
)
self
.
cwd
=
os
.
getcwd
()
try
:
os
.
chdir
(
self
.
tempdir
)
shutil
.
copy
(
codefile
,
self
.
destfile
)
...
...
@@ -99,7 +146,13 @@ class DebuggerTestCase(unittest.TestCase):
# cmdclass=dict(build_ext=Cython.Distutils.build_ext)
# )
except
:
os
.
chdir
(
self
.
cwd
)
raise
def
tearDown
(
self
):
if
not
test_gdb
():
return
os
.
chdir
(
self
.
cwd
)
shutil
.
rmtree
(
self
.
tempdir
)
...
...
@@ -107,6 +160,9 @@ class DebuggerTestCase(unittest.TestCase):
class
GdbDebuggerTestCase
(
DebuggerTestCase
):
def
setUp
(
self
):
if
not
test_gdb
():
return
super
(
GdbDebuggerTestCase
,
self
).
setUp
()
prefix_code
=
textwrap
.
dedent
(
'''
\
...
...
@@ -167,6 +223,11 @@ class GdbDebuggerTestCase(DebuggerTestCase):
p
.
stdout
.
close
()
if
have_gdb
:
# Based on Lib/test/test_gdb.py
regex
=
"^GNU gdb [^
\
d]*(
\
d+)
\
.(
\
d+)"
gdb_version_number
=
list
(
map
(
int
,
re
.
search
(
regex
,
gdb_version
).
groups
()))
if
gdb_version_number
>=
[
7
,
2
]:
python_version_script
=
tempfile
.
NamedTemporaryFile
(
mode
=
'w+'
)
python_version_script
.
write
(
'python import sys; print("%s %s" % sys.version_info[:2])'
)
...
...
@@ -175,16 +236,12 @@ class GdbDebuggerTestCase(DebuggerTestCase):
stdout
=
subprocess
.
PIPE
)
python_version
=
p
.
stdout
.
read
().
decode
(
'ascii'
)
p
.
wait
()
python_version_number
=
[
int
(
a
)
for
a
in
python_version
.
split
()]
python_version_number
=
list
(
map
(
int
,
python_version
.
split
()))
if
have_gdb
:
# Based on Lib/test/test_gdb.py
regex
=
"^GNU gdb [^
\
d]*(
\
d+)
\
.(
\
d+)"
gdb_version_number
=
re
.
search
(
regex
,
gdb_version
).
groups
()
# Be Python 3 compatible
if
(
not
have_gdb
or
list
(
map
(
int
,
gdb_version_number
))
<
[
7
,
2
]
or
gdb_version_number
<
[
7
,
2
]
or
python_version_number
<
[
2
,
6
]):
self
.
p
=
None
warnings
.
warn
(
...
...
@@ -197,6 +254,9 @@ class GdbDebuggerTestCase(DebuggerTestCase):
env
=
env
)
def
tearDown
(
self
):
if
not
test_gdb
():
return
super
(
GdbDebuggerTestCase
,
self
).
tearDown
()
if
self
.
p
:
self
.
p
.
stderr
.
close
()
...
...
@@ -207,7 +267,7 @@ class GdbDebuggerTestCase(DebuggerTestCase):
class
TestAll
(
GdbDebuggerTestCase
):
def
test_all
(
self
):
if
self
.
p
is
None
:
if
not
test_gdb
()
:
return
out
,
err
=
self
.
p
.
communicate
()
...
...
Cython/__init__.py
View file @
18c69b1c
__version__
=
"0.14.1rc
2
"
__version__
=
"0.14.1rc
3
"
# Void cython.* directives (for case insensitive operating systems).
from
Cython.Shadow
import
*
runtests.py
View file @
18c69b1c
...
...
@@ -26,6 +26,18 @@ try:
except
ImportError
:
# No threads, no problems
threading
=
None
if
sys
.
platform
==
'win32'
:
# TODO: Figure out why this hackery (see http://thread.gmane.org/gmane.comp.python.cython.devel/8280/).
config_files
=
distutils_distro
.
find_config_files
()
try
:
config_files
.
remove
(
'setup.cfg'
)
except
ValueError
:
pass
distutils_distro
.
parse_config_files
(
config_files
)
cfgfiles
=
distutils_distro
.
find_config_files
()
try
:
cfgfiles
.
remove
(
'setup.cfg'
)
except
ValueError
:
pass
distutils_distro
.
parse_config_files
(
cfgfiles
)
WITH_CYTHON
=
True
...
...
@@ -981,6 +993,9 @@ def check_thread_termination(ignore_seen=True):
raise
PendingThreadsError
(
"left-over threads found after running test"
)
def
main
():
DISTDIR
=
os
.
path
.
join
(
os
.
getcwd
(),
os
.
path
.
dirname
(
sys
.
argv
[
0
]))
from
optparse
import
OptionParser
parser
=
OptionParser
()
parser
.
add_option
(
"--no-cleanup"
,
dest
=
"cleanup_workdir"
,
...
...
@@ -1051,12 +1066,15 @@ def main():
parser
.
add_option
(
"--exit-ok"
,
dest
=
"exit_ok"
,
default
=
False
,
action
=
"store_true"
,
help
=
"exit without error code even on test failures"
)
parser
.
add_option
(
"--root-dir"
,
dest
=
"root_dir"
,
default
=
os
.
path
.
join
(
DISTDIR
,
'tests'
),
help
=
"working directory"
)
parser
.
add_option
(
"--work-dir"
,
dest
=
"work_dir"
,
default
=
os
.
path
.
join
(
os
.
getcwd
(),
'BUILD'
),
help
=
"working directory"
)
options
,
cmd_args
=
parser
.
parse_args
()
DISTDIR
=
os
.
path
.
join
(
os
.
getcwd
(),
os
.
path
.
dirname
(
sys
.
argv
[
0
]))
ROOTDIR
=
os
.
path
.
join
(
DISTDIR
,
'tests'
)
WORKDIR
=
os
.
path
.
join
(
os
.
getcwd
(),
'BUILD'
)
ROOTDIR
=
os
.
path
.
abspath
(
options
.
root_dir
)
WORKDIR
=
os
.
path
.
abspath
(
options
.
work_dir
)
if
sys
.
version_info
[
0
]
>=
3
:
options
.
doctests
=
False
...
...
@@ -1167,7 +1185,7 @@ def main():
exclude_selectors
+=
[
re
.
compile
(
r
,
re
.
I
|
re
.
U
).
search
for
r
in
options
.
exclude
]
if
not
test_bugs
:
exclude_selectors
+=
[
FileListExcluder
(
"tests/bugs.txt"
)
]
exclude_selectors
+=
[
FileListExcluder
(
os
.
path
.
join
(
ROOTDIR
,
"bugs.txt"
)
)
]
if
sys
.
platform
in
[
'win32'
,
'cygwin'
]
and
sys
.
version_info
<
(
2
,
6
):
exclude_selectors
+=
[
lambda
x
:
x
==
"run.specialfloat"
]
...
...
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