@pytest.fixture
def py_proc():
 if getattr(sys, 'frozen', False):
  pytest.skip("Can't be run when frozen")
 def func(code):
  return (sys.executable, ['-c', textwrap.dedent(code.strip('\n'))])
 return func

@ pytest . fixture def py_proc ( ) : if getattr ( sys , 'frozen' , False ) : pytest . skip ( "Can't be run when frozen" ) def func ( code ) : return ( sys . executable , [ '-c' , textwrap . dedent ( code . strip ( '\n' ) ) ] ) return func
get a python executable and args list which executes the given code .