Пример #1
0
 def test_acquire_lock_fails_without_workspace(self):
     with temp_dir() as directory:
         runner = Runner(directory, None)
     # Call runner.acquire_lock at this level, at which point directory
     # will have already been cleaned up.
     with self.assertRaises(SystemExit):
         runner.acquire_lock()
Пример #2
0
 def test_acquire_lock_fails_when_existing_lockfile(self):
     with temp_dir() as directory:
         expected_file = os.path.join(directory, 'chaos_runner.lock')
         open(expected_file, 'a').close()
         runner = Runner(directory, None)
         with self.assertRaises(SystemExit):
             runner.acquire_lock()
Пример #3
0
 def test_acquire_lock(self):
     with temp_dir() as directory:
         expected_file = os.path.join(directory, 'chaos_runner.lock')
         expected_pid = str(os.getpid())
         runner = Runner(directory, None)
         runner.acquire_lock()
         self.assertTrue(os.path.exists(expected_file))
         with open(expected_file, 'r') as lock_file:
             pid = lock_file.read()
         self.assertEqual(pid, expected_pid)