From b5ef3cd3ef9261981f7f1dcadcdcf3f2a56d38f2 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 10 Jan 2013 23:22:03 -0800 Subject: [PATCH] DoebuildSpawnTestCase: also call spawn_nofetch --- .../tests/ebuild/test_doebuild_spawn.py | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/pym/portage/tests/ebuild/test_doebuild_spawn.py b/pym/portage/tests/ebuild/test_doebuild_spawn.py index 6c66f81ca..ae9a5c504 100644 --- a/pym/portage/tests/ebuild/test_doebuild_spawn.py +++ b/pym/portage/tests/ebuild/test_doebuild_spawn.py @@ -1,12 +1,15 @@ # Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import textwrap + from portage import os from portage import _python_interpreter from portage import _shell_quote from portage.const import EBUILD_SH_BINARY from portage.package.ebuild.config import config from portage.package.ebuild.doebuild import spawn as doebuild_spawn +from portage.package.ebuild._spawn_nofetch import spawn_nofetch from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ResolverPlayground from portage.util._async.SchedulerInterface import SchedulerInterface @@ -24,27 +27,37 @@ class DoebuildSpawnTestCase(TestCase): """ def testDoebuildSpawn(self): - playground = ResolverPlayground() - try: - settings = config(clone=playground.settings) - if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ: - settings["__PORTAGE_TEST_HARDLINK_LOCKS"] = \ - os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] - settings.backup_changes("__PORTAGE_TEST_HARDLINK_LOCKS") - cpv = 'sys-apps/portage-2.1' - metadata = { + ebuild_body = textwrap.dedent(""" + pkg_nofetch() { : ; } + """) + + ebuilds = { + 'sys-apps/portage-2.1': { 'EAPI' : '2', - 'INHERITED' : 'python eutils', 'IUSE' : 'build doc epydoc python3 selinux', 'KEYWORDS' : 'x86', 'LICENSE' : 'GPL-2', - 'PROVIDE' : 'virtual/portage', 'RDEPEND' : '>=app-shells/bash-3.2_p17 >=dev-lang/python-2.6', 'SLOT' : '0', - 'repository': 'gentoo', + "MISC_CONTENT": ebuild_body, } + } + + playground = ResolverPlayground(ebuilds=ebuilds) + try: root_config = playground.trees[playground.eroot]['root_config'] + portdb = root_config.trees["porttree"].dbapi + settings = config(clone=playground.settings) + if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ: + settings["__PORTAGE_TEST_HARDLINK_LOCKS"] = \ + os.environ["__PORTAGE_TEST_HARDLINK_LOCKS"] + settings.backup_changes("__PORTAGE_TEST_HARDLINK_LOCKS") + + cpv = 'sys-apps/portage-2.1' + metadata = dict(zip(Package.metadata_keys, + portdb.aux_get(cpv, Package.metadata_keys))) + pkg = Package(built=False, cpv=cpv, installed=False, metadata=metadata, root_config=root_config, type_name='ebuild') @@ -86,5 +99,7 @@ class DoebuildSpawnTestCase(TestCase): ebuild_phase.start() ebuild_phase.wait() self.assertEqual(ebuild_phase.returncode, os.EX_OK) + + spawn_nofetch(portdb, portdb.findname(cpv), settings=settings) finally: playground.cleanup() -- 2.26.2