cement/tests/conftest.py

27 lines
445 B
Python
Raw Permalink Normal View History

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
2018-03-02 03:23:38 +00:00
@pytest.fixture(scope="function")
def tmp(request):
2018-08-21 06:13:17 +00:00
t = fs.Tmp()
yield t
# cleanup
2018-07-27 20:50:35 +00:00
if os.path.exists(t.dir) and t.cleanup is True:
shutil.rmtree(t.dir)
2018-03-02 03:23:38 +00:00
@pytest.fixture(scope="function")
def key(request):
yield _rando()
2018-03-02 03:23:38 +00:00
@pytest.fixture(scope="function")
def rando(request):
yield _rando()[:12]