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
f4166d52
Commit
f4166d52
authored
Jan 08, 2011
by
Mark Florisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugger: Disable optimization for test cases manually as they don't use distutils.core.setup()
parent
8193f74a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
76 deletions
+111
-76
Cython/Debugger/Tests/TestLibCython.py
Cython/Debugger/Tests/TestLibCython.py
+11
-0
Cython/Debugger/Tests/test_libcython_in_gdb.py
Cython/Debugger/Tests/test_libcython_in_gdb.py
+100
-76
No files found.
Cython/Debugger/Tests/TestLibCython.py
View file @
f4166d52
...
@@ -16,6 +16,7 @@ from distutils import ccompiler
...
@@ -16,6 +16,7 @@ from distutils import ccompiler
import
runtests
import
runtests
import
Cython.Distutils.extension
import
Cython.Distutils.extension
import
Cython.Distutils.build_ext
from
Cython.Debugger
import
Cygdb
as
cygdb
from
Cython.Debugger
import
Cygdb
as
cygdb
root
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
root
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
...
@@ -24,6 +25,10 @@ cfuncs_file = os.path.join(root, 'cfuncs.c')
...
@@ -24,6 +25,10 @@ cfuncs_file = os.path.join(root, 'cfuncs.c')
with
open
(
codefile
)
as
f
:
with
open
(
codefile
)
as
f
:
source_to_lineno
=
dict
((
line
.
strip
(),
i
+
1
)
for
i
,
line
in
enumerate
(
f
))
source_to_lineno
=
dict
((
line
.
strip
(),
i
+
1
)
for
i
,
line
in
enumerate
(
f
))
# Cython.Distutils.__init__ imports build_ext from build_ext which means we
# can't access the module anymore. Get it from sys.modules instead.
build_ext
=
sys
.
modules
[
'Cython.Distutils.build_ext'
]
class
DebuggerTestCase
(
unittest
.
TestCase
):
class
DebuggerTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -52,6 +57,9 @@ class DebuggerTestCase(unittest.TestCase):
...
@@ -52,6 +57,9 @@ class DebuggerTestCase(unittest.TestCase):
module
=
'codefile'
,
module
=
'codefile'
,
)
)
optimization_disabler
=
build_ext
.
Optimization
()
optimization_disabler
.
disable_optimization
()
cython_compile_testcase
=
runtests
.
CythonCompileTestCase
(
cython_compile_testcase
=
runtests
.
CythonCompileTestCase
(
workdir
=
self
.
tempdir
,
workdir
=
self
.
tempdir
,
# we clean up everything (not only compiled files)
# we clean up everything (not only compiled files)
...
@@ -77,6 +85,8 @@ class DebuggerTestCase(unittest.TestCase):
...
@@ -77,6 +85,8 @@ class DebuggerTestCase(unittest.TestCase):
**
opts
**
opts
)
)
optimization_disabler
.
restore_state
()
# ext = Cython.Distutils.extension.Extension(
# ext = Cython.Distutils.extension.Extension(
# 'codefile',
# 'codefile',
# ['codefile.pyx'],
# ['codefile.pyx'],
...
@@ -95,6 +105,7 @@ class DebuggerTestCase(unittest.TestCase):
...
@@ -95,6 +105,7 @@ class DebuggerTestCase(unittest.TestCase):
class
GdbDebuggerTestCase
(
DebuggerTestCase
):
class
GdbDebuggerTestCase
(
DebuggerTestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
GdbDebuggerTestCase
,
self
).
setUp
()
super
(
GdbDebuggerTestCase
,
self
).
setUp
()
...
...
Cython/Debugger/Tests/test_libcython_in_gdb.py
View file @
f4166d52
...
@@ -14,6 +14,7 @@ import warnings
...
@@ -14,6 +14,7 @@ import warnings
import
unittest
import
unittest
import
textwrap
import
textwrap
import
tempfile
import
tempfile
import
functools
import
traceback
import
traceback
import
itertools
import
itertools
from
test
import
test_support
from
test
import
test_support
...
@@ -28,12 +29,35 @@ from Cython.Debugger.Tests import TestLibCython as test_libcython
...
@@ -28,12 +29,35 @@ from Cython.Debugger.Tests import TestLibCython as test_libcython
sys
.
argv
=
[
'gdb'
]
sys
.
argv
=
[
'gdb'
]
def
print_on_call_decorator
(
func
):
@
functools
.
wraps
(
func
)
def
wrapper
(
self
,
*
args
,
**
kwargs
):
_debug
(
type
(
self
).
__name__
,
func
.
__name__
)
try
:
return
func
(
self
,
*
args
,
**
kwargs
)
except
Exception
,
e
:
_debug
(
"An exception occurred:"
,
traceback
.
format_exc
(
e
))
raise
return
wrapper
class
TraceMethodCallMeta
(
type
):
def
__init__
(
self
,
name
,
bases
,
dict
):
for
func_name
,
func
in
dict
.
iteritems
():
if
inspect
.
isfunction
(
func
):
setattr
(
self
,
func_name
,
print_on_call_decorator
(
func
))
class
DebugTestCase
(
unittest
.
TestCase
):
class
DebugTestCase
(
unittest
.
TestCase
):
"""
"""
Base class for test cases. On teardown it kills the inferior and unsets
Base class for test cases. On teardown it kills the inferior and unsets
all breakpoints.
all breakpoints.
"""
"""
__metaclass__
=
TraceMethodCallMeta
def
__init__
(
self
,
name
):
def
__init__
(
self
,
name
):
super
(
DebugTestCase
,
self
).
__init__
(
name
)
super
(
DebugTestCase
,
self
).
__init__
(
name
)
self
.
cy
=
libcython
.
cy
self
.
cy
=
libcython
.
cy
...
...
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