Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: PMSTestSuite/library/
Date: Thu, 26 May 2011 07:25:20
Message-Id: 8a0fabc3d56d57f69f86643d2add3ce535e9bd0d.mgorny@gentoo
1 commit: 8a0fabc3d56d57f69f86643d2add3ce535e9bd0d
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 26 07:22:23 2011 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu May 26 07:22:23 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=8a0fabc3
7
8 Move class name -> PM code into separate function.
9
10 ---
11 PMSTestSuite/library/case.py | 14 ++++++++++----
12 1 files changed, 10 insertions(+), 4 deletions(-)
13
14 diff --git a/PMSTestSuite/library/case.py b/PMSTestSuite/library/case.py
15 index 2908342..02a3b9f 100644
16 --- a/PMSTestSuite/library/case.py
17 +++ b/PMSTestSuite/library/case.py
18 @@ -21,6 +21,15 @@ inherit pms-test
19
20 pn_re = re.compile('(.)([A-Z])')
21
22 +def cleanup_test_case_name(classname):
23 + """
24 + Create the ebuild PN from <classname>.
25 + """
26 +
27 + if classname.endswith('Test'):
28 + classname = classname[:-4]
29 + return pn_re.sub('\\1-\\2', classname).lower()
30 +
31 class TestCase(object):
32 """ Base class for a test case. """
33 pass
34 @@ -77,10 +86,7 @@ class EbuildTestCase(TestCase):
35
36 return ''.join(contents)
37
38 - pn = self.__class__.__name__
39 - if pn.endswith('Test'):
40 - pn = pn[:-4]
41 - pn = pn_re.sub('\\1-\\2', pn).lower()
42 + pn = cleanup_test_case_name(self.__class__.__name__)
43 fn = 'pms-test/%s/%s-%s.ebuild' % (pn, pn, self.eapi)
44
45 return {fn: EbuildTestCaseEbuildFile(self)}