예제 #1
0
    def spawn_worker(self):
        if self._max_workers and len(self._workers) >= self._max_workers:
            return

        t = click_threading.Thread(target=self._worker)
        t.start()
        self._workers.append(t)
예제 #2
0
    def cli(ctx):
        contexts = []

        def check_ctx():
            contexts.append(click.get_current_context())

        t = click_threading.Thread(target=check_ctx)
        t.start()
        t.join()

        assert contexts == [ctx]
예제 #3
0
    def cli():

        ui = click_threading.UiWorker()

        def target():
            click.prompt('two')
            ui.shutdown()

        click.prompt('one')

        with ui.patch_click():
            t = click_threading.Thread(target=target)
            t.start()
            ui.run()

        click.prompt('three')
        t.join()