@@ -168,6 +168,9 @@ def requires(requirement: str):
168168 elif "console" == requirement :
169169 return pytest .mark .console
170170
171+ elif "gui" == requirement :
172+ return pytest .mark .gui
173+
171174 else :
172175 return requires_dependency (requirement )
173176
@@ -338,25 +341,28 @@ def pytest_addoption(parser):
338341 "--console" ,
339342 action = "store_true" ,
340343 default = False ,
344+ dest = "console" ,
341345 help = "run console tests" ,
342346 )
343- parser .addoption ("--gui" , action = "store_true" , default = False , help = "run GUI tests" )
344347 parser .addoption (
345- "--only-gui" ,
346- action = "store_true" ,
347- default = False ,
348- help = "run only GUI tests" ,
348+ "--gui" , action = "store_true" , default = False , dest = "gui" , help = "run GUI tests"
349349 )
350350
351351
352- def pytest_collection_modifyitems (config , items ):
352+ def pytest_collection_modifyitems (session , config , items ):
353353 if not config .getoption ("--console" ):
354354 # --console given in cli: run console interface tests
355355 skip_console = pytest .mark .skip (reason = "need --console option to run" )
356356 for item in items :
357357 if "console" in item .keywords :
358358 item .add_marker (skip_console )
359359
360+ if not config .getoption ("--gui" ):
361+ skip_gui = pytest .mark .skip (reason = "need --gui option to run" )
362+ for item in items :
363+ if "gui" in item .keywords :
364+ item .add_marker (skip_gui )
365+
360366 if not HAS_GRPC :
361367 skip_grpc = pytest .mark .skip (
362368 reason = "Requires gRPC connection (at least v211 to run)"
@@ -365,21 +371,6 @@ def pytest_collection_modifyitems(config, items):
365371 if "skip_grpc" in item .keywords :
366372 item .add_marker (skip_grpc )
367373
368- only_gui_filter = config .getoption ("--only-gui" )
369- if only_gui_filter :
370- new_items = []
371- for item in items :
372- mark = item .get_closest_marker ("requires_gui" )
373- if mark and mark .name == "requires_gui" :
374- new_items .append (item )
375- items [:] = new_items
376-
377- if not config .getoption ("--gui" ) and not only_gui_filter :
378- skip_gui = pytest .mark .skip (reason = "Requires to launch MAPDL GUI interface." )
379- for item in items :
380- if "requires_gui" in item .keywords :
381- item .add_marker (skip_gui )
382-
383374
384375################################################################
385376#
@@ -670,6 +661,7 @@ def _patch_method(method):
670661 (_patch_method ("_subscribe_to_channel" ), _returns ("" )),
671662 (_patch_method ("_run_at_connect" ), _returns ("" )),
672663 (_patch_method ("_exit_mapdl" ), _returns (None )),
664+ (_patch_method ("kill_job" ), _returns (None )),
673665 (
674666 _patch_method ("_check_mapdl_os" ),
675667 _returns ("linux" if os .name == "posix" else "win" ),
0 commit comments