mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-06 18:55:38 +00:00
improve tests cleanup
This commit is contained in:
@@ -32,7 +32,8 @@ def clean(path):
|
||||
def get_string(length):
|
||||
"""Get a random string of length 'length'"""
|
||||
alpha = string.ascii_uppercase + string.digits
|
||||
return ''.join(random.choice(alpha) for _ in range(length))
|
||||
temp = ''.join(random.choice(alpha) for _ in range(length))
|
||||
return 'dotdrop-tests-{}'.format(temp)
|
||||
|
||||
|
||||
def get_tempdir():
|
||||
|
||||
@@ -150,6 +150,7 @@ exec bspwm
|
||||
# to test actions
|
||||
value = get_string(12)
|
||||
fact = '/tmp/action'
|
||||
self.addCleanup(clean, fact)
|
||||
act1 = Action('testaction', 'post', 'echo "{}" > {}'.format(value,
|
||||
fact))
|
||||
f8, c8 = create_random_file(tmp)
|
||||
|
||||
@@ -57,6 +57,7 @@ class TestUpdate(unittest.TestCase):
|
||||
dpath = os.path.join(fold_config, get_string(5))
|
||||
dir1 = create_dir(dpath)
|
||||
dirf1, _ = create_random_file(dpath)
|
||||
self.addCleanup(clean, dir1)
|
||||
|
||||
# create the config file
|
||||
profile = get_string(5)
|
||||
|
||||
Reference in New Issue
Block a user