From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/
Date: Tue, 24 May 2011 08:11:58 +0000 (UTC) [thread overview]
Message-ID: <f3554b599e4f59f2c31da7057b081689a02740d4.mgorny@gentoo> (raw)
commit: f3554b599e4f59f2c31da7057b081689a02740d4
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 24 07:49:23 2011 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 24 07:49:23 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=f3554b59
Use a class to lazily generate ebuild contents.
---
PMSTestSuite/library/__init__.py | 4 +++-
PMSTestSuite/library/case.py | 34 +++++++++++++++++++++-------------
2 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/PMSTestSuite/library/__init__.py b/PMSTestSuite/library/__init__.py
index ba6867a..b127108 100644
--- a/PMSTestSuite/library/__init__.py
+++ b/PMSTestSuite/library/__init__.py
@@ -9,8 +9,10 @@
>>> t = [x for x in l][0]
>>> t # doctest: +ELLIPSIS
<PMSTestSuite.library.test.random_test.ExampleCase object at ...>
->>> t.get_output_files() # doctest: +ELLIPSIS
+>>> files = t.get_output_files()
+>>> files # doctest: +ELLIPSIS
{'pms-test/examplecase/examplecase-0.ebuild': ...}
+>>> f = files.values()[0]
"""
from PMSTestSuite.library.case import TestCase
diff --git a/PMSTestSuite/library/case.py b/PMSTestSuite/library/case.py
index f2115e2..f6ae90b 100644
--- a/PMSTestSuite/library/case.py
+++ b/PMSTestSuite/library/case.py
@@ -27,19 +27,27 @@ class EbuildTestCase(TestCase):
self.eapi = eapi
def get_output_files(self):
- pn = self.__class__.__name__.lower()
- fn = 'pms-test/%s/%s-%s.ebuild' % (pn, pn, self.eapi)
- contents = [ebuild_header]
+ class EbuildTestCaseEbuildFile(object):
+ def __init__(self, parent):
+ self._parent = parent
+
+ def __str__(self):
+ contents = [ebuild_header]
+
+ for k, v in self._parent.ebuild_vars.items():
+ contents.append('%s="%s"\n' % (k, v)) # XXX: escaping
- for k, v in self.ebuild_vars.items():
- contents.append('%s="%s"\n' % (k, v)) # XXX: escaping
+ for f, lines in self._parent.phase_funcs.items():
+ if f == 'pkg_setup':
+ lines.insert(0, 'pms-test_pkg_setup')
+ contents.append('\n%s() {\n' % f)
+ for l in lines:
+ contents.append('\t%s\n' % l) # XXX: smarter tabs
+ contents.append('}\n')
- for f, lines in self.phase_funcs.items():
- if f == 'pkg_setup':
- lines.insert(0, 'pms-test_pkg_setup')
- contents.append('\n%s() {\n' % f)
- for l in lines:
- contents.append('\t%s\n' % l) # XXX: smarter tabs
- contents.append('}\n')
+ return ''.join(contents)
+
+ pn = self.__class__.__name__.lower()
+ fn = 'pms-test/%s/%s-%s.ebuild' % (pn, pn, self.eapi)
- return {fn: ''.join(contents)}
+ return {fn: EbuildTestCaseEbuildFile(self)}
next reply other threads:[~2011-05-24 8:12 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-24 8:11 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-01-03 15:52 [gentoo-commits] proj/pms-test-suite:master commit in: pmstestsuite/library/ Michał Górny
2012-01-02 22:26 Michał Górny
2011-08-12 20:55 Michał Górny
2011-08-11 22:09 Michał Górny
2011-08-11 22:09 Michał Górny
2011-08-11 8:54 Michał Górny
2011-08-11 8:53 Michał Górny
2011-08-06 14:26 Michał Górny
2011-08-06 14:25 Michał Górny
2011-08-06 14:25 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 20:17 Michał Górny
2011-08-03 8:17 Michał Górny
2011-08-02 18:53 Michał Górny
2011-08-02 18:53 Michał Górny
2011-08-02 18:53 Michał Górny
2011-08-02 18:53 Michał Górny
2011-07-24 14:37 Michał Górny
2011-06-29 17:52 Michał Górny
2011-06-29 17:52 Michał Górny
2011-06-29 17:52 Michał Górny
2011-06-29 17:52 Michał Górny
2011-06-29 17:52 Michał Górny
2011-06-29 17:52 Michał Górny
2011-06-23 21:14 [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/ Michał Górny
2011-06-23 21:14 Michał Górny
2011-06-20 19:20 Michał Górny
2011-06-17 15:07 Michał Górny
2011-06-17 5:59 Michał Górny
2011-06-16 19:49 Michał Górny
2011-06-16 19:49 Michał Górny
2011-06-14 12:35 Michał Górny
2011-06-14 8:32 Michał Górny
2011-06-14 8:32 Michał Górny
2011-06-13 19:16 Michał Górny
2011-06-13 19:16 Michał Górny
2011-06-07 17:22 Michał Górny
2011-06-03 17:36 Michał Górny
2011-05-31 17:19 Michał Górny
2011-05-29 18:57 Michał Górny
2011-05-29 18:57 Michał Górny
2011-05-29 18:57 Michał Górny
2011-05-29 18:17 Michał Górny
2011-05-26 7:25 Michał Górny
2011-05-26 6:35 Michał Górny
2011-05-25 20:40 Michał Górny
2011-05-24 14:28 Michał Górny
2011-05-24 8:11 Michał Górny
2011-05-24 8:11 Michał Górny
2011-05-23 11:52 Michał Górny
2011-05-23 9:51 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=f3554b599e4f59f2c31da7057b081689a02740d4.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