FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythoncapi-compat/runtests.py at main · python/pythoncapi-compat · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
python
/
pythoncapi-compat
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
39
Star
109
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythoncapi-compat
/
runtests.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
127 lines (104 loc) · 2.93 KB
Breadcrumbs
pythoncapi-compat
/
runtests.py
Copy path
File metadata and controls
executable file
·
127 lines (104 loc) · 2.93 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/python3 -u
"""
Run the test suite on multiple Python versions.
Usage::
python3 runtests.py
python3 runtests.py --verbose
python3 runtests.py --current --verbose
"""
from
__future__
import
absolute_import
from
__future__
import
print_function
import
argparse
import
os
.
path
import
shutil
import
sys
try
:
from
shutil
import
which
except
ImportError
:
# Python 2
from
distutils
.
spawn
import
find_executable
as
which
from
tests
.
utils
import
run_command
TEST_DIR
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'tests'
)
TEST_COMPAT
=
os
.
path
.
join
(
TEST_DIR
,
"test_pythoncapi_compat.py"
)
TEST_UPGRADE
=
os
.
path
.
join
(
TEST_DIR
,
"test_upgrade_pythoncapi.py"
)
PYTHONS
=
(
# CPython
"python3-debug"
,
"python3"
,
"python2.7"
,
"python3.6"
,
"python3.7"
,
"python3.8"
,
"python3.9"
,
"python3.10"
,
"python3.11"
,
"python3.12"
,
"python3.13"
,
"python3.13t"
,
"python3.14"
,
"python3.14t"
,
"python3.15"
,
"python3.15t"
,
# PyPy
"pypy"
,
"pypy2"
,
"pypy2.7"
,
"pypy3"
,
"pypy3.6"
,
"pypy3.7"
,
"pypy3.8"
,
"pypy3.9"
,
"pypy3.10"
,
"pypy3.11"
,
)
def
run_tests_exe
(
executable
,
verbose
,
tested
):
tested_key
=
os
.
path
.
realpath
(
executable
)
if
tested_key
in
tested
:
return
# Don't use realpath() for the executed command to support virtual
# environments
cmd
=
[
executable
,
TEST_COMPAT
]
if
verbose
:
cmd
.
append
(
'-v'
)
run_command
(
cmd
)
tested
.
add
(
tested_key
)
def
run_tests
(
python
,
verbose
,
tested
):
executable
=
which
(
python
)
if
not
executable
:
print
(
"Ignore missing Python executable: %s"
%
python
)
return
run_tests_exe
(
executable
,
verbose
,
tested
)
def
parse_args
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-v'
,
'--verbose'
,
action
=
"store_true"
,
help
=
'Verbose mode'
)
parser
.
add_argument
(
'-c'
,
'--current'
,
action
=
"store_true"
,
help
=
"Only test the current Python executable "
"(don't test multiple Python versions)"
)
return
parser
.
parse_args
()
def
main
():
args
=
parse_args
()
path
=
os
.
path
.
join
(
TEST_DIR
,
'build'
)
if
os
.
path
.
exists
(
path
):
shutil
.
rmtree
(
path
)
# upgrade_pythoncapi.py requires Python 3.6 or newer
if
sys
.
version_info
>=
(
3
,
6
):
print
(
"Run %s"
%
TEST_UPGRADE
)
cmd
=
[
sys
.
executable
,
TEST_UPGRADE
]
if
args
.
verbose
:
cmd
.
append
(
'-v'
)
run_command
(
cmd
)
else
:
print
(
"Don't test upgrade_pythoncapi.py: it requires Python 3.6"
)
print
()
tested
=
set
()
if
not
args
.
current
:
for
python
in
PYTHONS
:
run_tests
(
python
,
args
.
verbose
,
tested
)
run_tests_exe
(
sys
.
executable
,
args
.
verbose
,
tested
)
print
()
print
(
"Tested: %s Python executables"
%
len
(
tested
))
else
:
run_tests_exe
(
sys
.
executable
,
args
.
verbose
,
tested
)
if
__name__
==
"__main__"
:
main
()
Back
|
FazBrowse Home
|
New Git URL