summaryrefslogtreecommitdiff
path: root/tests/lock.py
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-17 19:40:47 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-17 19:40:47 +0200
commitcbd822c9dfe8cf18d828bd558290f15775b4d837 (patch)
treeb9ee1d702dd85a5dc2cbd9303e7f31ca6b8ffa52 /tests/lock.py
parent9bd7c1dcf9942d6ce294aa5ac58d90d6c1aa9f51 (diff)
downloadpython-apt-cbd822c9dfe8cf18d828bd558290f15775b4d837.tar.gz
tests: First work on the new testsuite.
The module tests.test_all will run all available tests. Each test placed herein must be using unittest and provide at least 1 test case. It must be prefixed with test_.
Diffstat (limited to 'tests/lock.py')
-rw-r--r--tests/lock.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/tests/lock.py b/tests/lock.py
deleted file mode 100644
index d45b3964..00000000
--- a/tests/lock.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python2.4
-#
-# Test for the pkgCache code
-#
-
-import apt_pkg
-import sys
-import os
-
-
-if __name__ == "__main__":
- lock = "/tmp/test.lck"
-
- apt_pkg.init()
-
- # system-lock
- apt_pkg.PkgSystemLock()
-
- pid = os.fork()
- if pid == 0:
- try:
- apt_pkg.PkgSystemLock()
- except SystemError, s:
- print "Can't get lock: (error text:\n%s)" % s
- sys.exit(0)
-
- apt_pkg.PkgSystemUnLock()
-
- # low-level lock
- fd = apt_pkg.GetLock(lock, True)
- print "Lockfile fd: %s" % fd
-
- # try to get lock without error flag
- pid = os.fork()
- if pid == 0:
- # child
- fd = apt_pkg.GetLock(lock, False)
- print "Lockfile fd (child): %s" % fd
- sys.exit(0)
-
- # try to get lock with error flag
- pid = os.fork()
- if pid == 0:
- # child
- fd = apt_pkg.GetLock(lock, True)
- print "Lockfile fd (child): %s" % fd
- sys.exit(0)