2020-02-27 00:06:29 +08:00
|
|
|
import os
|
|
|
|
import shutil
|
2020-05-18 22:04:03 +08:00
|
|
|
import tempfile
|
2020-02-27 00:06:29 +08:00
|
|
|
import uuid
|
2020-05-18 22:04:03 +08:00
|
|
|
|
2020-02-27 00:06:29 +08:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope='function', autouse=True)
|
|
|
|
def tmpdir_name():
|
|
|
|
path = None
|
|
|
|
try:
|
|
|
|
path = os.path.join(tempfile.gettempdir(), uuid.uuid4().hex)
|
|
|
|
yield path
|
|
|
|
finally:
|
|
|
|
if path:
|
|
|
|
shutil.rmtree(path, ignore_errors=True)
|