def setUp(self): super(LoxPostgresTests, self).setUp() self.config = { "backend": { "postgres": "postgresql://*****:*****@localhost/postgres" } } self.lox = Lox("everythingbagel", config=self.config) self.lox.clear_all()
def run_test(filename): # Run the lox compiler with a file lox = Lox() # <-- absolute dir the script is in script_dir = os.path.dirname(__file__) filepath = os.path.join(script_dir, filename) print(filepath) try: with open(filepath, 'r') as f: errors = [] source = f.read() lox.run(source, errors) except Exception as err: print("Error during compilation of {0}. Error is {1}\n{2}". format(filepath, str(err), traceback.format_exc()))
def setUp(self): self.config = {"backend": {"redis": "redis://:@localhost:6379/0"}} self.lox = Lox("sesamebagel", config=self.config) self.lox.clear_all() self.lock = None super(LockTests, self).setUp()
def __ctx_manager(self, test_config): with Lox(config=test_config) as test_lox: self.assertIsNotNone(test_lox.context_lock) self.assertEqual(test_lox.context_lock.state, STATE_ACQUIRED) self.assertEqual(test_lox.context_lock.state, STATE_RELEASED) return test_lox
def setUp(self): self.config = {"backend": {"redis": "redis://:@localhost:6379/0"}} self.lox = Lox("poppyseedbagel", config=self.config) self.lox.clear_all()
def test_1(self): my = Lox(['scan_1.l']) assert 10 == len(my.tokens)
def test_5(self): my = Lox(["scan_5.l"]) print(len(my.tokens)) assert 19 == len(my.tokens)
def test_3(self): my = Lox(["scan_3.l"]) assert 4 == len(my.tokens)
def test_2(self): my = Lox(["scan_2.l"]) print(len(my.tokens)) assert 17 == len(my.tokens)