MCPcopy Create free account
hub / github.com/celery/celery / test_default

Method test_default

t/unit/utils/test_platforms.py:579–600  ·  view source on GitHub ↗
(self, open, geteuid, maybe_drop,
                     signals, pidlock)

Source from the content-addressed store, hash-verified

577 @patch('os.geteuid')
578 @patch('builtins.open')
579 def test_default(self, open, geteuid, maybe_drop,
580 signals, pidlock):
581 geteuid.return_value = 0
582 context = detached(uid='user', gid='group')
583 assert isinstance(context, DaemonContext)
584 signals.reset.assert_called_with('SIGCLD')
585 maybe_drop.assert_called_with(uid='user', gid='group')
586 open.return_value = Mock()
587
588 geteuid.return_value = 5001
589 context = detached(uid='user', gid='group', logfile='/foo/bar')
590 assert isinstance(context, DaemonContext)
591 assert context.after_chdir
592 context.after_chdir()
593 open.assert_called_with('/foo/bar', 'a')
594 open.return_value.close.assert_called_with()
595
596 context = detached(pidfile='/foo/bar/pid')
597 assert isinstance(context, DaemonContext)
598 assert context.after_chdir
599 context.after_chdir()
600 pidlock.assert_called_with('/foo/bar/pid')
601
602
603@t.skip.if_win32

Callers

nothing calls this directly

Calls 1

detachedFunction · 0.90

Tested by

no test coverage detected