'Should close the specified file after writing.'

def test_closes_file_after_write(self):

    pidfile_path = self.scenario['path']
    self.scenario['pidfile'].write = scaffold.Mock('PIDLockFile.write', tracker=self.mock_tracker)
    self.scenario['pidfile'].close = scaffold.Mock('PIDLockFile.close', tracker=self.mock_tracker)
    expect_mock_output = ('                                                ...\n                                                Called    PIDLockFile.write(...)\n                                                Called    PIDLockFile.close()\n                                                ' % vars())
    pidlockfile.write_pid_to_pidfile(pidfile_path)
    scaffold.mock_restore()
    self.failUnlessMockCheckerMatch(expect_mock_output)
