def test_reading_launcher_importances_works(valid_importance_file): importances = LauncherImportance(valid_importance_file) importances.load() assert importances['/foo/bar/baz:myconfig'] == 10 assert importances['/foo/bar/baz:anotherconfig'] == 2
def test_reading_launcher_importances_works(valid_importance_file): importances = LauncherImportance(valid_importance_file) importances.load() assert importances['/foo/bar/baz:myconfig'] == 10 assert importances['/foo/bar/baz:anotherconfig'] == 2 assert importances['/foo/bar/baz:Myconfig'] == 10 assert importances['/foo/bar/baz:AnotherConfig'] == 2
def test_rewriting_launcher_importances_works(valid_importance_file): importances = LauncherImportance(valid_importance_file) importances.load() importances['/foo/bar/baz:myconfig'] = 8 importances.save() assert os.path.exists(valid_importance_file) with open(valid_importance_file) as save_file: data = save_file.read() assert '[/foo/bar/baz]' in data assert 'myconfig = 8' in data
def test_writing_launcher_importances_works(tmpdir): save_file = tmpdir.join('test/output.ini') importances = LauncherImportance(str(save_file)) importances['/my/config/path/:config1'] = 10 importances['/my/config/path/:config2'] = 2 importances['/home/alexander/:another_config'] = 0 importances.save() assert os.path.exists(str(save_file)) data = save_file.read() assert '[/my/config/path/]' in data assert '[/home/alexander/]' in data assert 'config1 = 10' in data assert 'config2 = 2' in data assert 'another_config = 0' in data
def test_regression_paths_with_dot_cause_problems(tmpdir): save_file = tmpdir.join('test/output.ini') importances = LauncherImportance(str(save_file)) importances['./foo/bar/:config1'] = 10 importances['.:config1'] = 2 importances.save() importances.load() importances['./foo/bar/:config1'] == 3 importances.save() assert os.path.exists(str(save_file)) data = save_file.read() assert '[./foo/bar/]' in data assert 'config1 = 3' not in data # ConfigParser causes problems with . in the section name
def test_reading_launcher_importances_with_non_existing_file_does_not_throw_error( tmpdir): save_file = tmpdir.join('save.ini') importances = LauncherImportance(str(save_file)) importances.load()
def test_reading_launcher_importances_with_non_existing_file_does_not_throw_error(tmpdir): save_file = tmpdir.join('save.ini') importances = LauncherImportance(str(save_file)) importances.load()