def test_config_passing(self, config_update, pytest_main, testdir): tempdir = testdir.makefile( '.yaml', ocsci_conf='RUN: null', ).dirname main.main([ '--ocsci-conf', os.path.join(tempdir, 'ocsci_conf.yaml'), ]) assert config_update.call_args_list == [ mock.call(dict(RUN=None)), ]
def test_config_passing(self, config_update, pytest_main, testdir): tempdir = testdir.makefile( ".yaml", ocsci_conf="RUN: null", ).dirname main.main( [ "--ocsci-conf", os.path.join(tempdir, "ocsci_conf.yaml"), ] ) assert config_update.call_args_list[0] == mock.call(dict(RUN=None))
def test_multi_config_passing(self, config_update, pytest_main, testdir): tempdir = testdir.makefile( '.yaml', ocsci_conf1='RUN: null', ocsci_conf2='TEST_SECTION: null', ).dirname main.main([ '--ocsci-conf', f"{os.path.join(tempdir, 'ocsci_conf1.yaml')}", '--ocsci-conf', f"{os.path.join(tempdir, 'ocsci_conf2.yaml')}", ]) assert config_update.call_args_list == [ mock.call(dict(RUN=None)), mock.call(dict(TEST_SECTION=None)), ]
def test_multi_config_passing(self, config_update, pytest_main, testdir): tempdir = testdir.makefile( ".yaml", ocsci_conf1="RUN: null", ocsci_conf2="TEST_SECTION: null", ).dirname with raises(ValueError): main.main( [ "--ocsci-conf", f"{os.path.join(tempdir, 'ocsci_conf1.yaml')}", "--ocsci-conf", f"{os.path.join(tempdir, 'ocsci_conf2.yaml')}", ] ) assert config_update.call_args_list == [ mock.call(dict(RUN=None)), mock.call(dict(TEST_SECTION=None)), ]
def test_no_args(self, config_update, pytest_main, testdir): main.main([]) assert config_update.call_count == 2
def main(): arguments = sys.argv[1:] exit(runner.main(arguments))