2017-12-27 21:42:38 +00:00
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
import shutil
|
|
|
|
|
import pytest
|
|
|
|
|
from cement.utils.misc import rando as _rando
|
2018-08-21 06:13:17 +00:00
|
|
|
from cement.utils import fs
|
2017-12-27 21:42:38 +00:00
|
|
|
|
2018-03-02 03:23:38 +00:00
|
|
|
|
2017-12-27 21:42:38 +00:00
|
|
|
@pytest.fixture(scope="function")
|
|
|
|
|
def tmp(request):
|
2018-08-21 06:13:17 +00:00
|
|
|
t = fs.Tmp()
|
2017-12-27 21:42:38 +00:00
|
|
|
yield t
|
|
|
|
|
|
|
|
|
|
# cleanup
|
2018-07-27 20:50:35 +00:00
|
|
|
if os.path.exists(t.dir) and t.cleanup is True:
|
2017-12-27 21:42:38 +00:00
|
|
|
shutil.rmtree(t.dir)
|
|
|
|
|
|
2018-03-02 03:23:38 +00:00
|
|
|
|
2017-12-27 21:42:38 +00:00
|
|
|
@pytest.fixture(scope="function")
|
|
|
|
|
def key(request):
|
|
|
|
|
yield _rando()
|
|
|
|
|
|
2018-03-02 03:23:38 +00:00
|
|
|
|
2017-12-27 21:42:38 +00:00
|
|
|
@pytest.fixture(scope="function")
|
|
|
|
|
def rando(request):
|
2024-02-27 02:13:02 +00:00
|
|
|
yield _rando()[:12]
|