aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'portage_with_autodep/pym/portage/tests/bin')
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/__init__.py0
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/__test__0
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/setup_env.py85
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/test_dobin.py16
-rw-r--r--portage_with_autodep/pym/portage/tests/bin/test_dodir.py16
5 files changed, 0 insertions, 117 deletions
diff --git a/portage_with_autodep/pym/portage/tests/bin/__init__.py b/portage_with_autodep/pym/portage/tests/bin/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/portage_with_autodep/pym/portage/tests/bin/__init__.py
+++ /dev/null
diff --git a/portage_with_autodep/pym/portage/tests/bin/__test__ b/portage_with_autodep/pym/portage/tests/bin/__test__
deleted file mode 100644
index e69de29..0000000
--- a/portage_with_autodep/pym/portage/tests/bin/__test__
+++ /dev/null
diff --git a/portage_with_autodep/pym/portage/tests/bin/setup_env.py b/portage_with_autodep/pym/portage/tests/bin/setup_env.py
deleted file mode 100644
index e07643d..0000000
--- a/portage_with_autodep/pym/portage/tests/bin/setup_env.py
+++ /dev/null
@@ -1,85 +0,0 @@
-# setup_env.py -- Make sure bin subdir has sane env for testing
-# Copyright 2007-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-import tempfile
-
-from portage import os
-from portage import shutil
-from portage.tests import TestCase
-from portage.process import spawn
-
-basepath = os.path.join(os.path.dirname(os.path.dirname(
- os.path.abspath(__file__))),
- "..", "..", "..")
-bindir = os.path.join(basepath, "bin")
-pymdir = os.path.join(basepath, "pym")
-basedir = None
-env = None
-
-def binTestsCleanup():
- global basedir
- if basedir is None:
- return
- if os.access(basedir, os.W_OK):
- shutil.rmtree(basedir)
- basedir = None
-
-def binTestsInit():
- binTestsCleanup()
- global basedir, env
- basedir = tempfile.mkdtemp()
- env = os.environ.copy()
- env["D"] = os.path.join(basedir, "image")
- env["T"] = os.path.join(basedir, "temp")
- env["S"] = os.path.join(basedir, "workdir")
- env["PF"] = "portage-tests-0.09-r1"
- env["PATH"] = bindir + ":" + env["PATH"]
- env["PORTAGE_BIN_PATH"] = bindir
- env["PORTAGE_PYM_PATH"] = pymdir
- os.mkdir(env["D"])
- os.mkdir(env["T"])
- os.mkdir(env["S"])
-
-class BinTestCase(TestCase):
- def init(self):
- binTestsInit()
- def cleanup(self):
- binTestsCleanup()
-
-def _exists_in_D(path):
- # Note: do not use os.path.join() here, we assume D to end in /
- return os.access(env["D"] + path, os.W_OK)
-def exists_in_D(path):
- if not _exists_in_D(path):
- raise TestCase.failureException
-def xexists_in_D(path):
- if _exists_in_D(path):
- raise TestCase.failureException
-
-def portage_func(func, args, exit_status=0):
- # we don't care about the output of the programs,
- # just their exit value and the state of $D
- global env
- f = open('/dev/null', 'wb')
- fd_pipes = {0:0,1:f.fileno(),2:f.fileno()}
- def pre_exec():
- os.chdir(env["S"])
- spawn([func] + args.split(), env=env,
- fd_pipes=fd_pipes, pre_exec=pre_exec)
- f.close()
-
-def create_portage_wrapper(bin):
- def derived_func(*args):
- newargs = list(args)
- newargs.insert(0, bin)
- return portage_func(*newargs)
- return derived_func
-
-for bin in os.listdir(os.path.join(bindir, "ebuild-helpers")):
- if bin.startswith("do") or \
- bin.startswith("new") or \
- bin.startswith("prep") or \
- bin in ["ecompress","ecompressdir","fowners","fperms"]:
- globals()[bin] = create_portage_wrapper(
- os.path.join(bindir, "ebuild-helpers", bin))
diff --git a/portage_with_autodep/pym/portage/tests/bin/test_dobin.py b/portage_with_autodep/pym/portage/tests/bin/test_dobin.py
deleted file mode 100644
index 6f50d7a..0000000
--- a/portage_with_autodep/pym/portage/tests/bin/test_dobin.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# test_dobin.py -- Portage Unit Testing Functionality
-# Copyright 2007-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from portage.tests.bin.setup_env import BinTestCase, dobin, xexists_in_D
-
-class DoBin(BinTestCase):
- def testDoBin(self):
- self.init()
- try:
- dobin("does-not-exist", 1)
- xexists_in_D("does-not-exist")
- xexists_in_D("/bin/does-not-exist")
- xexists_in_D("/usr/bin/does-not-exist")
- finally:
- self.cleanup()
diff --git a/portage_with_autodep/pym/portage/tests/bin/test_dodir.py b/portage_with_autodep/pym/portage/tests/bin/test_dodir.py
deleted file mode 100644
index f4eb9b2..0000000
--- a/portage_with_autodep/pym/portage/tests/bin/test_dodir.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# test_dodir.py -- Portage Unit Testing Functionality
-# Copyright 2007-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-from portage.tests.bin.setup_env import BinTestCase, dodir, exists_in_D
-
-class DoDir(BinTestCase):
- def testDoDir(self):
- self.init()
- try:
- dodir("usr /usr")
- exists_in_D("/usr")
- dodir("/var/lib/moocow")
- exists_in_D("/var/lib/moocow")
- finally:
- self.cleanup()