예제 #1
0
 def test_write_remove_info_file(self):
     info = _make_info()
     self.assertEqual(self._list_info_dir(), [])
     manager.write_info_file(info)
     filename = "pid-76540.info"
     expected_filepath = os.path.join(self.info_dir, filename)
     self.assertEqual(self._list_info_dir(), [filename])
     with open(expected_filepath) as infile:
         self.assertEqual(manager._info_from_string(infile.read()), info)
     manager.remove_info_file()
     self.assertEqual(self._list_info_dir(), [])
예제 #2
0
 def remove_info(i):
     with mock.patch("os.getpid", lambda: 76540 + i):
         manager.remove_info_file()
예제 #3
0
 def test_remove_nonexistent(self):
     # Should be a no-op, except to create the info directory if
     # necessary. In particular, should not raise any exception.
     manager.remove_info_file()