def test_run_defaultcfg(tmp_path): os.environ['PYPPL2_f100_forks'] = '100' config._load('PYPPL2.osenv') pF100 = Proc() pF100.input = {'a': [0]} PyPPL().start(pF100).run('f100') assert pF100.forks == 100
def test_readconfig_preload(tmpdir): config._load({'xyz': {'runner': 'sge', 'forks': 50}}) p18 = Proc() p18._readConfig('xyz', Config()) assert p18.runner == 'sge' assert p18.forks == 50 assert p18.config.runner == 'xyz'
def test_readconfig(tmpdir): p16 = Proc() assert p16.id == 'p16' # nothing updated p16._readConfig(None, Config()) assert p16.id == 'p16' config = Config() config._load({'f20': {'forks': 20}}) p16.forks = 10 p16._readConfig({'forks': 30}, config) assert p16.id == 'p16' assert p16.forks == 10 assert p16.runner == 'local' assert p16.config.runner == '__tmp__' p17 = Proc() p17.forks = 10 config = Config() config._load({'f30': {'forks': 20}}) # no such profile in config p17._readConfig('dry', config) assert p17.forks == 10 assert p17.runner == 'dry' assert p17.config.runner == 'dry'
def test_readconfig_preset(tmpdir): p181 = Proc() p181.runner = 'xyz' config = Config() cfile = tmpdir / 'test_readconfig_preset.ini' cfile.write_text(""" [xyz] runner: sge forks: 50 """) config._load(cfile) p181._readConfig('', config) assert p181.runner == 'sge' assert p181.forks == 50 assert p181.config.runner == 'xyz'