aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'portage_with_autodep/pym/portage/tests/locks/test_lock_nonblock.py')
-rw-r--r--portage_with_autodep/pym/portage/tests/locks/test_lock_nonblock.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/portage_with_autodep/pym/portage/tests/locks/test_lock_nonblock.py b/portage_with_autodep/pym/portage/tests/locks/test_lock_nonblock.py
deleted file mode 100644
index d5748ad..0000000
--- a/portage_with_autodep/pym/portage/tests/locks/test_lock_nonblock.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-import shutil
-import tempfile
-import traceback
-
-import portage
-from portage import os
-from portage.tests import TestCase
-
-class LockNonblockTestCase(TestCase):
-
- def testLockNonblock(self):
- tempdir = tempfile.mkdtemp()
- try:
- path = os.path.join(tempdir, 'lock_me')
- lock1 = portage.locks.lockfile(path)
- pid = os.fork()
- if pid == 0:
- portage.process._setup_pipes({0:0, 1:1, 2:2})
- rval = 2
- try:
- try:
- lock2 = portage.locks.lockfile(path, flags=os.O_NONBLOCK)
- except portage.exception.TryAgain:
- rval = os.EX_OK
- else:
- rval = 1
- portage.locks.unlockfile(lock2)
- except SystemExit:
- raise
- except:
- traceback.print_exc()
- finally:
- os._exit(rval)
-
- self.assertEqual(pid > 0, True)
- pid, status = os.waitpid(pid, 0)
- self.assertEqual(os.WIFEXITED(status), True)
- self.assertEqual(os.WEXITSTATUS(status), os.EX_OK)
-
- portage.locks.unlockfile(lock1)
- finally:
- shutil.rmtree(tempdir)
-