def test_internal_fru_file_not_found(): path = os.path.join( os.path.dirname(__file__), 'internal-fru-file-not-found.ini' ) with pytest.raises(ValueError) as error: fru.read_config(path) assert 'not found' in error.msg
def test_identical_loading(name): path = os.path.join(os.path.dirname(__file__), 'basic-{}.ini'.format(name)) ini_data = fru.read_config(path) path = os.path.join(os.path.dirname(__file__), 'basic-{}.bin'.format(name)) bin_data = fru.load(path=path) assert ini_data == bin_data
def test_basic_ini_sections(name): path = os.path.join(os.path.dirname(__file__), 'basic-{}.ini'.format(name)) config = fru.read_config(path) actual = fru.dump(config) path = os.path.join(os.path.dirname(__file__), 'basic-{}.bin'.format(name)) with open(path, 'rb') as f: expected = f.read() assert actual == expected
def test_skipped_section(): path = os.path.join(os.path.dirname(__file__), 'skip-section.ini') config = fru.read_config(path) assert "internal" not in config
def test_internal_fru_requested_but_empty(): path = os.path.join(os.path.dirname(__file__), 'internal-empty.ini') data = fru.read_config(path) assert 'internal' not in data