6 from os
.path
import join
7 from os
.path
import dirname
8 from os
.path
import basename
10 TEST_SCRIPT_DIR
= dirname(__file__
)
11 ROOT_TMP_DIR
= join( dirname(TEST_SCRIPT_DIR
), 'tmp' )
12 TEST_TMP_DIR
= join( ROOT_TMP_DIR
, basename(sys
.argv
[0]) )
14 DEBUG_MODE
= os
.getenv("DEBUG",'')
18 parentdir
= dirname(newdir
)
19 if not os
.path
.isdir(parentdir
):
21 if not os
.path
.isdir(newdir
):
28 return '%s-%d.%04d' % (TEST_TMP_DIR
, os
.getpid(), LAST_IDX
)
30 def create_test_dir():
40 os
.chdir(ROOT_TMP_DIR
)
43 def remove_test_dir():
50 result
= os
.system(cmd
)
55 out
= p
.read().strip()
59 # All tests that operate on temporary data
60 # derive from testutils.TestCase
61 class TestCase(unittest
.TestCase
):
68 self
.failIf(result
!= 0)