import unittest import sh class Qram(unittest.TestCase): params = None __memsize = "10M" __loops = "1" # varlist: memsize, loops def __init__(self, testname, testfunc, varlist): self.params = varlist super(Qram, self).__init__(testfunc) if "memsize" in varlist: self.__memsize = varlist["memsize"] else: raise Exception('memsize param inside Qram must be defined') if "loops" in varlist: self.__loops = varlist["loops"] else: raise Exception('loops param inside Qram must be defined') self._testMethodDoc = testname def execute(self): try: sh.memtester(self.__memsize, "1", _out="/dev/null") except sh.ErrorReturnCode as e: self.fail("failed: could not complete memtester command")