Exemplo n.º 1
0
    def setUp(self):
        self.root = mkdtemp()
        use_filesystem(self.root)

        # make sure everything was clean
        db = get_compmake_db()
        for key in db.keys():
            db.delete(key)

        self.mySetUp()
Exemplo n.º 2
0
 def testExists2(self):
     k = 'ciao'
     v = {'complex': 123}
     db = get_compmake_db()
     if k in db:
         del db[k]
     self.assertFalse(k in db)
     db[k] = v
     self.assertTrue(k in db)
     del db[k]
     self.assertFalse(k in db)
     db[k] = v
     del db[k]
     self.assertFalse(k in db)
Exemplo n.º 3
0
 def testSearch(self):
     db = get_compmake_db()
     
     def search(pattern):
         r = wildcard_to_regexp(pattern)
         for k in db.keys():
             if r.match(k):
                 yield k
         
     self.assertEqual([], list(search('*')))
     db['key1'] = 1
     db['key2'] = 1
     self.assertEqual([], list(search('ciao*')))
     self.assertEqual(['key1'], list(search('key1')))
     self.assertEqual(['key1'], list(search('*1')))
     self.assertEqual([], list(search('d*1')))
Exemplo n.º 4
0
 def wrapper():
     root = mkdtemp()
     use_filesystem(root)
     CompmakeGlobalState.jobs_defined_in_this_session = set()
     # make sure everything was clean
     db = get_compmake_db()
     for key in db.keys():
         db.delete(key)
     try:
         f()
     except:
         s = 'Keys in DB:'
         for key in db.keys():
             s += ' %s\n' % key
         logger.error('DB state after test %s' % f)
         logger.error(s)
         raise
     finally:
         rmtree(root)
Exemplo n.º 5
0
 def testExists1(self):
     db = get_compmake_db()
     key = 'not-existent'
     assert(not key in db)