OLD | NEW |
1 """ | 1 """ |
2 TestCommon.py: a testing framework for commands and scripts | 2 TestCommon.py: a testing framework for commands and scripts |
3 with commonly useful error handling | 3 with commonly useful error handling |
4 | 4 |
5 The TestCommon module provides a simple, high-level interface for writing | 5 The TestCommon module provides a simple, high-level interface for writing |
6 tests of executable commands and scripts, especially commands and scripts | 6 tests of executable commands and scripts, especially commands and scripts |
7 that interact with the file system. All methods throw exceptions and | 7 that interact with the file system. All methods throw exceptions and |
8 exit on failure, with useful error messages. This makes a number of | 8 exit on failure, with useful error messages. This makes a number of |
9 explicit checks unnecessary, making the test scripts themselves simpler | 9 explicit checks unnecessary, making the test scripts themselves simpler |
10 to write and easier to read. | 10 to write and easier to read. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return existing, missing | 190 return existing, missing |
191 | 191 |
192 def _failed(self, status = 0): | 192 def _failed(self, status = 0): |
193 if self.status is None or status is None: | 193 if self.status is None or status is None: |
194 return None | 194 return None |
195 try: | 195 try: |
196 return _status(self) not in status | 196 return _status(self) not in status |
197 except TypeError: | 197 except TypeError: |
198 # status wasn't an iterable | 198 # status wasn't an iterable |
199 return _status(self) != status | 199 return _status(self) != status |
| 200 |
200 def _status(self): | 201 def _status(self): |
201 return self.status | 202 return self.status |
202 | 203 |
203 class TestCommon(TestCmd): | 204 class TestCommon(TestCmd): |
204 | 205 |
205 # Additional methods from the Perl Test::Cmd::Common module | 206 # Additional methods from the Perl Test::Cmd::Common module |
206 # that we may wish to add in the future: | 207 # that we may wish to add in the future: |
207 # | 208 # |
208 # $test->subdir('subdir', ...); | 209 # $test->subdir('subdir', ...); |
209 # | 210 # |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 else: | 570 else: |
570 # We're under the development directory for this change, | 571 # We're under the development directory for this change, |
571 # so this is an Aegis invocation; pass the test (exit 0). | 572 # so this is an Aegis invocation; pass the test (exit 0). |
572 self.pass_test() | 573 self.pass_test() |
573 | 574 |
574 # Local Variables: | 575 # Local Variables: |
575 # tab-width:4 | 576 # tab-width:4 |
576 # indent-tabs-mode:nil | 577 # indent-tabs-mode:nil |
577 # End: | 578 # End: |
578 # vim: set expandtab tabstop=4 shiftwidth=4: | 579 # vim: set expandtab tabstop=4 shiftwidth=4: |
OLD | NEW |