commit: 44aeab7fad440a289316ced8738b287d88d475d0 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sun Jan 17 02:52:02 2016 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sun Jan 17 02:54:27 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=44aeab7f
DoebuildFdPipesTestCase: use extra pipe for test output Since commit 3767128cf08a0a21559eb9c41ba393dcabc6f087, this test has failed due to additional output produced by src_install. Fix it to use a separate pipe for test output. pym/portage/tests/ebuild/test_doebuild_fd_pipes.py | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pym/portage/tests/ebuild/test_doebuild_fd_pipes.py b/pym/portage/tests/ebuild/test_doebuild_fd_pipes.py index 2a65537..b894218 100644 --- a/pym/portage/tests/ebuild/test_doebuild_fd_pipes.py +++ b/pym/portage/tests/ebuild/test_doebuild_fd_pipes.py @@ -1,8 +1,6 @@ -# Copyright 2013-2015 Gentoo Foundation +# Copyright 2013-2016 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -import textwrap - import portage from portage import os from portage.tests import TestCase @@ -10,7 +8,6 @@ from portage.tests.resolver.ResolverPlayground import ResolverPlayground from portage.package.ebuild._ipc.QueryCommand import QueryCommand from portage.util._async.ForkProcess import ForkProcess from portage.util._async.TaskScheduler import TaskScheduler -from portage.util._eventloop.global_event_loop import global_event_loop from _emerge.Package import Package from _emerge.PipeReader import PipeReader @@ -31,19 +28,16 @@ class DoebuildFdPipesTestCase(TestCase): supported for API consumers (see bug #475812). """ - ebuild_body = textwrap.dedent(""" - S=${WORKDIR} - pkg_info() { echo info ; } - pkg_nofetch() { echo nofetch ; } - pkg_pretend() { echo pretend ; } - pkg_setup() { echo setup ; } - src_unpack() { echo unpack ; } - src_prepare() { echo prepare ; } - src_configure() { echo configure ; } - src_compile() { echo compile ; } - src_test() { echo test ; } - src_install() { echo install ; } - """) + output_fd = 200 + ebuild_body = ['S=${WORKDIR}'] + for phase_func in ('pkg_info', 'pkg_nofetch', 'pkg_pretend', + 'pkg_setup', 'src_unpack', 'src_prepare', 'src_configure', + 'src_compile', 'src_test', 'src_install'): + ebuild_body.append(('%s() { echo ${EBUILD_PHASE}' + ' 1>&%s; }') % (phase_func, output_fd)) + + ebuild_body.append('') + ebuild_body = '\n'.join(ebuild_body) ebuilds = { 'app-misct/foo-1': { @@ -60,6 +54,7 @@ class DoebuildFdPipesTestCase(TestCase): self.assertEqual(true_binary is None, False, "true command not found") + dev_null = open(os.devnull, 'wb') playground = ResolverPlayground(ebuilds=ebuilds) try: QueryCommand._db = playground.trees @@ -106,7 +101,11 @@ class DoebuildFdPipesTestCase(TestCase): doebuild_kwargs={"settings" : settings, "mydbapi": portdb, "tree": "porttree", "vartree": root_config.trees["vartree"], - "fd_pipes": {1: pw, 2: pw}, + "fd_pipes": { + 1: dev_null.fileno(), + 2: dev_null.fileno(), + output_fd: pw, + }, "prev_mtimes": {}}) consumer = PipeReader( @@ -134,5 +133,6 @@ class DoebuildFdPipesTestCase(TestCase): self.assertEqual(phase, output) finally: + dev_null.close() playground.cleanup() QueryCommand._db = None