1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-09 00:49:18 +00:00

tests refactoring

This commit is contained in:
deadc0de6
2019-03-10 21:23:23 +01:00
parent cbca270a36
commit 8519578db4
2 changed files with 7 additions and 7 deletions

View File

@@ -114,10 +114,10 @@ cd ${ddpath} | ${bin} install -f -c ${cfg} -p p1 -V
[ ! -e ${tmpd}/def ] && exit 1 [ ! -e ${tmpd}/def ] && exit 1
[ ! -e ${tmpd}/xyz ] && exit 1 [ ! -e ${tmpd}/xyz ] && exit 1
[ ! -e ${tmpd}/dyn ] && exit 1 [ ! -e ${tmpd}/dyn ] && exit 1
grep 'abc' ${tmpd}/abc grep 'abc' ${tmpd}/abc >/dev/null 2>&1
grep 'def' ${tmpd}/def grep 'def' ${tmpd}/def >/dev/null 2>&1
grep 'xyz' ${tmpd}/xyz grep 'xyz' ${tmpd}/xyz >/dev/null 2>&1
grep 'dyn' ${tmpd}/dyn grep 'dyn' ${tmpd}/dyn >/dev/null 2>&1
## CLEANING ## CLEANING
rm -rf ${tmps} ${tmpd} rm -rf ${tmps} ${tmpd}

View File

@@ -14,7 +14,7 @@ from dotdrop.options import Options
from dotdrop.linktypes import LinkTypes from dotdrop.linktypes import LinkTypes
from dotdrop.utils import strip_home from dotdrop.utils import strip_home
TMPSUFFIX = '.dotdrop' TMPSUFFIX = '-dotdrop-tests'
def clean(path): def clean(path):
@@ -33,12 +33,12 @@ def get_string(length):
"""Get a random string of length 'length'""" """Get a random string of length 'length'"""
alpha = string.ascii_uppercase + string.digits alpha = string.ascii_uppercase + string.digits
temp = ''.join(random.choice(alpha) for _ in range(length)) temp = ''.join(random.choice(alpha) for _ in range(length))
return 'dotdrop-tests-{}'.format(temp) return 'tmp.{}{}'.format(temp, TMPSUFFIX)
def get_tempdir(): def get_tempdir():
"""Get a temporary directory""" """Get a temporary directory"""
return tempfile.mkdtemp(prefix='dotdrop-tests-') return tempfile.mkdtemp(suffix=TMPSUFFIX)
def create_random_file(directory, content=None, def create_random_file(directory, content=None,