| 1 |
""" |
| 2 |
|
| 3 |
test configuration(s) for running CPython's regression |
| 4 |
test suite on top of PyPy |
| 5 |
|
| 6 |
""" |
| 7 |
import py.path as pypath |
| 8 |
import pytest |
| 9 |
import sys |
| 10 |
import re |
| 11 |
|
| 12 |
|
| 13 |
from pypy.conftest import option as pypy_option |
| 14 |
|
| 15 |
from pypy.tool.pytest.confpath import pypydir, testdir |
| 16 |
|
| 17 |
pytest_plugins = "resultlog", |
| 18 |
rsyncdirs = ['.', '../pypy/'] |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
def pytest_addoption(parser): |
| 25 |
group = parser.getgroup("compliance testing options") |
| 26 |
group.addoption('-T', '--timeout', action="store", type="string", |
| 27 |
default="1000", dest="timeout", |
| 28 |
help="fail a test module after the given timeout. " |
| 29 |
"specify in seconds or 'NUMmp' aka Mega-Pystones") |
| 30 |
group.addoption('--pypy', action="store", type="string", dest="pypy", |
| 31 |
help="use given pypy executable to run lib-python tests. ") |
| 32 |
group.addoption('--filter', action="store", type="string", default=None, |
| 33 |
dest="unittest_filter", help="Similar to -k, XXX") |
| 34 |
|
| 35 |
def gettimeout(timeout): |
| 36 |
from rpython.translator.test import rpystone |
| 37 |
if timeout.endswith('mp'): |
| 38 |
megapystone = float(timeout[:-2]) |
| 39 |
t, stone = pystone.Proc0(10000) |
| 40 |
pystonetime = t/stone |
| 41 |
seconds = megapystone * 1000000 * pystonetime |
| 42 |
return seconds |
| 43 |
return float(timeout) |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
class RegrTest: |
| 51 |
""" Regression Test Declaration.""" |
| 52 |
def __init__(self, basename, skip=False): |
| 53 |
self.basename = basename |
| 54 |
self.skip = skip |
| 55 |
assert self.getfspath().check(), "%r not found!" % (basename,) |
| 56 |
|
| 57 |
def ismodified(self): |
| 58 |
|
| 59 |
return None |
| 60 |
|
| 61 |
def getfspath(self): |
| 62 |
return testdir.join(self.basename) |
| 63 |
|
| 64 |
testmap = [ |
| 65 |
RegrTest('test___all__.py'), |
| 66 |
RegrTest('test__locale.py'), |
| 67 |
RegrTest('test__opcode.py'), |
| 68 |
RegrTest('test__osx_support.py'), |
| 69 |
RegrTest('test__xxsubinterpreters.py'), |
| 70 |
RegrTest('test_abc.py'), |
| 71 |
RegrTest('test_abstract_numbers.py'), |
| 72 |
RegrTest('test_aifc.py'), |
| 73 |
RegrTest('test_argparse.py'), |
| 74 |
RegrTest('test_array.py'), |
| 75 |
RegrTest('test_asdl_parser.py'), |
| 76 |
RegrTest('test_ast.py'), |
| 77 |
RegrTest('test_asyncgen.py'), |
| 78 |
RegrTest('test_asynchat.py'), |
| 79 |
RegrTest('test_asyncio'), |
| 80 |
RegrTest('test_asyncore.py'), |
| 81 |
RegrTest('test_atexit.py'), |
| 82 |
RegrTest('test_audioop.py'), |
| 83 |
RegrTest('test_audit.py'), |
| 84 |
RegrTest('test_augassign.py'), |
| 85 |
RegrTest('test_base64.py'), |
| 86 |
RegrTest('test_baseexception.py'), |
| 87 |
RegrTest('test_bdb.py'), |
| 88 |
RegrTest('test_bigaddrspace.py'), |
| 89 |
RegrTest('test_bigmem.py'), |
| 90 |
RegrTest('test_binascii.py'), |
| 91 |
RegrTest('test_binop.py'), |
| 92 |
RegrTest('test_bisect.py'), |
| 93 |
RegrTest('test_bool.py'), |
| 94 |
RegrTest('test_buffer.py'), |
| 95 |
RegrTest('test_bufio.py'), |
| 96 |
RegrTest('test_builtin.py'), |
| 97 |
RegrTest('test_bytes.py'), |
| 98 |
RegrTest('test_bz2.py'), |
| 99 |
RegrTest('test_c_locale_coercion.py'), |
| 100 |
RegrTest('test_calendar.py'), |
| 101 |
RegrTest('test_call.py'), |
| 102 |
RegrTest('test_capi'), |
| 103 |
RegrTest('test_cgi.py'), |
| 104 |
RegrTest('test_cgitb.py'), |
| 105 |
RegrTest('test_charmapcodec.py'), |
| 106 |
RegrTest('test_check_c_globals.py'), |
| 107 |
RegrTest('test_class.py'), |
| 108 |
RegrTest('test_clinic.py'), |
| 109 |
RegrTest('test_cmath.py'), |
| 110 |
RegrTest('test_cmd.py'), |
| 111 |
RegrTest('test_cmd_line.py'), |
| 112 |
RegrTest('test_cmd_line_script.py'), |
| 113 |
RegrTest('test_code.py'), |
| 114 |
RegrTest('test_code_module.py'), |
| 115 |
RegrTest('test_codeccallbacks.py'), |
| 116 |
RegrTest('test_codecencodings_cn.py'), |
| 117 |
RegrTest('test_codecencodings_hk.py'), |
| 118 |
RegrTest('test_codecencodings_iso2022.py'), |
| 119 |
RegrTest('test_codecencodings_jp.py'), |
| 120 |
RegrTest('test_codecencodings_kr.py'), |
| 121 |
RegrTest('test_codecencodings_tw.py'), |
| 122 |
RegrTest('test_codecmaps_cn.py'), |
| 123 |
RegrTest('test_codecmaps_hk.py'), |
| 124 |
RegrTest('test_codecmaps_jp.py'), |
| 125 |
RegrTest('test_codecmaps_kr.py'), |
| 126 |
RegrTest('test_codecmaps_tw.py'), |
| 127 |
RegrTest('test_codecs.py'), |
| 128 |
RegrTest('test_codeop.py'), |
| 129 |
RegrTest('test_collections.py'), |
| 130 |
RegrTest('test_colorsys.py'), |
| 131 |
RegrTest('test_compare.py'), |
| 132 |
RegrTest('test_compile.py'), |
| 133 |
RegrTest('test_compileall.py'), |
| 134 |
RegrTest('test_complex.py'), |
| 135 |
RegrTest('test_configparser.py'), |
| 136 |
RegrTest('test_contains.py'), |
| 137 |
RegrTest('test_context.py'), |
| 138 |
RegrTest('test_contextlib.py'), |
| 139 |
RegrTest('test_contextlib_async.py'), |
| 140 |
RegrTest('test_copy.py'), |
| 141 |
RegrTest('test_copyreg.py'), |
| 142 |
RegrTest('test_coroutines.py'), |
| 143 |
RegrTest('test_cprofile.py'), |
| 144 |
RegrTest('test_crashers.py'), |
| 145 |
RegrTest('test_crypt.py'), |
| 146 |
RegrTest('test_csv.py'), |
| 147 |
RegrTest('test_ctypes.py'), |
| 148 |
RegrTest('test_curses.py'), |
| 149 |
RegrTest('test_datetime.py'), |
| 150 |
RegrTest('test_dbm.py'), |
| 151 |
RegrTest('test_dbm_dumb.py'), |
| 152 |
RegrTest('test_dbm_gnu.py'), |
| 153 |
RegrTest('test_dbm_ndbm.py'), |
| 154 |
RegrTest('test_decimal.py'), |
| 155 |
RegrTest('test_decorators.py'), |
| 156 |
RegrTest('test_defaultdict.py'), |
| 157 |
RegrTest('test_deque.py'), |
| 158 |
RegrTest('test_descr.py'), |
| 159 |
RegrTest('test_descrtut.py'), |
| 160 |
RegrTest('test_devpoll.py'), |
| 161 |
RegrTest('test_dict.py'), |
| 162 |
RegrTest('test_dict_version.py', skip="implementation detail"), |
| 163 |
RegrTest('test_dictcomps.py'), |
| 164 |
RegrTest('test_dictviews.py'), |
| 165 |
RegrTest('test_difflib.py'), |
| 166 |
RegrTest('test_dis.py', skip="implementation detail"), |
| 167 |
RegrTest('test_distutils.py'), |
| 168 |
RegrTest('test_docxmlrpc.py'), |
| 169 |
RegrTest('test_dtrace.py'), |
| 170 |
RegrTest('test_dynamic.py'), |
| 171 |
RegrTest('test_dynamicclassattribute.py'), |
| 172 |
RegrTest('test_eintr.py'), |
| 173 |
RegrTest('test_email'), |
| 174 |
RegrTest('test_embed.py'), |
| 175 |
RegrTest('test_ensurepip.py'), |
| 176 |
RegrTest('test_enum.py'), |
| 177 |
RegrTest('test_enumerate.py'), |
| 178 |
RegrTest('test_eof.py'), |
| 179 |
RegrTest('test_epoll.py'), |
| 180 |
RegrTest('test_errno.py'), |
| 181 |
RegrTest('test_exception_hierarchy.py'), |
| 182 |
RegrTest('test_exception_variations.py'), |
| 183 |
RegrTest('test_exceptions.py'), |
| 184 |
RegrTest('test_extcall.py'), |
| 185 |
RegrTest('test_faulthandler.py'), |
| 186 |
RegrTest('test_fcntl.py'), |
| 187 |
RegrTest('test_file.py'), |
| 188 |
RegrTest('test_file_eintr.py'), |
| 189 |
RegrTest('test_filecmp.py'), |
| 190 |
RegrTest('test_fileinput.py'), |
| 191 |
RegrTest('test_fileio.py'), |
| 192 |
RegrTest('test_finalization.py'), |
| 193 |
RegrTest('test_float.py'), |
| 194 |
RegrTest('test_flufl.py'), |
| 195 |
RegrTest('test_fnmatch.py'), |
| 196 |
RegrTest('test_fork1.py'), |
| 197 |
RegrTest('test_format.py'), |
| 198 |
RegrTest('test_fractions.py'), |
| 199 |
RegrTest('test_frame.py'), |
| 200 |
RegrTest('test_frozen.py', skip="implementation detail"), |
| 201 |
RegrTest('test_fstring.py'), |
| 202 |
RegrTest('test_ftplib.py'), |
| 203 |
RegrTest('test_funcattrs.py'), |
| 204 |
RegrTest('test_functools.py'), |
| 205 |
RegrTest('test_gc.py', skip="implementation detail"), |
| 206 |
RegrTest('test_generator_stop.py'), |
| 207 |
RegrTest('test_generators.py'), |
| 208 |
RegrTest('test_genericalias.py'), |
| 209 |
RegrTest('test_genericclass.py'), |
| 210 |
RegrTest('test_genericpath.py'), |
| 211 |
RegrTest('test_genexps.py'), |
| 212 |
RegrTest('test_getopt.py'), |
| 213 |
RegrTest('test_getpass.py'), |
| 214 |
RegrTest('test_gettext.py'), |
| 215 |
RegrTest('test_glob.py'), |
| 216 |
RegrTest('test_global.py'), |
| 217 |
RegrTest('test_grammar.py'), |
| 218 |
RegrTest('test_graphlib.py'), |
| 219 |
RegrTest('test_grp.py'), |
| 220 |
RegrTest('test_gzip.py'), |
| 221 |
RegrTest('test_hash.py'), |
| 222 |
RegrTest('test_hashlib.py'), |
| 223 |
RegrTest('test_heapq.py'), |
| 224 |
RegrTest('test_hmac.py'), |
| 225 |
RegrTest('test_html.py'), |
| 226 |
RegrTest('test_htmlparser.py'), |
| 227 |
RegrTest('test_http_cookiejar.py'), |
| 228 |
RegrTest('test_http_cookies.py'), |
| 229 |
RegrTest('test_httplib.py'), |
| 230 |
RegrTest('test_httpservers.py'), |
| 231 |
RegrTest('test_idle.py'), |
| 232 |
RegrTest('test_imaplib.py'), |
| 233 |
RegrTest('test_imghdr.py'), |
| 234 |
RegrTest('test_imp.py'), |
| 235 |
RegrTest('test_import'), |
| 236 |
RegrTest('test_importlib'), |
| 237 |
RegrTest('test_index.py'), |
| 238 |
RegrTest('test_interpreters.py'), |
| 239 |
RegrTest('test_int.py'), |
| 240 |
RegrTest('test_int_literal.py'), |
| 241 |
RegrTest('test_io.py'), |
| 242 |
RegrTest('test_ioctl.py'), |
| 243 |
RegrTest('test_ipaddress.py'), |
| 244 |
RegrTest('test_isinstance.py'), |
| 245 |
RegrTest('test_iter.py'), |
| 246 |
RegrTest('test_iterlen.py'), |
| 247 |
RegrTest('test_itertools.py'), |
| 248 |
RegrTest('test_json'), |
| 249 |
RegrTest('test_keyword.py'), |
| 250 |
RegrTest('test_keywordonlyarg.py'), |
| 251 |
RegrTest('test_kqueue.py'), |
| 252 |
RegrTest('test_largefile.py'), |
| 253 |
RegrTest('test_lib2to3.py'), |
| 254 |
RegrTest('test_linecache.py'), |
| 255 |
RegrTest('test_list.py'), |
| 256 |
RegrTest('test_listcomps.py'), |
| 257 |
RegrTest('test_lltrace.py'), |
| 258 |
RegrTest('test_locale.py'), |
| 259 |
RegrTest('test_logging.py'), |
| 260 |
RegrTest('test_long.py'), |
| 261 |
RegrTest('test_longexp.py'), |
| 262 |
RegrTest('test_lzma.py'), |
| 263 |
RegrTest('test_mailbox.py'), |
| 264 |
RegrTest('test_mailcap.py'), |
| 265 |
RegrTest('test_marshal.py'), |
| 266 |
RegrTest('test_math.py'), |
| 267 |
RegrTest('test_memoryio.py'), |
| 268 |
RegrTest('test_memoryview.py'), |
| 269 |
RegrTest('test_metaclass.py'), |
| 270 |
RegrTest('test_mimetypes.py'), |
| 271 |
RegrTest('test_minidom.py'), |
| 272 |
RegrTest('test_mmap.py'), |
| 273 |
RegrTest('test_modulefinder.py'), |
| 274 |
RegrTest('test_msilib.py'), |
| 275 |
RegrTest('test_multibytecodec.py'), |
| 276 |
RegrTest('test_multiprocessing_main_handling.py'), |
| 277 |
RegrTest('test_named_expressions.py'), |
| 278 |
RegrTest('test_netrc.py'), |
| 279 |
RegrTest('test_nis.py'), |
| 280 |
RegrTest('test_nntplib.py'), |
| 281 |
RegrTest('test_ntpath.py'), |
| 282 |
RegrTest('test_numeric_tower.py'), |
| 283 |
RegrTest('test_opcache.py'), |
| 284 |
RegrTest('test_opcodes.py'), |
| 285 |
RegrTest('test_openpty.py'), |
| 286 |
RegrTest('test_operator.py'), |
| 287 |
RegrTest('test_optparse.py'), |
| 288 |
RegrTest('test_ordered_dict.py'), |
| 289 |
RegrTest('test_os.py'), |
| 290 |
RegrTest('test_ossaudiodev.py', skip="needs low level audio"), |
| 291 |
RegrTest('test_osx_env.py'), |
| 292 |
RegrTest('test_pathlib.py'), |
| 293 |
RegrTest('test_patma.py'), |
| 294 |
RegrTest('test_pdb.py'), |
| 295 |
RegrTest('test_peepholer.py'), |
| 296 |
RegrTest('test_peg_generator'), |
| 297 |
RegrTest('test_pickle.py'), |
| 298 |
RegrTest('test_picklebuffer.py'), |
| 299 |
RegrTest('test_pickletools.py'), |
| 300 |
RegrTest('test_pipes.py'), |
| 301 |
RegrTest('test_pkg.py'), |
| 302 |
RegrTest('test_pkgutil.py'), |
| 303 |
RegrTest('test_platform.py'), |
| 304 |
RegrTest('test_plistlib.py'), |
| 305 |
RegrTest('test_poll.py'), |
| 306 |
RegrTest('test_popen.py'), |
| 307 |
RegrTest('test_poplib.py'), |
| 308 |
RegrTest('test_positional_only_arg.py'), |
| 309 |
RegrTest('test_posix.py'), |
| 310 |
RegrTest('test_posixpath.py'), |
| 311 |
RegrTest('test_pow.py'), |
| 312 |
RegrTest('test_pprint.py'), |
| 313 |
RegrTest('test_print.py'), |
| 314 |
RegrTest('test_profile.py'), |
| 315 |
RegrTest('test_property.py'), |
| 316 |
RegrTest('test_pstats.py'), |
| 317 |
RegrTest('test_pty.py'), |
| 318 |
RegrTest('test_pulldom.py'), |
| 319 |
RegrTest('test_pwd.py'), |
| 320 |
RegrTest('test_py_compile.py'), |
| 321 |
RegrTest('test_pyclbr.py'), |
| 322 |
RegrTest('test_pyexpat.py'), |
| 323 |
RegrTest('test_queue.py'), |
| 324 |
RegrTest('test_quopri.py'), |
| 325 |
RegrTest('test_raise.py'), |
| 326 |
RegrTest('test_random.py'), |
| 327 |
RegrTest('test_range.py'), |
| 328 |
RegrTest('test_re.py'), |
| 329 |
RegrTest('test_readline.py'), |
| 330 |
RegrTest('test_regrtest.py'), |
| 331 |
RegrTest('test_repl.py'), |
| 332 |
RegrTest('test_reprlib.py'), |
| 333 |
RegrTest('test_resource.py'), |
| 334 |
RegrTest('test_richcmp.py'), |
| 335 |
RegrTest('test_rlcompleter.py'), |
| 336 |
RegrTest('test_robotparser.py'), |
| 337 |
RegrTest('test_runpy.py'), |
| 338 |
RegrTest('test_sax.py'), |
| 339 |
RegrTest('test_sched.py'), |
| 340 |
RegrTest('test_scope.py'), |
| 341 |
RegrTest('test_script_helper.py'), |
| 342 |
RegrTest('test_secrets.py'), |
| 343 |
RegrTest('test_select.py'), |
| 344 |
RegrTest('test_selectors.py'), |
| 345 |
RegrTest('test_set.py'), |
| 346 |
RegrTest('test_setcomps.py'), |
| 347 |
RegrTest('test_shelve.py'), |
| 348 |
RegrTest('test_shlex.py'), |
| 349 |
RegrTest('test_shutil.py'), |
| 350 |
RegrTest('test_signal.py'), |
| 351 |
RegrTest('test_site.py'), |
| 352 |
RegrTest('test_slice.py'), |
| 353 |
RegrTest('test_smtpd.py'), |
| 354 |
RegrTest('test_smtplib.py'), |
| 355 |
RegrTest('test_smtpnet.py'), |
| 356 |
RegrTest('test_sndhdr.py'), |
| 357 |
RegrTest('test_socket.py'), |
| 358 |
RegrTest('test_socketserver.py'), |
| 359 |
RegrTest('test_sort.py'), |
| 360 |
RegrTest('test_source_encoding.py'), |
| 361 |
RegrTest('test_spwd.py'), |
| 362 |
RegrTest('test_ssl.py'), |
| 363 |
RegrTest('test_stable_abi_ctypes.py', skip="needs ctypes.pythonapi"), |
| 364 |
RegrTest('test_startfile.py'), |
| 365 |
RegrTest('test_stat.py'), |
| 366 |
RegrTest('test_statistics.py'), |
| 367 |
RegrTest('test_strftime.py'), |
| 368 |
RegrTest('test_string.py'), |
| 369 |
RegrTest('test_string_literals.py'), |
| 370 |
RegrTest('test_stringprep.py'), |
| 371 |
RegrTest('test_strptime.py'), |
| 372 |
RegrTest('test_strtod.py'), |
| 373 |
RegrTest('test_struct.py'), |
| 374 |
RegrTest('test_structseq.py'), |
| 375 |
RegrTest('test_subclassinit.py'), |
| 376 |
RegrTest('test_subprocess.py'), |
| 377 |
RegrTest('test_sunau.py'), |
| 378 |
RegrTest('test_sundry.py'), |
| 379 |
RegrTest('test_super.py'), |
| 380 |
RegrTest('test_support.py'), |
| 381 |
RegrTest('test_symtable.py', skip="implementation detail"), |
| 382 |
RegrTest('test_syntax.py'), |
| 383 |
RegrTest('test_sys.py'), |
| 384 |
RegrTest('test_sys_setprofile.py'), |
| 385 |
RegrTest('test_sys_settrace.py'), |
| 386 |
RegrTest('test_sysconfig.py'), |
| 387 |
RegrTest('test_sysconfig_pypy.py'), |
| 388 |
RegrTest('test_syslog.py'), |
| 389 |
RegrTest('test_tabnanny.py'), |
| 390 |
RegrTest('test_tarfile.py'), |
| 391 |
RegrTest('test_tcl.py'), |
| 392 |
RegrTest('test_telnetlib.py'), |
| 393 |
RegrTest('test_tempfile.py'), |
| 394 |
RegrTest('test_termios.py'), |
| 395 |
RegrTest('test_textwrap.py'), |
| 396 |
RegrTest('test_thread.py'), |
| 397 |
RegrTest('test_threadedtempfile.py'), |
| 398 |
RegrTest('test_threading.py'), |
| 399 |
RegrTest('test_threading_local.py'), |
| 400 |
RegrTest('test_threadsignals.py'), |
| 401 |
RegrTest('test_time.py'), |
| 402 |
RegrTest('test_timeit.py'), |
| 403 |
RegrTest('test_timeout.py'), |
| 404 |
RegrTest('test_tix.py', skip="needs display"), |
| 405 |
RegrTest('test_tk.py', skip="needs display"), |
| 406 |
RegrTest('test_tokenize.py'), |
| 407 |
RegrTest('test_tools', skip="CPython internal details"), |
| 408 |
RegrTest('test_trace.py'), |
| 409 |
RegrTest('test_traceback.py'), |
| 410 |
RegrTest('test_tracemalloc.py'), |
| 411 |
RegrTest('test_ttk_guionly.py', skip="needs display"), |
| 412 |
RegrTest('test_ttk_textonly.py'), |
| 413 |
RegrTest('test_tty.py'), |
| 414 |
RegrTest('test_tuple.py'), |
| 415 |
RegrTest('test_turtle.py'), |
| 416 |
RegrTest('test_type_cache.py'), |
| 417 |
RegrTest('test_type_comments.py'), |
| 418 |
RegrTest('test_typechecks.py'), |
| 419 |
RegrTest('test_types.py'), |
| 420 |
RegrTest('test_type_annotations.py'), |
| 421 |
RegrTest('test_typing.py'), |
| 422 |
RegrTest('test_ucn.py'), |
| 423 |
RegrTest('test_unary.py'), |
| 424 |
RegrTest('test_unicode.py'), |
| 425 |
RegrTest('test_unicode_file.py'), |
| 426 |
RegrTest('test_unicode_file_functions.py'), |
| 427 |
RegrTest('test_unicode_identifiers.py'), |
| 428 |
RegrTest('test_unicodedata.py'), |
| 429 |
RegrTest('test_unittest.py'), |
| 430 |
RegrTest('test_univnewlines.py'), |
| 431 |
RegrTest('test_unpack.py'), |
| 432 |
RegrTest('test_unpack_ex.py'), |
| 433 |
RegrTest('test_unparse.py'), |
| 434 |
RegrTest('test_urllib.py'), |
| 435 |
RegrTest('test_urllib2.py'), |
| 436 |
RegrTest('test_urllib2_localnet.py'), |
| 437 |
RegrTest('test_urllib2net.py'), |
| 438 |
RegrTest('test_urllib_response.py'), |
| 439 |
RegrTest('test_urllibnet.py'), |
| 440 |
RegrTest('test_urlparse.py'), |
| 441 |
RegrTest('test_userdict.py'), |
| 442 |
RegrTest('test_userlist.py'), |
| 443 |
RegrTest('test_userstring.py'), |
| 444 |
RegrTest('test_utf8_mode.py'), |
| 445 |
RegrTest('test_utf8source.py'), |
| 446 |
RegrTest('test_uu.py'), |
| 447 |
RegrTest('test_uuid.py'), |
| 448 |
RegrTest('test_venv.py'), |
| 449 |
RegrTest('test_wait3.py'), |
| 450 |
RegrTest('test_wait4.py'), |
| 451 |
RegrTest('test_warnings'), |
| 452 |
RegrTest('test_wave.py'), |
| 453 |
RegrTest('test_weakref.py'), |
| 454 |
RegrTest('test_weakset.py'), |
| 455 |
RegrTest('test_webbrowser.py'), |
| 456 |
RegrTest('test_winconsoleio.py'), |
| 457 |
RegrTest('test_winreg.py'), |
| 458 |
RegrTest('test_winsound.py', skip="requires audio"), |
| 459 |
RegrTest('test_with.py'), |
| 460 |
RegrTest('test_wsgiref.py'), |
| 461 |
RegrTest('test_xdrlib.py'), |
| 462 |
RegrTest('test_xml_dom_minicompat.py'), |
| 463 |
RegrTest('test_xml_etree.py'), |
| 464 |
RegrTest('test_xml_etree_c.py'), |
| 465 |
RegrTest('test_xmlrpc.py'), |
| 466 |
RegrTest('test_xmlrpc_net.py'), |
| 467 |
RegrTest('test_xxtestfuzz.py', skip="CPython internal details"), |
| 468 |
RegrTest('test_xxlimited.py', skip="CPython internal details"), |
| 469 |
RegrTest('test_yield_from.py'), |
| 470 |
RegrTest('test_zipapp.py'), |
| 471 |
RegrTest('test_zipfile.py'), |
| 472 |
RegrTest('test_zipfile64.py', skip="demands too many resources"), |
| 473 |
RegrTest('test_zipimport.py'), |
| 474 |
RegrTest('test_zipimport_support.py'), |
| 475 |
RegrTest('test_zlib.py'), |
| 476 |
|
| 477 |
RegrTest('test_concurrent_futures'), |
| 478 |
RegrTest('test_cppext'), |
| 479 |
RegrTest('test_dataclasses'), |
| 480 |
RegrTest('test_doctest'), |
| 481 |
RegrTest('test_except_star.py'), |
| 482 |
RegrTest('test_exception_group.py'), |
| 483 |
RegrTest('test_fileutils.py'), |
| 484 |
RegrTest('test_future_stmt'), |
| 485 |
RegrTest('test_gdb'), |
| 486 |
RegrTest('test_getpath.py', skip="CPython internal details"), |
| 487 |
RegrTest('test_inspect'), |
| 488 |
RegrTest('test_launcher.py'), |
| 489 |
RegrTest('test_module'), |
| 490 |
RegrTest('test_multiprocessing_fork'), |
| 491 |
RegrTest('test_multiprocessing_forkserver'), |
| 492 |
RegrTest('test_multiprocessing_spawn'), |
| 493 |
RegrTest('test_pep646_syntax.py'), |
| 494 |
RegrTest('test_pydoc'), |
| 495 |
RegrTest('test_pyrepl'), |
| 496 |
RegrTest('test_sqlite3'), |
| 497 |
RegrTest('test_tomllib'), |
| 498 |
RegrTest('test_zoneinfo'), |
| 499 |
] |
| 500 |
|
| 501 |
def check_testmap_complete(): |
| 502 |
listed_names = dict.fromkeys([regrtest.basename for regrtest in testmap]) |
| 503 |
assert len(listed_names) == len(testmap) |
| 504 |
|
| 505 |
listed_names['test_support.py'] = True |
| 506 |
listed_names['test_multibytecodec_support.py'] = True |
| 507 |
listed_names['test_dis.py'] = (sys.version_info <= (3, 10)) |
| 508 |
missing = [] |
| 509 |
for path in testdir.listdir(fil='test_*'): |
| 510 |
name = path.basename |
| 511 |
if (name.endswith('.py') or path.isdir()) and name not in listed_names: |
| 512 |
missing.append(' RegrTest(%r),' % (name,)) |
| 513 |
missing.sort() |
| 514 |
assert not missing, "non-listed tests:\n%s" % ('\n'.join(missing),) |
| 515 |
check_testmap_complete() |
| 516 |
|
| 517 |
def pytest_configure(config): |
| 518 |
config._basename2spec = cache = {} |
| 519 |
for x in testmap: |
| 520 |
cache[x.basename] = x |
| 521 |
|
| 522 |
def pytest_ignore_collect(path, config): |
| 523 |
if path.basename == '__init__.py': |
| 524 |
return False |
| 525 |
if path.isfile(): |
| 526 |
regrtest = config._basename2spec.get(path.basename, None) |
| 527 |
if regrtest is None or path.dirpath() != testdir: |
| 528 |
return True |
| 529 |
|
| 530 |
def pytest_collect_file(path, parent): |
| 531 |
if path.basename == '__init__.py': |
| 532 |
|
| 533 |
pkg_path = path.dirpath() |
| 534 |
regrtest = parent.config._basename2spec.get(pkg_path.basename, None) |
| 535 |
if pkg_path.dirpath() == testdir and regrtest: |
| 536 |
return RunFileExternal( |
| 537 |
pkg_path.basename, parent=parent, regrtest=regrtest) |
| 538 |
|
| 539 |
|
| 540 |
@pytest.hookimpl(tryfirst=True) |
| 541 |
def pytest_pycollect_makemodule(path, parent): |
| 542 |
config = parent.config |
| 543 |
regrtest = config._basename2spec[path.basename] |
| 544 |
return RunFileExternal(path.basename, parent=parent, regrtest=regrtest) |
| 545 |
|
| 546 |
class RunFileExternal(pytest.collect.File): |
| 547 |
def __init__(self, name, parent, regrtest): |
| 548 |
super(RunFileExternal, self).__init__(name, parent) |
| 549 |
self.regrtest = regrtest |
| 550 |
self.fspath = regrtest.getfspath() |
| 551 |
|
| 552 |
def collect(self): |
| 553 |
if self.regrtest.ismodified(): |
| 554 |
name = 'modified' |
| 555 |
else: |
| 556 |
name = 'unmodified' |
| 557 |
return [ReallyRunFileExternal(name, parent=self)] |
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
|
| 562 |
|
| 563 |
import os |
| 564 |
|
| 565 |
class ReallyRunFileExternal(pytest.collect.Item): |
| 566 |
class ExternalFailure(Exception): |
| 567 |
"""Failure in running subprocess""" |
| 568 |
|
| 569 |
def getinvocation(self, regrtest): |
| 570 |
fspath = regrtest.getfspath() |
| 571 |
python = sys.executable |
| 572 |
alarm_script = pypydir.join('tool', 'alarm.py') |
| 573 |
if sys.platform == 'win32': |
| 574 |
watchdog_name = 'watchdog_nt.py' |
| 575 |
else: |
| 576 |
watchdog_name = 'watchdog.py' |
| 577 |
watchdog_script = pypydir.join('tool', watchdog_name) |
| 578 |
|
| 579 |
option = self.config.option |
| 580 |
TIMEOUT = gettimeout(option.timeout.lower()) |
| 581 |
execpath = pypath.local(option.pypy) |
| 582 |
if not execpath.check(): |
| 583 |
execpath = pypath.local.sysfind(option.pypy) |
| 584 |
if not execpath: |
| 585 |
raise LookupError("could not find executable %r" % option.pypy) |
| 586 |
|
| 587 |
cmd = "%s -m test -v %s -u network -u curses -u gui" % (execpath, fspath.purebasename) |
| 588 |
|
| 589 |
cmd = "%s %s %s %s" % (python, watchdog_script, TIMEOUT, cmd) |
| 590 |
return cmd |
| 591 |
|
| 592 |
def runtest(self): |
| 593 |
""" invoke a subprocess running the test file via PyPy. |
| 594 |
record its output into the 'result/user@host' subdirectory. |
| 595 |
(we might want to create subdirectories for |
| 596 |
each user, because we will probably all produce |
| 597 |
such result runs and they will not be the same |
| 598 |
i am afraid. |
| 599 |
""" |
| 600 |
regrtest = self.parent.regrtest |
| 601 |
if regrtest.skip: |
| 602 |
if regrtest.skip is True: |
| 603 |
msg = "obsolete or unsupported platform" |
| 604 |
else: |
| 605 |
msg = regrtest.skip |
| 606 |
pytest.skip(msg) |
| 607 |
(skipped, exit_status, test_stdout, test_stderr) = \ |
| 608 |
self.getresult(regrtest) |
| 609 |
if skipped: |
| 610 |
pytest.skip(test_stderr.splitlines()[-1]) |
| 611 |
if exit_status: |
| 612 |
raise self.ExternalFailure(test_stdout, test_stderr) |
| 613 |
|
| 614 |
def repr_failure(self, excinfo): |
| 615 |
if not excinfo.errisinstance(self.ExternalFailure): |
| 616 |
return super(ReallyRunFileExternal, self).repr_failure(excinfo) |
| 617 |
out, err = excinfo.value.args |
| 618 |
return out + err |
| 619 |
|
| 620 |
def getstatusouterr(self, cmd): |
| 621 |
tempdir = pytest.ensuretemp(self.fspath.basename) |
| 622 |
stdout = tempdir.join(self.fspath.basename) + '.out' |
| 623 |
stderr = tempdir.join(self.fspath.basename) + '.err' |
| 624 |
if sys.platform == 'win32': |
| 625 |
status = os.system("%s >%s 2>%s" % (cmd, stdout, stderr)) |
| 626 |
if status >= 0: |
| 627 |
status = status |
| 628 |
else: |
| 629 |
status = 'abnormal termination 0x%x' % status |
| 630 |
else: |
| 631 |
if self.config.option.unittest_filter is not None: |
| 632 |
cmd += ' --filter %s' % self.config.option.unittest_filter |
| 633 |
if self.config.option.usepdb: |
| 634 |
cmd += ' --pdb' |
| 635 |
if self.config.option.capture == 'no': |
| 636 |
status = os.system(cmd) |
| 637 |
stdout.write('') |
| 638 |
stderr.write('') |
| 639 |
else: |
| 640 |
status = os.system("%s >>%s 2>>%s" % (cmd, stdout, stderr)) |
| 641 |
if os.WIFEXITED(status): |
| 642 |
status = os.WEXITSTATUS(status) |
| 643 |
else: |
| 644 |
status = 'abnormal termination 0x%x' % status |
| 645 |
return status, stdout.read(mode='rU'), stderr.read(mode='rU') |
| 646 |
|
| 647 |
def getresult(self, regrtest): |
| 648 |
cmd = self.getinvocation(regrtest) |
| 649 |
tempdir = pytest.ensuretemp(self.fspath.basename) |
| 650 |
oldcwd = tempdir.chdir() |
| 651 |
exit_status, test_stdout, test_stderr = self.getstatusouterr(cmd) |
| 652 |
oldcwd.chdir() |
| 653 |
skipped = False |
| 654 |
timedout = test_stderr.rfind(26*"=" + "timedout" + 26*"=") != -1 |
| 655 |
if not timedout: |
| 656 |
timedout = test_stderr.rfind("KeyboardInterrupt") != -1 |
| 657 |
if test_stderr.rfind(26*"=" + "skipped" + 26*"=") != -1: |
| 658 |
skipped = True |
| 659 |
if not exit_status: |
| 660 |
|
| 661 |
|
| 662 |
if re.search(r'\bFAIL\b', test_stdout) or re.search('[^:]ERROR', test_stderr): |
| 663 |
exit_status = 2 |
| 664 |
|
| 665 |
return skipped, exit_status, test_stdout, test_stderr |