13
13
from typing import NoReturn
14
14
15
15
from parse_metadata import NoSuchStubError , get_recursive_requirements , read_metadata
16
- from utils import PYTHON_VERSION , colored , get_mypy_req , print_error , print_success_msg
16
+ from utils import PYTHON_VERSION , colored , get_mypy_req , print_divider , print_error , print_success_msg
17
17
18
18
19
19
def run_stubtest (
@@ -24,7 +24,7 @@ def run_stubtest(
24
24
metadata = read_metadata (dist_name )
25
25
except NoSuchStubError as e :
26
26
parser .error (str (e ))
27
- print (f"{ dist_name } ... " , end = "" )
27
+ print (f"{ dist_name } ... " , end = "" , flush = True )
28
28
29
29
stubtest_settings = metadata .stubtest_settings
30
30
if stubtest_settings .skipped :
@@ -131,28 +131,44 @@ def run_stubtest(
131
131
try :
132
132
subprocess .run (stubtest_cmd , env = stubtest_env , check = True , capture_output = True )
133
133
except subprocess .CalledProcessError as e :
134
- print_error ("fail" )
134
+ print_error ("fail\n " )
135
+
136
+ print_divider ()
137
+ print ("Commands run:" )
135
138
print_commands (dist , pip_cmd , stubtest_cmd , mypypath )
139
+
140
+ print_divider ()
141
+ print ("Command output:\n " )
136
142
print_command_output (e )
137
143
138
- print ("Python version: " , file = sys .stderr )
144
+ print_divider ()
145
+ print (f"Upstream repository: { metadata .upstream_repository } " )
146
+ print (f"Typeshed source code: https://github.com/python/typeshed/tree/main/stubs/{ dist .name } " )
147
+
148
+ print ("Python version: " , file = sys .stderr , end = "" , flush = True )
139
149
ret = subprocess .run ([sys .executable , "-VV" ], capture_output = True )
140
150
print_command_output (ret )
141
-
142
151
print ("Ran with the following environment:" , file = sys .stderr )
143
152
ret = subprocess .run ([pip_exe , "freeze" , "--all" ], capture_output = True )
144
153
print_command_output (ret )
145
154
155
+ allowlist_path_relative = allowlist_path .relative_to (Path .cwd ())
146
156
if allowlist_path .exists ():
147
157
print (
148
- f'To fix "unused allowlist" errors, remove the corresponding entries from { allowlist_path } ' , file = sys .stderr
158
+ f'To fix "unused allowlist" errors, remove the corresponding entries from { allowlist_path_relative } ' ,
159
+ file = sys .stderr ,
149
160
)
150
161
print (file = sys .stderr )
151
162
else :
152
- print (f"Re-running stubtest with --generate-allowlist.\n Add the following to { allowlist_path } :" , file = sys .stderr )
163
+ print (
164
+ f"Re-running stubtest with --generate-allowlist.\n Add the following to { allowlist_path_relative } :" ,
165
+ file = sys .stderr ,
166
+ )
153
167
ret = subprocess .run ([* stubtest_cmd , "--generate-allowlist" ], env = stubtest_env , capture_output = True )
154
168
print_command_output (ret )
155
169
170
+ print_divider ()
171
+
156
172
return False
157
173
else :
158
174
print_success_msg ()
0 commit comments