> Note that the browser test case does the required cleanup
> and shuts down the test server in its tearDown() method,
> so I don't think the issue is there.
it might not always get called.
in the autopilot tests of webbrowser-app, both 'BrowserTestCaseBase' and 'BrowserTestCaseBaseWithHTTPServer' use tearDown() funtions. It would be more robust to add these as cleanups rather than teardowns.
tearDown is only called if the setUp() succeeds, whereas a cleanup is called unconditionally. (cleanups were new in Python 2.7's unittest, and also exist in testtools.TestCase)
so if a setUp() fails somewhere after the server is started, the tearDown will not be called, leaving a hanging server process around.
for example, in 'BrowserTestCaseBaseWithHTTPServer' class, you could rename tearDown() to cleanup() (or whatever), and inside the setUp, add:
`self.addCleanup(cleanup)`
this would make it more robust and possibly alleviate this issue.
p.s. if this wasn't explained clearly, I can MP a fix to webbrowser-app changing from tearDowns to addCleanups.
the TestCase class I'm referring to reside in /tests/autopilot/webbrowser_app/tests/__init__.py of webbrowser-app.
> Note that the browser test case does the required cleanup
> and shuts down the test server in its tearDown() method,
> so I don't think the issue is there.
it might not always get called.
in the autopilot tests of webbrowser-app, both 'BrowserTestCas eBase' and 'BrowserTestCas eBaseWithHTTPSe rver' use tearDown() funtions. It would be more robust to add these as cleanups rather than teardowns.
tearDown is only called if the setUp() succeeds, whereas a cleanup is called unconditionally. (cleanups were new in Python 2.7's unittest, and also exist in testtools.TestCase)
see http:// docs.python. org/3/library/ unittest. html#unittest. TestCase. addCleanup
so if a setUp() fails somewhere after the server is started, the tearDown will not be called, leaving a hanging server process around.
for example, in 'BrowserTestCas eBaseWithHTTPSe rver' class, you could rename tearDown() to cleanup() (or whatever), and inside the setUp, add:
`self.addCleanu p(cleanup) `
this would make it more robust and possibly alleviate this issue.
p.s. if this wasn't explained clearly, I can MP a fix to webbrowser-app changing from tearDowns to addCleanups. autopilot/ webbrowser_ app/tests/ __init_ _.py of webbrowser-app.
the TestCase class I'm referring to reside in /tests/
-cgoldberg