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
Gwenaël Samain
cython
Commits
51714ebf
Commit
51714ebf
authored
Dec 09, 2010
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop Python 2.5 support + unicode UCS4 builds support + add more tests
parent
83940073
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
117 additions
and
66 deletions
+117
-66
Cython/Debugger/Tests/TestLibCython.py
Cython/Debugger/Tests/TestLibCython.py
+9
-6
Cython/Debugger/Tests/test_libcython_in_gdb.py
Cython/Debugger/Tests/test_libcython_in_gdb.py
+27
-12
Cython/Debugger/libpython.py
Cython/Debugger/libpython.py
+79
-46
runtests.py
runtests.py
+1
-1
setup.py
setup.py
+1
-1
No files found.
Cython/Debugger/Tests/TestLibCython.py
View file @
51714ebf
...
@@ -122,14 +122,16 @@ class GdbDebuggerTestCase(DebuggerTestCase):
...
@@ -122,14 +122,16 @@ class GdbDebuggerTestCase(DebuggerTestCase):
python
python
from Cython.Debugger.Tests import test_libcython_in_gdb
from Cython.Debugger.Tests import test_libcython_in_gdb
test_libcython_in_gdb.main()
test_libcython_in_gdb.main(
version=%r
)
end
end
'''
)
'''
%
(
sys
.
version_info
[:
2
],)
)
self
.
gdb_command_file
=
cygdb
.
make_command_file
(
self
.
tempdir
,
self
.
gdb_command_file
=
cygdb
.
make_command_file
(
self
.
tempdir
,
prefix_code
)
prefix_code
)
open
(
self
.
gdb_command_file
,
'a'
).
write
(
code
)
with
open
(
self
.
gdb_command_file
,
'a'
)
as
f
:
f
.
write
(
code
)
args
=
[
'gdb'
,
'-batch'
,
'-x'
,
self
.
gdb_command_file
,
'-n'
,
'--args'
,
args
=
[
'gdb'
,
'-batch'
,
'-x'
,
self
.
gdb_command_file
,
'-n'
,
'--args'
,
sys
.
executable
,
'-c'
,
'import codefile'
]
sys
.
executable
,
'-c'
,
'import codefile'
]
...
@@ -149,7 +151,7 @@ class GdbDebuggerTestCase(DebuggerTestCase):
...
@@ -149,7 +151,7 @@ class GdbDebuggerTestCase(DebuggerTestCase):
# gdb was not installed
# gdb was not installed
have_gdb
=
False
have_gdb
=
False
else
:
else
:
gdb_version
=
p
.
stdout
.
read
()
gdb_version
=
p
.
stdout
.
read
()
.
decode
(
'ascii'
)
p
.
wait
()
p
.
wait
()
p
.
stdout
.
close
()
p
.
stdout
.
close
()
...
@@ -158,7 +160,8 @@ class GdbDebuggerTestCase(DebuggerTestCase):
...
@@ -158,7 +160,8 @@ class GdbDebuggerTestCase(DebuggerTestCase):
regex
=
"^GNU gdb [^
\
d]*(
\
d+)
\
.(
\
d+)"
regex
=
"^GNU gdb [^
\
d]*(
\
d+)
\
.(
\
d+)"
gdb_version_number
=
re
.
search
(
regex
,
gdb_version
).
groups
()
gdb_version_number
=
re
.
search
(
regex
,
gdb_version
).
groups
()
if
not
have_gdb
or
map
(
int
,
gdb_version_number
)
<
[
7
,
2
]:
# Be Python 3 compatible
if
not
have_gdb
or
list
(
map
(
int
,
gdb_version_number
))
<
[
7
,
2
]:
self
.
p
=
None
self
.
p
=
None
warnings
.
warn
(
'Skipping gdb tests, need gdb >= 7.2'
)
warnings
.
warn
(
'Skipping gdb tests, need gdb >= 7.2'
)
else
:
else
:
...
@@ -186,7 +189,7 @@ class TestAll(GdbDebuggerTestCase):
...
@@ -186,7 +189,7 @@ class TestAll(GdbDebuggerTestCase):
border
=
'*'
*
30
border
=
'*'
*
30
start
=
'%s v INSIDE GDB v %s'
%
(
border
,
border
)
start
=
'%s v INSIDE GDB v %s'
%
(
border
,
border
)
end
=
'%s ^ INSIDE GDB ^ %s'
%
(
border
,
border
)
end
=
'%s ^ INSIDE GDB ^ %s'
%
(
border
,
border
)
errmsg
=
'
\
n
%s
\
n
%s%s'
%
(
start
,
err
,
end
)
errmsg
=
'
\
n
%s
\
n
%s%s'
%
(
start
,
err
.
decode
(
'UTF-8'
)
,
end
)
self
.
assertEquals
(
0
,
self
.
p
.
wait
(),
errmsg
)
self
.
assertEquals
(
0
,
self
.
p
.
wait
(),
errmsg
)
sys
.
stderr
.
write
(
err
)
sys
.
stderr
.
write
(
err
)
...
...
Cython/Debugger/Tests/test_libcython_in_gdb.py
View file @
51714ebf
...
@@ -24,7 +24,6 @@ from Cython.Debugger import libcython
...
@@ -24,7 +24,6 @@ from Cython.Debugger import libcython
from
Cython.Debugger
import
libpython
from
Cython.Debugger
import
libpython
from
Cython.Debugger.Tests
import
TestLibCython
as
test_libcython
from
Cython.Debugger.Tests
import
TestLibCython
as
test_libcython
# for some reason sys.argv is missing in gdb
# for some reason sys.argv is missing in gdb
sys
.
argv
=
[
'gdb'
]
sys
.
argv
=
[
'gdb'
]
...
@@ -204,6 +203,7 @@ class TestStep(DebugStepperTestCase):
...
@@ -204,6 +203,7 @@ class TestStep(DebugStepperTestCase):
self
.
assertEqual
(
str
(
pyframe
.
co_name
),
'join'
)
self
.
assertEqual
(
str
(
pyframe
.
co_name
),
'join'
)
assert
re
.
match
(
r'\
d+ de
f join\
(
', result), result
assert
re
.
match
(
r'\
d+ de
f join\
(
', result), result
class TestNext(DebugStepperTestCase):
class TestNext(DebugStepperTestCase):
def test_cython_next(self):
def test_cython_next(self):
...
@@ -345,17 +345,18 @@ class TestExec(DebugTestCase):
...
@@ -345,17 +345,18 @@ class TestExec(DebugTestCase):
self
.
assertEqual
(
'14'
,
self
.
eval_command
(
'some_random_var'
))
self
.
assertEqual
(
'14'
,
self
.
eval_command
(
'some_random_var'
))
_do_debug
=
os
.
environ
.
get
(
'
CYTHON_
GDB_DEBUG'
)
_do_debug
=
os
.
environ
.
get
(
'GDB_DEBUG'
)
if
_do_debug
:
if
_do_debug
:
_debug_file
=
open
(
'/dev/tty'
,
'w'
)
_debug_file
=
open
(
'/dev/tty'
,
'w'
)
def
_debug
(
*
messages
):
def
_debug
(
*
messages
):
if
_do_debug
:
if
_do_debug
:
messages
=
itertools
.
chain
([
sys
.
_getframe
(
1
).
f_code
.
co_name
],
messages
=
itertools
.
chain
([
sys
.
_getframe
(
1
).
f_code
.
co_name
,
':'
],
messages
)
messages
)
_debug_file
.
write
(
' '
.
join
(
str
(
msg
)
for
msg
in
messages
)
+
'
\
n
'
)
_debug_file
.
write
(
' '
.
join
(
str
(
msg
)
for
msg
in
messages
)
+
'
\
n
'
)
def
_main
():
def
run_unittest_in_module
(
modulename
):
try
:
try
:
gdb
.
lookup_type
(
'PyModuleObject'
)
gdb
.
lookup_type
(
'PyModuleObject'
)
except
RuntimeError
:
except
RuntimeError
:
...
@@ -365,7 +366,7 @@ def _main():
...
@@ -365,7 +366,7 @@ def _main():
warnings
.
warn
(
msg
)
warnings
.
warn
(
msg
)
os
.
_exit
(
1
)
os
.
_exit
(
1
)
else
:
else
:
m
=
__import__
(
__name__
,
fromlist
=
[
''
])
m
=
__import__
(
modulename
,
fromlist
=
[
''
])
tests
=
inspect
.
getmembers
(
m
,
inspect
.
isclass
)
tests
=
inspect
.
getmembers
(
m
,
inspect
.
isclass
)
# test_support.run_unittest(tests)
# test_support.run_unittest(tests)
...
@@ -375,15 +376,29 @@ def _main():
...
@@ -375,15 +376,29 @@ def _main():
[
test_loader
.
loadTestsFromTestCase
(
cls
)
for
name
,
cls
in
tests
])
[
test_loader
.
loadTestsFromTestCase
(
cls
)
for
name
,
cls
in
tests
])
result
=
unittest
.
TextTestRunner
(
verbosity
=
1
).
run
(
suite
)
result
=
unittest
.
TextTestRunner
(
verbosity
=
1
).
run
(
suite
)
if
not
result
.
wasSuccessful
():
return
result
.
wasSuccessful
()
os
.
_exit
(
1
)
def
main
(
trace_code
=
False
):
def
runtests
():
"""
Run the libcython and libpython tests. Ensure that an appropriate status is
returned to the parent test process.
"""
from
Cython.Debugger.Tests
import
test_libpython_in_gdb
success_libcython
=
run_unittest_in_module
(
__name__
)
success_libpython
=
run_unittest_in_module
(
test_libpython_in_gdb
.
__name__
)
if
not
success_libcython
or
not
success_libpython
:
sys
.
exit
(
1
)
def
main
(
version
,
trace_code
=
False
):
global
inferior_python_version
inferior_python_version
=
version
if
trace_code
:
if
trace_code
:
tracer
=
trace
.
Trace
(
count
=
False
,
trace
=
True
,
outfile
=
sys
.
stderr
,
tracer
=
trace
.
Trace
(
count
=
False
,
trace
=
True
,
outfile
=
sys
.
stderr
,
ignoredirs
=
[
sys
.
prefix
,
sys
.
exec_prefix
])
ignoredirs
=
[
sys
.
prefix
,
sys
.
exec_prefix
])
tracer
.
runfunc
(
_main
)
tracer
.
runfunc
(
runtests
)
else
:
else
:
_main
()
runtests
()
\ No newline at end of file
main
()
\ No newline at end of file
Cython/Debugger/libpython.py
View file @
51714ebf
This diff is collapsed.
Click to expand it.
runtests.py
View file @
51714ebf
...
@@ -643,7 +643,7 @@ class CythonUnitTestCase(CythonCompileTestCase):
...
@@ -643,7 +643,7 @@ class CythonUnitTestCase(CythonCompileTestCase):
except
Exception
:
except
Exception
:
pass
pass
include_debugger
=
sys
.
version_info
[:
2
]
>
(
2
,
4
)
include_debugger
=
sys
.
version_info
[:
2
]
>
(
2
,
5
)
def
collect_unittests
(
path
,
module_prefix
,
suite
,
selectors
):
def
collect_unittests
(
path
,
module_prefix
,
suite
,
selectors
):
def
file_matches
(
filename
):
def
file_matches
(
filename
):
...
...
setup.py
View file @
51714ebf
...
@@ -71,7 +71,7 @@ else:
...
@@ -71,7 +71,7 @@ else:
setuptools_extra_args
=
{}
setuptools_extra_args
=
{}
# tells whether to include cygdb (the script and the Cython.Debugger package
# tells whether to include cygdb (the script and the Cython.Debugger package
include_debugger
=
sys
.
version_info
[:
2
]
>
(
2
,
4
)
include_debugger
=
sys
.
version_info
[:
2
]
>
(
2
,
5
)
if
'setuptools'
in
sys
.
modules
:
if
'setuptools'
in
sys
.
modules
:
setuptools_extra_args
[
'zip_safe'
]
=
False
setuptools_extra_args
[
'zip_safe'
]
=
False
...
...
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