Beispiel #1
0
def test_invalid_analyzer():
    with patch('glob.glob', glob.glob):
        parser = ConfigParser()
        config_with_invalid_analyzer = yaml.load(
            TEST_CONFIG.replace('cmsl1t.analyzers.demo_analyzer', 'ben'))
        assert_raises(IOError, parser._read_config,
                      config_with_invalid_analyzer)
Beispiel #2
0
def test_invalid_section():
    with patch('glob.glob', glob.glob):
        parser = ConfigParser()
        config_with_invalid_section = yaml.load(
            TEST_CONFIG.replace('analysis:', 'ryan:'))
        assert_raises(IOError, parser._read_config,
                      config_with_invalid_section)
Beispiel #3
0
def test_invalid_modifier():
    with patch('glob.glob', glob.glob):
        parser = ConfigParser()
        config_with_invalid_analyzer = yaml.load(
            TEST_CONFIG.replace('cmsl1t.recalc.met.l1MetNot28', 'olivier'))
        assert_raises(IOError, parser._read_config,
                      config_with_invalid_analyzer)
Beispiel #4
0
def test_input_section_missing_files():
    with patch('glob.glob', glob.glob):
        parser = ConfigParser()
        bad_input_files = TEST_CONFIG.replace('/tmp/l1t/L1Ntuple_*.root',
                                              '/tmp/missingFile')
        config_with_missing_files = yaml.load(bad_input_files)

        assert_raises(IOError, parser._read_config, config_with_missing_files)
Beispiel #5
0
def test_input_section():
    with patch('glob.glob', glob.glob):
        parser = ConfigParser()
        parser._read_config(yaml.load(TEST_CONFIG))
        assert parser.get('input', 'files') == ALL_EXISTING_FILES
        assert parser.get('input', 'sample') == {
            'name': 'Data', 'title': '2016 Data'}
Beispiel #6
0
def test_general_section():
    with patch('glob.glob', glob.glob):
        parser = ConfigParser()
        parser._read_config(yaml.load(TEST_CONFIG))
        assert_equal(parser.get('general', 'version'), '0.0.1')
        assert_equal(parser.get('general', 'name'), 'Benchmark')