def test_yaml_read_ioerror(monkeypatch): monkeypatch.setattr("__builtin__.open", fake_invalid_open()) with raises(error.ConnError): util.yaml_read("/tmp/yaml")
def test_file_read_invalid(monkeypatch): monkeypatch.setattr("os.open", fake_invalid_open()) with raises(error.NotFound): util.file_read("/invalid/directory/file")