OLD | NEW |
1 """ | 1 """ |
2 TestCmd.py: a testing framework for commands and scripts. | 2 TestCmd.py: a testing framework for commands and scripts. |
3 | 3 |
4 The TestCmd module provides a framework for portable automated testing | 4 The TestCmd module provides a framework for portable automated testing |
5 of executable commands and scripts (in any language, not just Python), | 5 of executable commands and scripts (in any language, not just Python), |
6 especially commands and scripts that require file system interaction. | 6 especially commands and scripts that require file system interaction. |
7 | 7 |
8 In addition to running tests and evaluating conditions, the TestCmd | 8 In addition to running tests and evaluating conditions, the TestCmd |
9 module manages and cleans up one or more temporary workspace | 9 module manages and cleans up one or more temporary workspace |
10 directories, and provides methods for creating files and directories in | 10 directories, and provides methods for creating files and directories in |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 PRESERVE_PASS, PRESERVE_FAIL, or PRESERVE_NO_RESULT were set | 963 PRESERVE_PASS, PRESERVE_FAIL, or PRESERVE_NO_RESULT were set |
964 when the TestCmd environment was created, then temporary working | 964 when the TestCmd environment was created, then temporary working |
965 directories are not removed if the test passed, failed, or had | 965 directories are not removed if the test passed, failed, or had |
966 no result, respectively. Temporary working directories are also | 966 no result, respectively. Temporary working directories are also |
967 preserved for conditions specified via the preserve method. | 967 preserved for conditions specified via the preserve method. |
968 | 968 |
969 Typically, this method is not called directly, but is used when | 969 Typically, this method is not called directly, but is used when |
970 the script exits to clean up temporary working directories as | 970 the script exits to clean up temporary working directories as |
971 appropriate for the exit status. | 971 appropriate for the exit status. |
972 """ | 972 """ |
| 973 print self.workdir |
| 974 return |
973 if not self._dirlist: | 975 if not self._dirlist: |
974 return | 976 return |
975 os.chdir(self._cwd) | 977 os.chdir(self._cwd) |
976 self.workdir = None | 978 self.workdir = None |
977 if condition is None: | 979 if condition is None: |
978 condition = self.condition | 980 condition = self.condition |
979 if self._preserve[condition]: | 981 if self._preserve[condition]: |
980 for dir in self._dirlist: | 982 for dir in self._dirlist: |
981 print "Preserved directory", dir | 983 print "Preserved directory", dir |
982 else: | 984 else: |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 if mode[0] != 'w': | 1587 if mode[0] != 'w': |
1586 raise ValueError, "mode must begin with 'w'" | 1588 raise ValueError, "mode must begin with 'w'" |
1587 with open(file, mode) as f: | 1589 with open(file, mode) as f: |
1588 f.write(content) | 1590 f.write(content) |
1589 | 1591 |
1590 # Local Variables: | 1592 # Local Variables: |
1591 # tab-width:4 | 1593 # tab-width:4 |
1592 # indent-tabs-mode:nil | 1594 # indent-tabs-mode:nil |
1593 # End: | 1595 # End: |
1594 # vim: set expandtab tabstop=4 shiftwidth=4: | 1596 # vim: set expandtab tabstop=4 shiftwidth=4: |
OLD | NEW |