def test_py_file_wrong_suffix(): foo_file = py_file.with_suffix('.foo') with open(foo_file, 'w'): pass with pytest.raises(IOError, match='use an ".py" file'): main(har_file, foo_file) foo_file.unlink()
def test_py_file_already_exists_overwrite_false(): with open(py_file, 'w'): pass with pytest.raises(IOError): main(har_file, py_file, overwrite=False) assert py_file.is_file() py_file.unlink()
def test_main(har_file, py_file): main(har_file, py_file, overwrite=True)
def test_py_file_already_exists_overwrite_true(): with open(py_file, 'w'): pass main(har_file, py_file, overwrite=True) py_file.unlink()
def test_har_file_not_found(): har_file_foo = inputs_dir / 'foo.har' with pytest.raises(FileNotFoundError): main(har_file_foo, py_file)