def test_compute_builds_intradependencies(testing_workdir, monkeypatch, mocker): """When we build stuff, and upstream dependencies are part of the batch, but they're also already installable, then we do extra work to make sure that we order our build so that downstream builds depend on upstream builds (and don't directly use the already-available packages.)""" monkeypatch.chdir(os.path.join(test_data_dir, 'intradependencies')) # neutralize git checkout so we're really testing the HEAD commit mocker.patch.object(execute, 'checkout_git_rev') output_dir = os.path.join(testing_workdir, 'output') execute.compute_builds('.', 'config-name', 'master', folders=['zlib', 'uses_zlib'], matrix_base_dir=os.path.join( test_data_dir, 'linux-config-test'), output_dir=output_dir) assert os.path.isdir(output_dir) files = os.listdir(output_dir) assert 'plan.yml' in files with open(os.path.join(output_dir, 'plan.yml')) as f: plan = yaml.load(f) uses_zlib_job = [ job for job in plan['jobs'] if job['name'] == 'uses_zlib-1.0-on-centos5-64' ][0] assert any( task.get('passed') == ['zlib-1.2.8-on-centos5-64'] for task in uses_zlib_job['plan'])
def main(args=None): if not args: args, pass_throughs = parse_args() else: args, pass_throughs = parse_args(args) if args.debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) if args.subparser_name == 'submit': args_dict = args.__dict__ if not args_dict.get('config_root_dir'): args_dict['config_root_dir'] = args_dict['base_name'] execute.submit(pass_throughs=pass_throughs, **args_dict) elif args.subparser_name == 'bootstrap': execute.bootstrap(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'examine': execute.compute_builds(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'one-off': execute.submit_one_off(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'batch': execute.submit_batch(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'rm': execute.rm_pipeline(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'trigger': execute.trigger_pipeline(pass_throughs=pass_throughs, **args.__dict__) elif args.subparser_name == 'abort': execute.abort_pipeline(pass_throughs=pass_throughs, **args.__dict__) else: # this is here so that if future subcommands are added, you don't forget to add a bit # here to enable them. raise NotImplementedError("Command {} is not implemented".format( args.subparser_name))
def test_compute_builds_dies_when_no_folders_and_no_git( testing_workdir, mocker, capfd): changed = mocker.patch.object(execute, 'git_changed_recipes') changed.return_value = None output_dir = os.path.join(testing_workdir, 'output') execute.compute_builds('.', 'config-name', 'master', folders=None, matrix_base_dir=os.path.join( test_data_dir, 'linux-config-test'), output_dir=output_dir) out, err = capfd.readouterr() assert "No folders specified to build" in out
def test_compute_builds(testing_workdir, mocker, monkeypatch): monkeypatch.chdir(test_data_dir) output = os.path.join(testing_workdir, 'output') # neutralize git checkout so we're really testing the HEAD commit mocker.patch.object(execute, 'checkout_git_rev') execute.compute_builds('.', 'config-name', 'master', folders=['python_test', 'conda_forge_style_recipe'], matrix_base_dir=os.path.join( test_data_dir, 'linux-config-test'), output_dir=output) assert os.path.isdir(output) files = os.listdir(output) assert 'plan.yml' in files assert os.path.isfile( os.path.join(output, 'frank-1.0-python_2.7-on-centos5-64', 'meta.yaml')) assert os.path.isfile( os.path.join(output, 'frank-1.0-python_2.7-on-centos5-64/', 'conda_build_config.yaml')) assert os.path.isfile( os.path.join(output, 'frank-1.0-python_3.6-on-centos5-64', 'meta.yaml')) assert os.path.isfile( os.path.join(output, 'frank-1.0-python_3.6-on-centos5-64/', 'conda_build_config.yaml')) assert os.path.isfile( os.path.join(output, 'dummy_conda_forge_test-1.0-on-centos5-64', 'meta.yaml')) with open( os.path.join(output, 'dummy_conda_forge_test-1.0-on-centos5-64/', 'conda_build_config.yaml')) as f: cfg = f.read() assert cfg is not None if hasattr(cfg, 'decode'): cfg = cfg.decode() assert "HashableDict" not in cfg