Exemple #1
0
 def test_exclusive_file_same_process(self):
     fname = 'testsp'
     with ExclusiveFile(fname):
         ef = FastFailEF(fname)
         self.assertRaises(EnvironmentError, ef.__enter__)
         t = Other()
         t.start(), t.join()
         self.assertIs(t.locked, False)
     if not iswindows:
         with unix_open(fname) as f:
             self.assertEqual(
                 1,
                 fcntl.fcntl(f.fileno(), fcntl.F_GETFD) & fcntl.FD_CLOEXEC)
Exemple #2
0
 def test_exclusive_file_same_process(self):
     fname = 'testsp'
     with ExclusiveFile(fname):
         ef = FastFailEF(fname)
         self.assertRaises(EnvironmentError, ef.__enter__)
         t = Other()
         t.start(), t.join()
         self.assertIs(t.locked, False)
     if not iswindows:
         with unix_open(fname) as f:
             self.assertEqual(
                 1, fcntl.fcntl(f.fileno(), fcntl.F_GETFD) & fcntl.FD_CLOEXEC
             )