PEP8

parent f68eb2cc
...@@ -662,24 +662,25 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase): ...@@ -662,24 +662,25 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
4.Wait for it to fail 4.Wait for it to fail
5.Wait for file generated by monkeypacthed bang to appear 5.Wait for file generated by monkeypacthed bang to appear
""" """
computer = ComputerForTest(self.software_root,self.instance_root) computer = ComputerForTest(self.software_root, self.instance_root)
partition = computer.instance_list[0] partition = computer.instance_list[0]
partition.requested_state = 'started' partition.requested_state = 'started'
partition.software.setBuildout(DAEMON_CONTENT) partition.software.setBuildout(DAEMON_CONTENT)
# Prepare watchdog # Prepare watchdog
watchdog_path = os.path.join(self._tempdir,'watchdog') watchdog_path = os.path.join(self._tempdir, 'watchdog')
watchdog_banged = os.path.join(self._tempdir,'watchdog_banged') watchdog_banged = os.path.join(self._tempdir, 'watchdog_banged')
open(watchdog_path,'w').write( open(watchdog_path, 'w').write(
WATCHDOG_TEMPLATE % dict(python_path=sys.executable, WATCHDOG_TEMPLATE % dict(python_path=sys.executable,
sys_path=sys.path, sys_path=sys.path,
watchdog_banged=watchdog_banged)) watchdog_banged=watchdog_banged))
os.chmod(watchdog_path,0755) os.chmod(watchdog_path, 0755)
self.grid.watchdog_path = watchdog_path self.grid.watchdog_path = watchdog_path
self.assertTrue(self.grid.processComputerPartitionList()) self.assertTrue(self.grid.processComputerPartitionList())
self.assertSortedListEqual(os.listdir(self.instance_root), ['0', 'etc', self.assertSortedListEqual(os.listdir(self.instance_root), ['0', 'etc',
'var']) 'var'])
self.assertSortedListEqual(os.listdir(partition.partition_path), self.assertSortedListEqual(
['.0_daemon.log','worked', 'buildout.cfg', 'etc']) os.listdir(partition.partition_path),
['.0_daemon.log','worked', 'buildout.cfg', 'etc'])
tries = 50 tries = 50
daemon_log = os.path.join(partition.partition_path, '.0_daemon.log') daemon_log = os.path.join(partition.partition_path, '.0_daemon.log')
while tries > 0: while tries > 0:
...@@ -695,7 +696,7 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase): ...@@ -695,7 +696,7 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
break break
time.sleep(0.1) time.sleep(0.1)
self.assertTrue(os.path.exists(watchdog_banged)) self.assertTrue(os.path.exists(watchdog_banged))
self.assertTrue('daemon' in open(watchdog_banged,'r').read()) self.assertTrue('daemon' in open(watchdog_banged, 'r').read())
RUN_CONTENT = """#!/bin/sh RUN_CONTENT = """#!/bin/sh
mkdir -p etc/run && mkdir -p etc/run &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment