21 lines
403 B
Python
21 lines
403 B
Python
import shutil
|
|
import tempfile
|
|
from pathlib import Path
|
|
from tempfile import NamedTemporaryFile
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture()
|
|
def tmpfile():
|
|
_tmpfile = NamedTemporaryFile(delete=False)
|
|
with open(_tmpfile.name, "w") as file:
|
|
yield file
|
|
Path(_tmpfile.name).unlink()
|
|
|
|
|
|
@pytest.fixture()
|
|
def tmpdir():
|
|
tmpdir = Path(tempfile.mkdtemp())
|
|
yield tmpdir
|
|
shutil.rmtree(tmpdir)
|