Пример #1
0
 def test_run_with_lock_wrong_time(self):
     utils.run_with_lock(
         test_rwl, remove=False, lifetime=20,
         lockfile=os.path.join(gettempdir(),
                               'hyperkitty-jobs-update-index.lock'))
     self.assertIn('ValueError',
                   open(os.path.join(self.tmpdir, 'error.log')).read())
Пример #2
0
 def test_run_with_lock_extended(self):
     utils.run_with_lock(
         test_rwl, remove=True, lifetime=900,
         lockfile=os.path.join(gettempdir(),
                               'hyperkitty-jobs-update-index.lock'))
     self.assertEqual('',
                      open(os.path.join(self.tmpdir, 'error.log')).read())
Пример #3
0
 def test_run_with_lock_extended_setting(self):
     self._override_setting('HYPERKITTY_JOBS_UPDATE_INDEX_LOCK_LIFE', 300)
     utils.run_with_lock(
         test_rwl, remove=True, lifetime=300,
         lockfile=os.path.join(gettempdir(),
                               'hyperkitty-jobs-update-index.lock'))
     self.assertEqual('',
                      open(os.path.join(self.tmpdir, 'error.log')).read())
Пример #4
0
 def test_run_with_lock_alternate_file(self):
     self._override_setting(
         'HYPERKITTY_JOBS_UPDATE_INDEX_LOCKFILE',
         os.path.join(gettempdir(), 'alt.lock'))
     utils.run_with_lock(
         test_rwl, remove=False, lifetime=15,
         lockfile=os.path.join(gettempdir(), 'alt.lock'))
     self.assertEqual('',
                      open(os.path.join(self.tmpdir, 'error.log')).read())
 def execute(self):
     run_with_lock(update_index, remove=True)
Пример #6
0
 def test_run_with_lock_bad_file(self):
     utils.run_with_lock(test_rwl, remove=False,
                         lifetime=15, lockfile='/bogus/file/name')
     self.assertIn('/bogus/file/name',
                   open(os.path.join(self.tmpdir, 'error.log')).read())