From: Zac Medico Date: Fri, 2 Sep 2011 01:43:31 +0000 (-0700) Subject: tests/emerge: enable arbitrary commands X-Git-Tag: v2.2.0_alpha52~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6feb5a12ed3b501ea5f65dad14d4026105469ad9;p=portage.git tests/emerge: enable arbitrary commands This will allow us to throw in some test commands for various helpers related to emerge (things like etc-update, dispatch-conf, quickpkg, portageq, ebuild, and emaint). --- diff --git a/pym/portage/tests/emerge/test_simple.py b/pym/portage/tests/emerge/test_simple.py index 99fc96cba..9c3769925 100644 --- a/pym/portage/tests/emerge/test_simple.py +++ b/pym/portage/tests/emerge/test_simple.py @@ -79,21 +79,25 @@ src_install() { }, } - test_args = ( - ("--version",), - ("--info",), - ("--info", "--verbose"), - ("--pretend", "dev-libs/A"), - ("--pretend", "--tree", "--complete-graph", "dev-libs/A"), - ("-p", "dev-libs/B"), - ("--oneshot", "dev-libs/B",), - ("--oneshot", "dev-libs/A",), - ("--noreplace", "dev-libs/A",), - ("--pretend", "--depclean", "--verbose", "dev-libs/B"), - ("--pretend", "--depclean",), - ("--depclean",), - ("--unmerge", "--quiet", "dev-libs/A"), - ("-C", "--quiet", "dev-libs/B"), + portage_python = portage._python_interpreter + emerge_cmd = (portage_python, "-Wd", + os.path.join(PORTAGE_BIN_PATH, "emerge")) + + test_commands = ( + emerge_cmd + ("--version",), + emerge_cmd + ("--info",), + emerge_cmd + ("--info", "--verbose"), + emerge_cmd + ("--pretend", "dev-libs/A"), + emerge_cmd + ("--pretend", "--tree", "--complete-graph", "dev-libs/A"), + emerge_cmd + ("-p", "dev-libs/B"), + emerge_cmd + ("--oneshot", "dev-libs/B",), + emerge_cmd + ("--oneshot", "dev-libs/A",), + emerge_cmd + ("--noreplace", "dev-libs/A",), + emerge_cmd + ("--pretend", "--depclean", "--verbose", "dev-libs/B"), + emerge_cmd + ("--pretend", "--depclean",), + emerge_cmd + ("--depclean",), + emerge_cmd + ("--unmerge", "--quiet", "dev-libs/A"), + emerge_cmd + ("-C", "--quiet", "dev-libs/B"), ) playground = ResolverPlayground(ebuilds=ebuilds, installed=installed) @@ -137,6 +141,7 @@ src_install() { "PORTAGE_GRPNAME" : os.environ["PORTAGE_GRPNAME"], "PORTAGE_INST_GID" : str(portage.data.portage_gid), "PORTAGE_INST_UID" : str(portage.data.portage_uid), + "PORTAGE_PYTHON" : portage_python, "PORTAGE_TMPDIR" : portage_tmpdir, "PORTAGE_USERNAME" : os.environ["PORTAGE_USERNAME"], "PORTDIR" : portdir, @@ -158,9 +163,8 @@ src_install() { # non-empty system set keeps --depclean quiet with open(os.path.join(profile_path, "packages"), 'w') as f: f.write("*dev-libs/token-system-pkg") - for args in test_args: - proc = subprocess.Popen([portage._python_interpreter, "-Wd", - os.path.join(PORTAGE_BIN_PATH, "emerge")] + list(args), + for args in test_commands: + proc = subprocess.Popen(args, env=env, stdout=subprocess.PIPE) output = proc.stdout.readlines() proc.wait()