def test_ps(self, getpid, Process): prev, debug._process = debug._process, None try: debug.ps() Process.assert_called_with(getpid()) self.assertIs(debug._process, Process()) finally: debug._process = prev
def test_ps(patching): Process = patching('celery.utils.debug.Process') getpid = patching('os.getpid') prev, debug._process = debug._process, None try: debug.ps() Process.assert_called_with(getpid()) assert debug._process is Process() finally: debug._process = prev