Пример #1
0
 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()
Пример #2
0
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()))
Пример #3
0
 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()
Пример #4
0
 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
Пример #5
0
 def setUp(self):
     self.config = {"backend": {"redis": "redis://:@localhost:6379/0"}}
     self.lox = Lox("poppyseedbagel", config=self.config)
     self.lox.clear_all()
Пример #6
0
 def test_1(self):
     my = Lox(['scan_1.l'])
     assert 10 == len(my.tokens)
Пример #7
0
 def test_5(self):
     my = Lox(["scan_5.l"])
     print(len(my.tokens))
     assert 19 == len(my.tokens)
Пример #8
0
 def test_3(self):
     my = Lox(["scan_3.l"])
     assert 4 == len(my.tokens)
Пример #9
0
 def test_2(self):
     my = Lox(["scan_2.l"])
     print(len(my.tokens))
     assert 17 == len(my.tokens)