Add cleanup in console utils tests
Two tests in test_console_utils.py were leaving auxiliary pid files behind. As the name of these pid files is hardcoded, it breaks those tests if test suit is being run by different users on a single system. Closes-Bug: #1488854 Change-Id: If00c761a366020eb045d785d6f77f54d21fa2a22
This commit is contained in:
parent
3d45795abb
commit
ba3306f768
@ -238,6 +238,7 @@ class ConsoleUtilsTestCase(db_base.DbTestCase):
|
|||||||
# touch the pid file
|
# touch the pid file
|
||||||
pid_file = console_utils._get_console_pid_file(self.info['uuid'])
|
pid_file = console_utils._get_console_pid_file(self.info['uuid'])
|
||||||
open(pid_file, 'a').close()
|
open(pid_file, 'a').close()
|
||||||
|
self.addCleanup(os.remove, pid_file)
|
||||||
self.assertTrue(os.path.exists(pid_file))
|
self.assertTrue(os.path.exists(pid_file))
|
||||||
|
|
||||||
console_utils.start_shellinabox_console(self.info['uuid'],
|
console_utils.start_shellinabox_console(self.info['uuid'],
|
||||||
@ -264,6 +265,7 @@ class ConsoleUtilsTestCase(db_base.DbTestCase):
|
|||||||
# touch the pid file
|
# touch the pid file
|
||||||
pid_file = console_utils._get_console_pid_file(self.info['uuid'])
|
pid_file = console_utils._get_console_pid_file(self.info['uuid'])
|
||||||
open(pid_file, 'a').close()
|
open(pid_file, 'a').close()
|
||||||
|
self.addCleanup(os.remove, pid_file)
|
||||||
self.assertTrue(os.path.exists(pid_file))
|
self.assertTrue(os.path.exists(pid_file))
|
||||||
|
|
||||||
console_utils.start_shellinabox_console(self.info['uuid'],
|
console_utils.start_shellinabox_console(self.info['uuid'],
|
||||||
|
Loading…
Reference in New Issue
Block a user