Show More
@@ -95,7 +95,7 class IPTestController(object): | |||||
95 | subprocess.call(["coverage", "xml", "-o", self.coverage_xml]) |
|
95 | subprocess.call(["coverage", "xml", "-o", self.coverage_xml]) | |
96 | return retcode |
|
96 | return retcode | |
97 |
|
97 | |||
98 | def cleanup(self): |
|
98 | def cleanup_process(self): | |
99 | """Cleanup on exit by killing any leftover processes.""" |
|
99 | """Cleanup on exit by killing any leftover processes.""" | |
100 | subp = self.process |
|
100 | subp = self.process | |
101 | if subp is None or (subp.poll() is not None): |
|
101 | if subp is None or (subp.poll() is not None): | |
@@ -118,7 +118,10 class IPTestController(object): | |||||
118 | if subp.poll() is None: |
|
118 | if subp.poll() is None: | |
119 | # The process did not die... |
|
119 | # The process did not die... | |
120 | print('... failed. Manual cleanup may be required.') |
|
120 | print('... failed. Manual cleanup may be required.') | |
121 |
|
|
121 | ||
|
122 | def cleanup(self): | |||
|
123 | "Kill process if it's still alive, and clean up temporary directories" | |||
|
124 | self.cleanup_process() | |||
122 | for td in self.dirs: |
|
125 | for td in self.dirs: | |
123 | td.cleanup() |
|
126 | td.cleanup() | |
124 |
|
127 |
@@ -5,6 +5,8 This is copied from the stdlib and will be standard in Python 3.2 and onwards. | |||||
5 | from __future__ import print_function |
|
5 | from __future__ import print_function | |
6 |
|
6 | |||
7 | import os as _os |
|
7 | import os as _os | |
|
8 | import warnings as _warnings | |||
|
9 | import sys as _sys | |||
8 |
|
10 | |||
9 | # This code should only be used in Python versions < 3.2, since after that we |
|
11 | # This code should only be used in Python versions < 3.2, since after that we | |
10 | # can rely on the stdlib itself. |
|
12 | # can rely on the stdlib itself. | |
@@ -49,7 +51,7 except ImportError: | |||||
49 | self._closed = True |
|
51 | self._closed = True | |
50 | if _warn: |
|
52 | if _warn: | |
51 | self._warn("Implicitly cleaning up {!r}".format(self), |
|
53 | self._warn("Implicitly cleaning up {!r}".format(self), | |
52 |
|
|
54 | Warning) | |
53 |
|
55 | |||
54 | def __exit__(self, exc, value, tb): |
|
56 | def __exit__(self, exc, value, tb): | |
55 | self.cleanup() |
|
57 | self.cleanup() | |
@@ -69,6 +71,7 except ImportError: | |||||
69 | _remove = staticmethod(_os.remove) |
|
71 | _remove = staticmethod(_os.remove) | |
70 | _rmdir = staticmethod(_os.rmdir) |
|
72 | _rmdir = staticmethod(_os.rmdir) | |
71 | _os_error = _os.error |
|
73 | _os_error = _os.error | |
|
74 | _warn = _warnings.warn | |||
72 |
|
75 | |||
73 | def _rmtree(self, path): |
|
76 | def _rmtree(self, path): | |
74 | # Essentially a stripped down version of shutil.rmtree. We can't |
|
77 | # Essentially a stripped down version of shutil.rmtree. We can't |
General Comments 0
You need to be logged in to leave comments.
Login now