2012-03-29 17:43:05 -04:00
|
|
|
# Just some helpers for test functions
|
|
|
|
|
|
|
|
import shutil, os
|
|
|
|
|
2012-04-04 18:34:01 -04:00
|
|
|
def myrepr(x):
|
|
|
|
if isinstance(x, basestring):
|
|
|
|
return '"' + x + '"'
|
|
|
|
else:
|
|
|
|
return repr(x)
|
|
|
|
|
2012-03-29 17:43:05 -04:00
|
|
|
def eq_(a, b):
|
|
|
|
if not a == b:
|
2012-04-04 18:34:01 -04:00
|
|
|
raise AssertionError("%s != %s" % (myrepr(a), myrepr(b)))
|
2012-03-29 17:43:05 -04:00
|
|
|
|
|
|
|
def in_(a, b):
|
|
|
|
if a not in b:
|
2012-04-04 18:34:01 -04:00
|
|
|
raise AssertionError("%s not in %s" % (myrepr(a), myrepr(b)))
|
2012-03-29 17:43:05 -04:00
|
|
|
|
|
|
|
def ne_(a, b):
|
|
|
|
if not a != b:
|
2012-04-04 18:34:01 -04:00
|
|
|
raise AssertionError("unexpected %s == %s" % (myrepr(a), myrepr(b)))
|
2012-03-29 17:43:05 -04:00
|
|
|
|
|
|
|
def recursive_unlink(path):
|
|
|
|
try:
|
|
|
|
shutil.rmtree(path)
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
try:
|
|
|
|
os.unlink(path)
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
|