original_docstring: 
      Helper function to run a test in its own process.
  
      Avoids issues with Singleton- or otherwise-cached environment variable lookups in the backend.
      Adds a seed as first arg to propagate determinism.
  
      Parameters
      ----------
  
      func : function to run in a spawned process.
      env : dict of additional environment values to set temporarily in the environment before exec.
      args : args to pass to the function.
  
      Returns
      -------
      Whether the python version supports running the function as a spawned process.
  
      This routine calculates a random seed and passes it into the test as a first argument.  If the
      test uses random values, it should include an outer 'with random_seed(seed):'.  If the
      test needs to return values to the caller, consider use of shared variable arguments.
      
docstring: Helper function to run a test in its own process.
  Avoids issues with Singleton- or otherwise-cached environment variable lookups in the backend.
  Adds a seed as first arg to propagate determinism.
  
  Parameters
  
  func : function to run in a spawned process.
  env : dict of additional environment values to set temporarily in the environment before exec.
  args : args to pass to the function.
  
  Returns
  
  Whether the python version supports running the function as a spawned process.
  
  This routine calculates a random seed and passes it into the test as a first argument.  If the
  test uses random values, it should include an outer 'with random_seed:'.  If the
  test needs to return values to the caller, consider use of shared variable arguments.
docstring_tokens: Helper function to run a test in its own process . Avoids issues with Singleton - or otherwise - cached environment variable lookups in the backend . Adds a seed as first arg to propagate determinism . Parameters func : function to run in a spawned process . env : dict of additional environment values to set temporarily in the environment before exec . args : args to pass to the function . Returns Whether the python version supports running the function as a spawned process . This routine calculates a random seed and passes it into the test as a first argument . If the test uses random values it should include an outer ' with random_seed : ' . If the test needs to return values to the caller consider use of shared variable arguments .
code: def run_in_spawned_process(func, env, *args):
      """
      Helper function to run a test in its own process.
  
      Avoids issues with Singleton- or otherwise-cached environment variable lookups in the backend.
      Adds a seed as first arg to propagate determinism.
  
      Parameters
      ----------
  
      func : function to run in a spawned process.
      env : dict of additional environment values to set temporarily in the environment before exec.
      args : args to pass to the function.
  
      Returns
      -------
      Whether the python version supports running the function as a spawned process.
  
      This routine calculates a random seed and passes it into the test as a first argument.  If the
      test uses random values, it should include an outer 'with random_seed(seed):'.  If the
      test needs to return values to the caller, consider use of shared variable arguments.
      """
      try:
          mpctx = mp.get_context('spawn')
      except:
          print('SKIP: python%s.%s lacks the required process fork-exec support ... ' %
                sys.version_info[0:2], file=sys.stderr, end='')
          return False
      else:
          seed = np.random.randint(0,1024*1024*1024)
          orig_environ = os.environ.copy()
          try:
              for (key, value) in env.items():
                  os.environ[key] = str(value)
              # Prepend seed as first arg
              p = mpctx.Process(target=func, args=(seed,)+args)
              p.start()
              p.join()
              assert p.exitcode == 0, "Non-zero exit code %d from %s()." % (p.exitcode, func.__name__)
          finally:
              os.environ.clear()
              os.environ.update(orig_environ)
      return True
code_tokens: def run_in_spawned_process ( func , env , * args ) : try : mpctx = mp . get_context ( 'spawn' ) except : print ( 'SKIP: python%s.%s lacks the required process fork-exec support ... ' % sys . version_info [ 0 : 2 ] , file = sys . stderr , end = '' ) return False else : seed = np . random . randint ( 0 , 1024 * 1024 * 1024 ) orig_environ = os . environ . copy ( ) try : for ( key , value ) in env . items ( ) : os . environ [ key ] = str ( value ) p = mpctx . Process ( target = func , args = ( seed , ) + args ) p . start ( ) p . join ( ) assert p . exitcode == 0 , "Non-zero exit code %d from %s()." % ( p . exitcode , func . __name__ ) finally : os . environ . clear ( ) os . environ . update ( orig_environ ) return True
short_docstring: Helper function to run a test in its own process.
short_docstring_tokens: Helper function to run a test in its own process .
comment: """
      Helper function to run a test in its own process.
  
      Avoids issues with Singleton- or otherwise-cached environment variable lookups in the backend.
      Adds a seed as first arg to propagate determinism.
  
      Parameters
      ----------
  
      func : function to run in a spawned process.
      env : dict of additional environment values to set temporarily in the environment before exec.
      args : args to pass to the function.
  
      Returns
      -------
      Whether the python version supports running the function as a spawned process.
  
      This routine calculates a random seed and passes it into the test as a first argument.  If the
      test uses random values, it should include an outer 'with random_seed(seed):'.  If the
      test needs to return values to the caller, consider use of shared variable arguments.
      """$SEP$# Prepend seed as first arg