Python module to make testing easier, it can generate random data like names and text, run commands, fetch urls, create files and directories, and more
class BaseTestCase(TestCase):
def get_body(self, filename):
basepath = os.path.abspath(os.path.expanduser(os.path.dirname(__file__)))
path = os.path.join(basepath, "testdata", filename)
with codecs.open(path, encoding='utf-8', mode='r') as f:
#with open(path) as f:
body = f.read()
return body
but I've done a very similar thing in a few different projects, basically I have a testdata directory that contains files that my tests will parse, so something like:
Contents(str):
directory = "/some/environ/setting?"
def __new__(cls, fileroot):
# glob for directory/fileroot.* and load that into the contents of this string
This is the one from Wishlist:
but I've done a very similar thing in a few different projects, basically I have a
testdata
directory that contains files that my tests will parse, so something like: