Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
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
pyodide
Commits
fb13af04
Commit
fb13af04
authored
Sep 06, 2018
by
Roman Yurchak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor tests/make_test_list.py
parent
4da3106a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
21 deletions
+33
-21
test/make_test_list.py
test/make_test_list.py
+33
-21
No files found.
test/make_test_list.py
View file @
fb13af04
...
...
@@ -5,24 +5,36 @@ Generate a list of test modules in the CPython distribution.
import
os
from
pathlib
import
Path
tests
=
[]
TEST_DIR
=
Path
(
"../cpython/build/3.6.4/host/lib/python3.6/test"
)
for
root
,
dirs
,
files
in
os
.
walk
(
"../cpython/build/3.6.4/host/lib/python3.6/test"
):
root
=
Path
(
root
).
relative_to
(
TEST_DIR
)
if
root
==
'.'
:
root
=
''
else
:
root
=
'.'
.
join
(
root
.
split
(
'/'
))
+
'.'
for
filename
in
files
:
filename
=
Path
(
filename
)
if
str
(
filename
).
startswith
(
"test_"
)
and
filename
.
suffix
==
".py"
:
tests
.
append
(
str
(
root
/
filename
.
stem
))
tests
.
sort
()
with
open
(
"python_tests.txt"
,
"w"
)
as
fp
:
for
test
in
tests
:
fp
.
write
(
test
+
'
\
n
'
)
TEST_DIR
=
(
Path
(
__file__
).
parent
/
"cpython/build/3.6.4/host/lib/python3.6/test"
)
def
collect_tests
(
base_dir
):
"""Collect CPython unit tests"""
# Note: this functionality is somewhat equivalent to pytest test
# collection.
tests
=
[]
for
root
,
dirs
,
files
in
os
.
walk
(
base_dir
):
root
=
Path
(
root
).
relative_to
(
base_dir
)
if
str
(
root
)
==
'.'
:
root
=
''
else
:
root
=
'.'
.
join
(
str
(
root
).
split
(
'/'
))
+
'.'
for
filename
in
files
:
filename
=
Path
(
filename
)
if
str
(
filename
).
startswith
(
"test_"
)
and
filename
.
suffix
==
".py"
:
tests
.
append
(
root
+
filename
.
stem
)
tests
.
sort
()
return
tests
if
__name__
==
'__main__'
:
tests
=
collect_tests
(
TEST_DIR
)
with
open
(
"python_tests.txt"
,
"w"
)
as
fp
:
for
test
in
tests
:
fp
.
write
(
test
+
'
\
n
'
)
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