def setUp(self): # In sub classes use the following to call this setUp() from an overrided setUp() # super(<sub-class>, self).setUp() # Use seed from enviroment if it is set try: self.seed = long(os.environ[self.seed_var_name]) except KeyError: random.seed() self.seed = long(random.random() * 1e9) print(color.note('\n * Random seed: {} *'.format(self.seed))) random.seed(self.seed) VHDLTestCase.setUp(self)
def quit(self): print('\n\n' + color.note('*** Stopping Modelsim ***')) err = get_output(self.errq); #print('### Threads:', threading.enumerate()) self.p.stdin.write('quit\n') self.p.kill() self.p = None if len(err) > 0: print('#### Errors:\n', err) # Strip sentinel commands from the log with open(self.log_file, 'r') as fh: fh.readline() # Toss out first line with sentinel proc definition clean_log = [ln for ln in fh if not ln.startswith('sentinel')] with open(self.log_file, 'w') as fh: fh.writelines(clean_log)