<s> __author__ = '<STR_LIT>' <EOL> import copy as cp <EOL> import sys <EOL> try : <EOL> import scoop <EOL> import random <EOL> except ImportError : <EOL> scoop = None <EOL> import pypet . compat as compat <EOL> def identity ( x ) : <EOL> return x <EOL> def check_mock ( ) : <EOL> if scoop . IS_RUNNING : <EOL> print ( '<STR_LIT>' ) <EOL> mock = False <EOL> else : <EOL> mock = True <EOL> return mock <EOL> class SharedMock ( object ) : <EOL> def __init__ ( self ) : <EOL> self . constants = { } <EOL> self . signal = True <EOL> def mock ( self ) : <EOL> scoop . IS_ORIGIN = True <EOL> scoop . worker = '<STR_LIT>' <EOL> scoop . shared = self <EOL> def setConst ( self , ** kwargs ) : <EOL> if self . signal : <EOL> print ( '<STR_LIT>' ) <EOL> self . signal = False <EOL> self . constants . update ( cp . deepcopy ( kwargs ) ) <EOL> def getConst ( self , const , timeout ) : <EOL> return cp . deepcopy ( self . constants [ const ] ) <EOL> import pypet . environment <EOL> if check_mock ( ) : <EOL> shared_mock = SharedMock ( ) <EOL> shared_mock . mock ( ) <EOL> try : <EOL> reload ( pypet . environment ) <EOL> except NameError : <EOL> import importlib <EOL> importlib . reload ( pypet . environment ) <EOL> from pypet . tests . integration . environment_test import EnvironmentTest , ResultSortTest <EOL> from pypet . tests . integration . environment_multiproc_test import check_nice <EOL> import pypet . pypetconstants as pypetconstants <EOL> from pypet . tests . testutils . ioutils import parse_args , run_suite , get_random_port_url <EOL> from pypet . tests . testutils . data import unittest <EOL> @ unittest . skipIf ( scoop is None , '<STR_LIT>' ) <EOL> class MultiprocSCOOPNetqueueTest ( EnvironmentTest ) : <EOL> tags = '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> def set_mode ( self ) : <EOL> super ( MultiprocSCOOPNetqueueTest , self ) . set_mode ( ) <EOL> self . mode = pypetconstants . WRAP_MODE_NETQUEUE <EOL> self . multiproc = True <EOL> self . freeze_input = False <EOL> self . ncores = <NUM_LIT:4> <EOL> self . gc_interval = <NUM_LIT:3> <EOL> self . niceness = check_nice ( <NUM_LIT:1> ) <EOL> self . use_pool = False <EOL> self . use_scoop = True <EOL> self . graceful_exit = False <EOL> @ unittest . skip ( '<STR_LIT>' ) <EOL> def test_niceness ( self ) : <EOL> pass <EOL> @ unittest . skipIf ( scoop is None , '<STR_LIT>' ) <EOL> class MultiprocSCOOPSortLocalTest ( ResultSortTest ) : <EOL> tags = '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> def set_mode ( self ) : <EOL> super ( MultiprocSCOOPSortLocalTest , self ) . set_mode ( ) <EOL> self . mode = pypetconstants . WRAP_MODE_LOCAL <EOL> self . freeze_input = False <EOL> self . multiproc = True <EOL> self . ncores = <NUM_LIT:4> <EOL> self . use_pool = False <EOL> self . use_scoop = True <EOL> self . graceful_exit = False <EOL> @ unittest . skip ( '<STR_LIT>' ) <EOL> def test_graceful_exit ( self ) : <EOL> pass <EOL> @ unittest . skipIf ( scoop is None , '<STR_LIT>' ) <EOL> class MultiprocFrozenSCOOPLocalTest ( EnvironmentTest ) : <EOL> tags = '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> def set_mode ( self ) : <EOL> super ( MultiprocFrozenSCOOPLocalTest , self ) . set_mode ( ) <EOL> self . mode = pypetconstants . WRAP_MODE_LOCAL <EOL> self . multiproc = True <EOL> self . freeze_input = True <EOL> self . ncores = <NUM_LIT:4> <EOL> self . gc_interval = <NUM_LIT:3> <EOL> self . niceness = check_nice ( <NUM_LIT:1> ) <EOL> self . use_pool = False <EOL> self . use_scoop = True <EOL> self . graceful_exit = False <EOL> @ unittest . skip ( '<STR_LIT>' ) <EOL> def test_niceness ( self ) : <EOL> pass <EOL> @ unittest . skipIf ( scoop is None , '<STR_LIT>' ) <EOL> class MultiprocFrozenSCOOPSortNetlockTest ( ResultSortTest ) : <EOL> tags = '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> def set_mode ( self ) : <EOL> super ( MultiprocFrozenSCOOPSortNetlockTest , self ) . set_mode ( ) <EOL> self . mode = pypetconstants . WRAP_MODE_NETLOCK <EOL> self . freeze_input = True <EOL> self . multiproc = True <EOL> self . ncores = <NUM_LIT:4> <EOL> self . use_pool = False <EOL> self . use_scoop = True <EOL> self . port = ( <NUM_LIT> , <NUM_LIT> ) <EOL> self . graceful_exit = False <EOL> @ unittest . skip ( '<STR_LIT>' ) <EOL> def test_graceful_exit ( self ) : <EOL> pass <EOL> @ unittest . skipIf ( scoop is None , '<STR_LIT>' ) <EOL> class MultiprocFrozenSCOOPSortNetqueueTest ( ResultSortTest ) : <EOL> tags = '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> def set_mode ( self ) : <EOL> super ( MultiprocFrozenSCOOPSortNetqueueTest , self ) . set_mode ( ) <EOL> self . mode = pypetconstants . WRAP_MODE_NETQUEUE <EOL> self . freeze_input = True <EOL> self . multiproc = True <EOL> self . ncores = <NUM_LIT:4> <EOL> self . use_pool = False <EOL> self . use_scoop = True <EOL> self . graceful_exit = False <EOL> @ unittest . skip ( '<STR_LIT>' ) <EOL> def test_graceful_exit ( self ) : <EOL> pass <EOL> @ unittest . skipIf ( scoop is None , '<STR_LIT>' ) <EOL> class MultiprocSCOOPNetlockTest ( EnvironmentTest ) : <EOL> tags = '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> def set_mode ( self ) : <EOL> super ( MultiprocSCOOPNetlockTest , self ) . set_mode ( ) <EOL> self . mode = pypetconstants . WRAP_MODE_NETLOCK <EOL> self . multiproc = True <EOL> self . freeze_input = False <EOL> self . ncores = <NUM_LIT:4> <EOL> self . gc_interval = <NUM_LIT:3> <EOL> self . niceness = check_nice ( <NUM_LIT:1> ) <EOL> self . use_pool = False <EOL> self . use_scoop = True <EOL> self . port = None <EOL> self . timeout = <NUM_LIT> <EOL> self . graceful_exit = False <EOL> @ unittest . skip ( '<STR_LIT>' ) <EOL> def test_niceness ( self ) : <EOL> pass <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> opt_args = parse_args ( ) <EOL> run_suite ( ** opt_args ) </s>
