def test_write_control_dict(tmpcase): """Writing to a mutable control dict should be reflected on disk.""" with tmpcase.mutable_data_file(FileName.CONTROL) as control: control['testing'] = 'oneTwoThree' dict_path = os.path.join(tmpcase.root_dir_path, 'system', 'controlDict') assert os.path.isfile(dict_path) content = read_data_file(dict_path) assert 'testing' in content assert content['testing'] == 'oneTwoThree'
def test_read_data_file_needs_file(tmpdir): """Reading a non-existent dictionary file raises.""" pn = tmpdir.join('noSuchDict').strpath assert not os.path.isfile(pn) with pytest.raises(IOError): read_data_file(pn)