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
8554dcda
Commit
8554dcda
authored
Apr 28, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce testrunner disk io.
parent
81542476
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
14 deletions
+21
-14
runtests.py
runtests.py
+21
-14
No files found.
runtests.py
View file @
8554dcda
...
@@ -135,6 +135,8 @@ def memoize(f):
...
@@ -135,6 +135,8 @@ def memoize(f):
res
=
f
.
_cache
.
get
(
args
,
uncomputed
)
res
=
f
.
_cache
.
get
(
args
,
uncomputed
)
if
res
is
uncomputed
:
if
res
is
uncomputed
:
res
=
f
.
_cache
[
args
]
=
f
(
*
args
)
res
=
f
.
_cache
[
args
]
=
f
(
*
args
)
else
:
print
"dup"
,
args
return
res
return
res
return
func
return
func
...
@@ -159,6 +161,8 @@ def parse_tags(filepath):
...
@@ -159,6 +161,8 @@ def parse_tags(filepath):
parse_tags
=
memoize
(
parse_tags
)
parse_tags
=
memoize
(
parse_tags
)
list_unchanging_dir
=
memoize
(
lambda
x
:
os
.
listdir
(
x
))
class
build_ext
(
_build_ext
):
class
build_ext
(
_build_ext
):
def
build_extension
(
self
,
ext
):
def
build_extension
(
self
,
ext
):
...
@@ -245,7 +249,7 @@ class TestBuilder(object):
...
@@ -245,7 +249,7 @@ class TestBuilder(object):
os
.
makedirs
(
workdir
)
os
.
makedirs
(
workdir
)
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
filenames
=
os
.
list
dir
(
path
)
filenames
=
list_unchanging_
dir
(
path
)
filenames
.
sort
()
filenames
.
sort
()
for
filename
in
filenames
:
for
filename
in
filenames
:
filepath
=
os
.
path
.
join
(
path
,
filename
)
filepath
=
os
.
path
.
join
(
path
,
filename
)
...
@@ -414,19 +418,21 @@ class CythonCompileTestCase(unittest.TestCase):
...
@@ -414,19 +418,21 @@ class CythonCompileTestCase(unittest.TestCase):
def
build_target_filename
(
self
,
module_name
):
def
build_target_filename
(
self
,
module_name
):
target
=
'%s.%s'
%
(
module_name
,
self
.
language
)
target
=
'%s.%s'
%
(
module_name
,
self
.
language
)
return
target
return
target
def
copy_related_files
(
self
,
test_directory
,
targe
t_directory
,
module_name
):
def
related_files
(
self
,
tes
t_directory
,
module_name
):
is_related
=
re
.
compile
(
'%s_.*[.].*'
%
module_name
).
match
is_related
=
re
.
compile
(
'%s_.*[.].*'
%
module_name
).
match
for
filename
in
os
.
listdir
(
test_directory
):
return
[
filename
for
filename
in
list_unchanging_dir
(
test_directory
)
if
is_related
(
filename
):
if
is_related
(
filename
)]
shutil
.
copy
(
os
.
path
.
join
(
test_directory
,
filename
),
target_directory
)
def
copy_files
(
self
,
test_directory
,
target_directory
,
file_list
):
for
filename
in
file_list
:
shutil
.
copy
(
os
.
path
.
join
(
test_directory
,
filename
),
target_directory
)
def
find_source_files
(
self
,
workdir
,
module_name
):
def
source_files
(
self
,
workdir
,
module_name
,
file_list
):
is_related
=
re
.
compile
(
'%s_.*[.]%s'
%
(
module_name
,
self
.
language
)).
match
return
([
self
.
build_target_filename
(
module_name
)]
+
return
[
self
.
build_target_filename
(
module_name
)]
+
[
[
filename
for
filename
in
file_list
filename
for
filename
in
os
.
listdir
(
workdir
)
if
not
os
.
path
.
isfile
(
os
.
path
.
join
(
workdir
,
filename
))])
if
is_related
(
filename
)
and
os
.
path
.
isfile
(
os
.
path
.
join
(
workdir
,
filename
))
]
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'
)
...
@@ -507,10 +513,11 @@ class CythonCompileTestCase(unittest.TestCase):
...
@@ -507,10 +513,11 @@ class CythonCompileTestCase(unittest.TestCase):
if
extra_extension_args
is
None
:
if
extra_extension_args
is
None
:
extra_extension_args
=
{}
extra_extension_args
=
{}
self
.
copy_related_files
(
test_directory
,
workdir
,
module
)
related_files
=
self
.
related_files
(
test_directory
,
module
)
self
.
copy_files
(
test_directory
,
workdir
,
related_files
)
extension
=
Extension
(
extension
=
Extension
(
module
,
module
,
sources
=
self
.
find_source_files
(
workdir
,
module
),
sources
=
self
.
source_files
(
workdir
,
module
,
related_files
),
include_dirs
=
ext_include_dirs
,
include_dirs
=
ext_include_dirs
,
extra_compile_args
=
ext_compile_flags
,
extra_compile_args
=
ext_compile_flags
,
**
extra_extension_args
**
extra_extension_args
...
...
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