##// END OF EJS Templates
Fix cleanup of test controller
Thomas Kluyver -
Show More
@@ -95,7 +95,7 b' class IPTestController(object):'
95 95 subprocess.call(["coverage", "xml", "-o", self.coverage_xml])
96 96 return retcode
97 97
98 def cleanup(self):
98 def cleanup_process(self):
99 99 """Cleanup on exit by killing any leftover processes."""
100 100 subp = self.process
101 101 if subp is None or (subp.poll() is not None):
@@ -119,6 +119,9 b' class IPTestController(object):'
119 119 # The process did not die...
120 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 125 for td in self.dirs:
123 126 td.cleanup()
124 127
@@ -5,6 +5,8 b' This is copied from the stdlib and will be standard in Python 3.2 and onwards.'
5 5 from __future__ import print_function
6 6
7 7 import os as _os
8 import warnings as _warnings
9 import sys as _sys
8 10
9 11 # This code should only be used in Python versions < 3.2, since after that we
10 12 # can rely on the stdlib itself.
@@ -49,7 +51,7 b' except ImportError:'
49 51 self._closed = True
50 52 if _warn:
51 53 self._warn("Implicitly cleaning up {!r}".format(self),
52 ResourceWarning)
54 Warning)
53 55
54 56 def __exit__(self, exc, value, tb):
55 57 self.cleanup()
@@ -69,6 +71,7 b' except ImportError:'
69 71 _remove = staticmethod(_os.remove)
70 72 _rmdir = staticmethod(_os.rmdir)
71 73 _os_error = _os.error
74 _warn = _warnings.warn
72 75
73 76 def _rmtree(self, path):
74 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