1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
# -*- mode: python; coding: utf-8 -*-
import os
from atheist.const import ATHEIST_TMP_BASE
fname = os.path.join(ATHEIST_TMP_BASE, '$testname')
Command('rm -f %s*' % fname)
def filename(n):
return '{0}-{1}'.format(fname, n)
def touch(n):
return "Test('echo hola > {0}', shell=True).gen += '{0}'".format(filename(n))
def exists(n):
return FileExists(filename(n))
t2 = Test('$atheist -vvo --dirty -s "%s"' % touch(1),
shell=True, desc="Check file creation (--dirty mode)")
t2.post += exists(1)
t3 = Test('rm %s-1' % fname)
t3.pre += exists(1)
t3.post += Not(exists(1))
t4 = Test('$atheist -s "%s"' % touch(2), shell=True, desc="Clean after test (default)")
t4.pre += Not(exists(2))
t4.post += Not(exists(2))
t5 = Test('$atheist -vvo --dirty -s "%s"' % touch(3),
shell=True, desc="Check file creation (--dirty mode)")
t5.post += exists(3)
t6 = Test('$atheist -C -s "%s"' % touch(3), shell=True, desc="-C: Clean only")
t6.pre += exists(3)
t6.post += Not(exists(3))
# clean also when test fails
touch_fail = "Test('touch {0}; exit 1', shell=True).gen += '{0}'".format(filename(4))
t7 = Test('$atheist -s "%s"' % touch_fail,
expected=1, shell=True, desc="clean even when fails (default)")
t7.post += Not(exists(4))
|