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
40545bda
Commit
40545bda
authored
Apr 07, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes for I/O handling in test runner
parent
10cbc927
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
runtests.py
runtests.py
+23
-14
No files found.
runtests.py
View file @
40545bda
...
@@ -22,6 +22,11 @@ try:
...
@@ -22,6 +22,11 @@ try:
except
ImportError
:
except
ImportError
:
import
pickle
import
pickle
try
:
from
io
import
open
as
io_open
except
ImportError
:
from
codecs
import
open
as
io_open
try
:
try
:
import
threading
import
threading
except
ImportError
:
# No threads, no problems
except
ImportError
:
# No threads, no problems
...
@@ -130,17 +135,21 @@ def memoize(f):
...
@@ -130,17 +135,21 @@ def memoize(f):
def parse_tags(filepath):
def parse_tags(filepath):
tags = defaultdict(list)
tags = defaultdict(list)
for line in open(filepath):
f = io_open(filepath, encoding='
ISO
-
8859
-
1
', errors='
replace
')
line = line.strip()
try:
if not line:
for line in f:
continue
line = line.strip()
if line[0] != '
#':
if not line:
break
continue
ix
=
line
.
find
(
':'
)
if line[0] != '
#':
if
ix
!=
-
1
:
break
tag
=
line
[
1
:
ix
].
strip
()
ix
=
line
.
find
(
':'
)
values
=
line
[
ix
+
1
:].
split
(
','
)
if
ix
!=
-
1
:
tags
[
tag
].
extend
([
value
.
strip
()
for
value
in
values
])
tag
=
line
[
1
:
ix
].
strip
()
values
=
line
[
ix
+
1
:].
split
(
','
)
tags
[
tag
].
extend
([
value
.
strip
()
for
value
in
values
])
finally
:
f
.
close
()
return
tags
return
tags
parse_tags
=
memoize
(
parse_tags
)
parse_tags
=
memoize
(
parse_tags
)
...
@@ -400,10 +409,10 @@ class CythonCompileTestCase(unittest.TestCase):
...
@@ -400,10 +409,10 @@ class CythonCompileTestCase(unittest.TestCase):
def
split_source_and_output
(
self
,
test_directory
,
module
,
workdir
):
def
split_source_and_output
(
self
,
test_directory
,
module
,
workdir
):
source_file
=
self
.
find_module_source_file
(
os
.
path
.
join
(
test_directory
,
module
)
+
'.pyx'
)
source_file
=
self
.
find_module_source_file
(
os
.
path
.
join
(
test_directory
,
module
)
+
'.pyx'
)
source_and_output
=
codecs
.
open
(
source_file
,
'rU'
,
'ISO-8859-1'
)
source_and_output
=
io_open
(
source_file
,
'rU'
,
encoding
=
'ISO-8859-1'
)
try
:
try
:
out
=
codecs
.
open
(
os
.
path
.
join
(
workdir
,
module
+
os
.
path
.
splitext
(
source_file
)[
1
]),
out
=
io_
open
(
os
.
path
.
join
(
workdir
,
module
+
os
.
path
.
splitext
(
source_file
)[
1
]),
'w'
,
'ISO-8859-1'
)
'w'
,
encoding
=
'ISO-8859-1'
)
for
line
in
source_and_output
:
for
line
in
source_and_output
:
last_line
=
line
last_line
=
line
if
line
.
startswith
(
"_ERRORS"
):
if
line
.
startswith
(
"_ERRORS"
):
...
...
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