@patch('sys.stderr')
    def test_start_workers_when_nodaemon(self, *args):
        path = os.path.join(FIXTURES_PATH, 'nodaemon-app')
        initcmd = CommandInit()
        initcmd.run(FakeOptions(app_path=path))
        with patch('daemon.DaemonContext', new=MagicMock()):
            with patch.object(Cli, '_create_worker'):
                with patch('wsgid.core.cli.validate_input_params'):
                    with patch.object(Cli, '_wait_workers'):
                        daemon.DaemonContext.__enter__ = Mock()
                        daemon.DaemonContext.__exit__ = Mock()
                        sys.argv[1:] = ['--workers=3', '--no-daemon', '--app-path={0}'.format(path)]
                        cli = Cli()
                        cli.run()
                        self.assertEquals(3, cli._create_worker.call_count)
                        self.assertEquals(1, cli._wait_workers.call_count)
Doing this wsgid is able to run with a process supervisor.
dataset/ETHPy150Open daltonmatos/wsgid/tests/unit/cli_test.py/CliTest.test_start_workers_when_nodaemon