Jim Paris
a3f444eb25
There'es some issue with tons of requests getting slowly blocked, though... git-svn-id: https://bucket.mit.edu/svn/nilm/nilmdb@10678 ddd99763-3ecb-0310-9145-efcb8ce7c51f
33 lines
654 B
Python
33 lines
654 B
Python
# Just some helpers for test functions
|
|
|
|
import shutil, os
|
|
|
|
def myrepr(x):
|
|
if isinstance(x, basestring):
|
|
return '"' + x + '"'
|
|
else:
|
|
return repr(x)
|
|
|
|
def eq_(a, b):
|
|
if not a == b:
|
|
raise AssertionError("%s != %s" % (myrepr(a), myrepr(b)))
|
|
|
|
def in_(a, b):
|
|
if a not in b:
|
|
raise AssertionError("%s not in %s" % (myrepr(a), myrepr(b)))
|
|
|
|
def ne_(a, b):
|
|
if not a != b:
|
|
raise AssertionError("unexpected %s == %s" % (myrepr(a), myrepr(b)))
|
|
|
|
def recursive_unlink(path):
|
|
try:
|
|
shutil.rmtree(path)
|
|
except OSError:
|
|
pass
|
|
try:
|
|
os.unlink(path)
|
|
except OSError:
|
|
pass
|
|
|