1 |
commit: b934ffc0fa5becd176974fb19cfa7f476a4fd616 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 26 06:35:18 2011 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 26 06:35:18 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=b934ffc0 |
7 |
|
8 |
Cleanup test names. |
9 |
|
10 |
--- |
11 |
PMSTestSuite/library/__init__.py | 4 ++-- |
12 |
PMSTestSuite/library/case.py | 9 ++++++++- |
13 |
PMSTestSuite/library/test/__init__.py | 2 +- |
14 |
PMSTestSuite/library/test/random_test.py | 2 +- |
15 |
4 files changed, 12 insertions(+), 5 deletions(-) |
16 |
|
17 |
diff --git a/PMSTestSuite/library/__init__.py b/PMSTestSuite/library/__init__.py |
18 |
index af7765f..52aa8d2 100644 |
19 |
--- a/PMSTestSuite/library/__init__.py |
20 |
+++ b/PMSTestSuite/library/__init__.py |
21 |
@@ -8,10 +8,10 @@ |
22 |
<PMSTestSuite.library.test.ExampleLibrary object at ...> |
23 |
>>> t = [x for x in l][0] |
24 |
>>> t # doctest: +ELLIPSIS |
25 |
-<PMSTestSuite.library.test.random_test.ExampleCase object at ...> |
26 |
+<PMSTestSuite.library.test.random_test.RandomExampleTest object at ...> |
27 |
>>> files = t.get_output_files() |
28 |
>>> files # doctest: +ELLIPSIS |
29 |
-{'pms-test/examplecase/examplecase-0.ebuild': ...} |
30 |
+{'pms-test/random-example/random-example-0.ebuild': ...} |
31 |
>>> f = files.values()[0] |
32 |
>>> str(f) # doctest: +ELLIPSIS |
33 |
'# Copyright 1999...inherit pms-test...pms-test_pkg_setup...die...' |
34 |
|
35 |
diff --git a/PMSTestSuite/library/case.py b/PMSTestSuite/library/case.py |
36 |
index 084edd8..2908342 100644 |
37 |
--- a/PMSTestSuite/library/case.py |
38 |
+++ b/PMSTestSuite/library/case.py |
39 |
@@ -2,6 +2,8 @@ |
40 |
# (c) 2011 Michał Górny <mgorny@g.o> |
41 |
# Released under the terms of the 2-clause BSD license. |
42 |
|
43 |
+import re |
44 |
+ |
45 |
# XXX: move to some consts module? |
46 |
phase_func_names = [ |
47 |
'pkg_pretend', 'pkg_setup', 'src_unpack', 'src_prepare', |
48 |
@@ -17,6 +19,8 @@ inherit pms-test |
49 |
|
50 |
''' |
51 |
|
52 |
+pn_re = re.compile('(.)([A-Z])') |
53 |
+ |
54 |
class TestCase(object): |
55 |
""" Base class for a test case. """ |
56 |
pass |
57 |
@@ -73,7 +77,10 @@ class EbuildTestCase(TestCase): |
58 |
|
59 |
return ''.join(contents) |
60 |
|
61 |
- pn = self.__class__.__name__.lower() |
62 |
+ pn = self.__class__.__name__ |
63 |
+ if pn.endswith('Test'): |
64 |
+ pn = pn[:-4] |
65 |
+ pn = pn_re.sub('\\1-\\2', pn).lower() |
66 |
fn = 'pms-test/%s/%s-%s.ebuild' % (pn, pn, self.eapi) |
67 |
|
68 |
return {fn: EbuildTestCaseEbuildFile(self)} |
69 |
|
70 |
diff --git a/PMSTestSuite/library/test/__init__.py b/PMSTestSuite/library/test/__init__.py |
71 |
index ea9940a..4ef8e30 100644 |
72 |
--- a/PMSTestSuite/library/test/__init__.py |
73 |
+++ b/PMSTestSuite/library/test/__init__.py |
74 |
@@ -10,5 +10,5 @@ class ExampleLibrary(TestLibrary): |
75 |
""" |
76 |
|
77 |
test_names=[ |
78 |
- 'random_test.ExampleCase' |
79 |
+ 'random_test.RandomExampleTest' |
80 |
] |
81 |
|
82 |
diff --git a/PMSTestSuite/library/test/random_test.py b/PMSTestSuite/library/test/random_test.py |
83 |
index 23be2a0..d60c32d 100644 |
84 |
--- a/PMSTestSuite/library/test/random_test.py |
85 |
+++ b/PMSTestSuite/library/test/random_test.py |
86 |
@@ -4,7 +4,7 @@ |
87 |
|
88 |
from PMSTestSuite.library.case import EbuildTestCase |
89 |
|
90 |
-class ExampleCase(EbuildTestCase): |
91 |
+class RandomExampleTest(EbuildTestCase): |
92 |
""" |
93 |
Absolutely random TestCase subclass to test it. |
94 |
""" |