public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: basic/
Date: Tue, 31 May 2011 18:10:13 +0000 (UTC)	[thread overview]
Message-ID: <c5b0f3d8c096765695be2a01208175d88a183da6.mgorny@gentoo> (raw)

commit:     c5b0f3d8c096765695be2a01208175d88a183da6
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed May 25 20:35:07 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 31 18:01:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=c5b0f3d8

Adjust the phase function order test to the new API.

---
 basic/phase-function-order.py |   75 -----------------------------------------
 basic/phase_function_order.py |   47 +++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 75 deletions(-)

diff --git a/basic/phase-function-order.py b/basic/phase-function-order.py
deleted file mode 100644
index 01e71c9..0000000
--- a/basic/phase-function-order.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# Example Python implementation
-
-# XXX: will be implemented in core suite and imported here
-class EbuildTest(object):
-	phase_funcs = dict([(func, []) for func in (
-		'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare',
-		'src_configure', 'src_compile', 'src_install',
-		'pkg_preinst', 'pkg_postinst'
-		)])
-
-class PhaseFunctionOrderTest(EbuildTest):
-	relevant_eapis = (0, 2, 4)
-
-	ebuild_vars = {
-		'DESCRIPTION': 'Phase function execution order test'
-	}
-
-	def __init__(self):
-		for func in self.phase_funcs.keys():
-			self.phase_funcs[func].append("pms-test_append_result %s" % func)
-
-	def check_output(self, output):
-		if self.EAPI < 2:
-			expect = """pkg_setup
-src_unpack
-src_compile
-src_install
-pkg_preinst
-pkg_postinst"""
-		elif self.EAPI < 4:
-			expect = """pkg_setup
-src_unpack
-src_prepare
-src_compile
-src_configure
-src_install
-pkg_preinst
-pkg_postinst"""
-		else:
-			expect = """pkg_pretend
-pkg_setup
-src_unpack
-src_prepare
-src_compile
-src_configure
-src_install
-pkg_preinst
-pkg_postinst"""
-
-		return (output == expect)
-
-# (test code)
-test = PhaseFunctionOrderTest()
-
-test.EAPI=1
-real_output="""pkg_setup
-src_unpack
-src_compile
-src_install
-pkg_preinst
-pkg_postinst"""
-print(test.check_output(real_output)) # expect True
-
-test.EAPI=2
-print(test.check_output(real_output)) # expect False
-
-real_output="""pkg_setup
-src_unpack
-src_prepare
-src_compile
-src_configure
-src_install
-pkg_preinst
-pkg_postinst"""
-print(test.check_output(real_output)) # expect True

diff --git a/basic/phase_function_order.py b/basic/phase_function_order.py
new file mode 100644
index 0000000..7a9cc13
--- /dev/null
+++ b/basic/phase_function_order.py
@@ -0,0 +1,47 @@
+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+from PMSTestSuite.library.case import EbuildTestCase
+
+class PhaseFunctionOrderTest(EbuildTestCase):
+	relevant_eapis = (0, 2, 4)
+
+	ebuild_vars = {
+		'DESCRIPTION': 'Phase function execution order test'
+	}
+
+	def __init__(self, *args, **kwargs):
+		for func in self.phase_funcs:
+			self.phase_funcs[func].append("pms-test_append_result %s" % func)
+		EbuildTestCase.__init__(self, *args, **kwargs)
+
+	def check_output(self, output):
+		if self.eapi < 2:
+			expect = """pkg_setup
+src_unpack
+src_compile
+src_install
+pkg_preinst
+pkg_postinst"""
+		elif self.eapi < 4:
+			expect = """pkg_setup
+src_unpack
+src_prepare
+src_compile
+src_configure
+src_install
+pkg_preinst
+pkg_postinst"""
+		else:
+			expect = """pkg_pretend
+pkg_setup
+src_unpack
+src_prepare
+src_compile
+src_configure
+src_install
+pkg_preinst
+pkg_postinst"""
+
+		return (output == expect)



             reply	other threads:[~2011-05-31 18:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31 18:10 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-05-31 18:10 [gentoo-commits] proj/pms-test-suite:master commit in: basic/ Michał Górny
2011-05-31 18:10 Michał Górny
2011-05-31 18:10 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5b0f3d8c096765695be2a01208175d88a183da6.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox