How to use exclude_test method in Slash

Best Python code snippet using slash

run-test-suite.py

Source:run-test-suite.py Github

copy

Full Screen

...305 testdirs += find_tests_below(path)306else:307 # Run all the tests308 testdirs = find_tests_below('tests')309def exclude_test(test):310 if test in testdirs:311 testdirs.remove(test)312def exclude_tests_below(path):313 for test in find_tests_below(path):314 exclude_test(test)315# Handle exclusions:316if options.excluded_dirs:317 for path in options.excluded_dirs:318 exclude_tests_below(path)319# Certain tests don't work on 32-bit320if six.MAXSIZE == 0x7fffffff:321 # These two tests verify that we can detect int vs Py_ssize_t mismatches,322 # but on 32-bit these are the same type, so don't find anything:323 exclude_test('tests/cpychecker/PyArg_ParseTuple/with_PY_SSIZE_T_CLEAN')324 exclude_test('tests/cpychecker/PyArg_ParseTuple/without_PY_SSIZE_T_CLEAN')325 # One part of the expected output for this test assumes int vs Py_ssize_t326 # mismatch:327 exclude_test('tests/cpychecker/PyArg_ParseTuple/incorrect_converters')328 # The expected output for the following tests assumes a 64-bit build:329 exclude_test('tests/cpychecker/absinterp/casts/pointer-to-long')330 exclude_test('tests/cpychecker/absinterp/casts/pyobjectptr-to-long')331 exclude_test('tests/cpychecker/refcounts/PyArg_ParseTuple/correct_O')332 exclude_test('tests/cpychecker/refcounts/PyArg_ParseTupleAndKeywords/correct_O')333 exclude_test('tests/cpychecker/refcounts/PyInt_AsLong/correct_cast')334 exclude_test('tests/cpychecker/refcounts/PyList_Size/known-size')335 exclude_test('tests/cpychecker/refcounts/PyMapping_Size/basic')336 exclude_test('tests/cpychecker/refcounts/PyString_Size/correct')337 exclude_test('tests/cpychecker/refcounts/PyTuple_New/correct')338 exclude_test('tests/cpychecker/refcounts/module_handling')339 exclude_test('tests/cpychecker/refcounts/storage_regions/static/correct')340 exclude_test('tests/examples/cplusplus/classes')341 exclude_test('tests/plugin/constants')342 exclude_test('tests/plugin/gimple-walk-tree/dump-all')343 exclude_test('tests/plugin/gimple-walk-tree/find-one')344# Certain tests don't work for Python 3:345if six.PY3:346 # The PyInt_ API doesn't exist anymore in Python 3:347 exclude_tests_below('tests/cpychecker/refcounts/PyInt_AsLong/')348 exclude_tests_below('tests/cpychecker/refcounts/PyInt_FromLong/')349 # Similarly for the PyString_ API:350 exclude_tests_below('tests/cpychecker/refcounts/PyString_AsString')351 exclude_tests_below('tests/cpychecker/refcounts/PyString_Concat')352 exclude_tests_below('tests/cpychecker/refcounts/PyString_ConcatAndDel')353 exclude_tests_below('tests/cpychecker/refcounts/PyString_FromStringAndSize')354 exclude_tests_below('tests/cpychecker/refcounts/PyString_Size')355 # The PyCObject_ API was removed in 3.2:356 exclude_tests_below('tests/cpychecker/refcounts/PyCObject_FromVoidPtr')357 exclude_tests_below('tests/cpychecker/refcounts/PyCObject_FromVoidPtrAndDesc')358 # The following tests happen to use PyInt or PyString APIs and thus we359 # exclude them for now:360 exclude_test('tests/cpychecker/refcounts/function-that-exits') # PyString361 exclude_test('tests/cpychecker/refcounts/GIL/correct') # PyString362 exclude_test('tests/cpychecker/refcounts/handle_null_error') # PyString363 exclude_test('tests/cpychecker/refcounts/PyArg_ParseTuple/correct_O_bang') # PyString364 exclude_test('tests/cpychecker/refcounts/PyObject_CallMethodObjArgs/correct') # PyString365 exclude_test('tests/cpychecker/refcounts/PyObject_CallMethodObjArgs/incorrect') # PyString366 exclude_test('tests/cpychecker/refcounts/PyStructSequence/correct') # PyInt367 exclude_test('tests/cpychecker/refcounts/PySys_SetObject/correct') # PyString368 exclude_test('tests/cpychecker/refcounts/subclass/handling') # PyString369 # Module handling is very different in Python 2 vs 3. For now, only run370 # this test for Python 2:371 exclude_test('tests/cpychecker/refcounts/module_handling')372 # Uses METH_OLDARGS:373 exclude_test('tests/cpychecker/refcounts/PyArg_Parse/correct_simple')374# Certain tests don't work for debug builds of Python:375if hasattr(sys, 'gettotalrefcount'):376 exclude_test('tests/cpychecker/refcounts/PyDict_SetItem/correct')377 exclude_test('tests/cpychecker/refcounts/PyDict_SetItem/incorrect')378 exclude_test('tests/cpychecker/refcounts/PyDict_SetItemString/correct')379 exclude_test('tests/cpychecker/refcounts/PyDict_SetItemString/incorrect')380 exclude_test('tests/cpychecker/refcounts/PyFloat_AsDouble/correct_PyFloatObject')381 exclude_test('tests/cpychecker/refcounts/PyList_Append/correct')382 exclude_test('tests/cpychecker/refcounts/PyList_Append/incorrect')383 exclude_test('tests/cpychecker/refcounts/PyList_Append/incorrect-loop')384 exclude_test('tests/cpychecker/refcounts/PyList_Append/null-newitem')385 exclude_test('tests/cpychecker/refcounts/PyList_Append/ticket-22')386 exclude_test('tests/cpychecker/refcounts/PyList_SET_ITEM_macro/correct')387 exclude_test('tests/cpychecker/refcounts/PyList_SET_ITEM_macro/correct_multiple')388 exclude_test('tests/cpychecker/refcounts/PyList_SET_ITEM_macro/incorrect_multiple')389 exclude_test('tests/cpychecker/refcounts/PyList_Size/known-size')390 exclude_test('tests/cpychecker/refcounts/PySequence_SetItem/correct')391 exclude_test('tests/cpychecker/refcounts/PySequence_SetItem/incorrect')392 exclude_test('tests/cpychecker/refcounts/PySequence_Size/correct')393 exclude_test('tests/cpychecker/refcounts/PyString_AsString/correct')394 exclude_test('tests/cpychecker/refcounts/PyString_AsString/incorrect')395 exclude_test('tests/cpychecker/refcounts/PySys_SetObject/correct')396 exclude_test('tests/cpychecker/refcounts/PyTuple_SET_ITEM_macro/correct')397 exclude_test('tests/cpychecker/refcounts/PyTuple_SET_ITEM_macro/correct_multiple')398 exclude_test('tests/cpychecker/refcounts/PyTuple_SET_ITEM_macro/incorrect_multiple')399 exclude_test('tests/cpychecker/refcounts/PyTuple_SetItem/correct')400 exclude_test('tests/cpychecker/refcounts/PyTuple_SetItem/correct_multiple')401 exclude_test('tests/cpychecker/refcounts/PyTuple_SetItem/incorrect_multiple')402 exclude_test('tests/cpychecker/refcounts/Py_BuildValue/correct-code-N')403 exclude_test('tests/cpychecker/refcounts/Py_BuildValue/correct-code-O')404 exclude_test('tests/cpychecker/refcounts/correct_decref')405 exclude_test('tests/cpychecker/refcounts/loop_n_times')406 exclude_test('tests/cpychecker/refcounts/loops/complex-loop-conditional-1')407 exclude_test('tests/cpychecker/refcounts/loops/complex-loop-conditional-2')408 exclude_test('tests/cpychecker/refcounts/module_handling')409 exclude_test('tests/cpychecker/refcounts/object_from_callback')410 exclude_test('tests/cpychecker/refcounts/passing_dead_object')411 exclude_test('tests/cpychecker/refcounts/returning_dead_object')412 exclude_test('tests/cpychecker/refcounts/ticket-20')413 exclude_test('tests/cpychecker/refcounts/unrecognized_function2')414 exclude_test('tests/cpychecker/refcounts/unrecognized_function4')415 exclude_test('tests/cpychecker/refcounts/use_after_dealloc')416 exclude_test('tests/examples/spelling-checker')417# This test is unreliable, due to differences in the dictionary:418exclude_test('tests/examples/spelling-checker')419# Various tests don't work under GCC 4.7420# (or rather, don't give the same output as under 4.6):421if features['GCC_PYTHON_PLUGIN_CONFIG_has_PLUGIN_FINISH_DECL']:422 # assumes it's uninitialized:423 exclude_test('tests/cpychecker/absinterp/arrays5')424 # line number differerences:425 exclude_test('tests/cpychecker/absinterp/comparisons/expressions')426 exclude_test('tests/cpychecker/refcounts/combinatorial-explosion')427 exclude_test('tests/cpychecker/refcounts/combinatorial-explosion-with-error')428 exclude_test('tests/cpychecker/refcounts/correct_object_ctor')429 # sense of a boolean is reversed:430 exclude_test('tests/cpychecker/refcounts/fold_conditional')431 # gains gcc.Function('__deleting_dtor '):432 exclude_test('tests/examples/cplusplus/classes')433 # some gimple changes:434 exclude_test('tests/plugin/array-type')435 exclude_test('tests/plugin/arrays')436 # one less output:437 exclude_test('tests/plugin/callbacks/refs')438 # changes in output:439 exclude_test('tests/plugin/dumpfiles')440 # gains: :py:class:`gcc.WidenLshiftExpr` `w<<`441 exclude_test('tests/plugin/expressions/get_symbol')442 # gains an extra gcc.GimpleLabel():443 exclude_test('tests/plugin/gimple-cond/explicit-comparison')444 # gains an extra gcc.GimpleLabel():445 exclude_test('tests/plugin/gimple-cond/implicit-comparison')446 # various gimple changes:447 exclude_test('tests/plugin/gimple-walk-tree/dump-all')448 # gimple change:449 exclude_test('tests/plugin/gimple-walk-tree/exceptions')450 # gimple changes:451 exclude_test('tests/plugin/gimple-walk-tree/find-one')452 # various (char*) go away:453 exclude_test('tests/plugin/initializers')454 # cc1: fatal error: pass 'ipa-profile' not found but is referenced by new pass 'my-ipa-pass'455 exclude_test('tests/plugin/new-passes')456 # -Wunitialized is now disabled by default:457 exclude_test('tests/plugin/options')458 # KeyError: 'struct-reorg-cold-struct-ratio':459 exclude_test('tests/plugin/parameters')460 # gains an extra gcc.GimpleLabel():461 exclude_test('tests/plugin/switch')462 # test_var isn't visible; see463 # https://fedorahosted.org/gcc-python-plugin/ticket/21464 exclude_test('tests/plugin/translation-units')465if sys.version_info[:2] == (3, 3):466 # These tests don't generate the same output under 3.3:467 exclude_test('tests/cpychecker/refcounts/combinatorial-explosion')468 exclude_test('tests/cpychecker/refcounts/combinatorial-explosion-with-error')469num_passes = 0470skipped_tests = []471failed_tests = []472for testdir in sorted(testdirs):473 try:474 sys.stdout.write('%s: ' % testdir)475 run_test(testdir)476 print('OK')477 num_passes += 1478 except SkipTest:479 err = sys.exc_info()[1]480 print('skipped: %s' % err.reason)481 skipped_tests.append(testdir)482 except RuntimeError:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful