예제 #1
0
    def test_ignore_keyboard_interrupt(self, monkeypatch):
        def raise_x():
            raise Exception('x')

        my_action = tools.PythonInteractiveAction(raise_x)
        got = my_action.execute()
        assert isinstance(got, exceptions.TaskError)
예제 #2
0
    def test_success(self):
        def hello():
            print('hello')

        my_action = tools.PythonInteractiveAction(hello)
        got = my_action.execute()
        assert got is None
예제 #3
0
 def test_returned_dict_saved_result_values(self):
     def val(): return {'x': 3}
     my_action = tools.PythonInteractiveAction(val)
     got = my_action.execute()
     assert got is None
     assert my_action.result == {'x': 3}
     assert my_action.values == {'x': 3}
예제 #4
0
def task_watch():
    """watch typescript sources, rebuilding as files change"""

    if C.TESTING_IN_CI:
        return

    def _watch():
        watchers = [
            subprocess.Popen(args) for args in [
                [C.JLPM, "watch"],
                # [*C.LAB_EXT, "watch", "."],
            ]
        ]

        def stop():
            [w.terminate() for w in watchers]
            [w.wait() for w in watchers]

        try:
            watchers[0].wait()
        except KeyboardInterrupt:
            pass
        finally:
            stop()
        return True

    yield dict(
        name="ts",
        uptodate=[lambda: False],
        file_dep=[B.OK_EXT_DEV],
        actions=[tools.PythonInteractiveAction(_watch)],
    )
예제 #5
0
def task_watch():
    """watch typescript sources, rebuilding as files change"""
    def _watch():
        watchers = [
            subprocess.Popen(args) for args in [
                [*C.JLPM, "watch:lib"],
                [*C.JLPM, "watch:ext"],
            ]
        ]

        def stop():
            [w.terminate() for w in watchers]
            [w.wait() for w in watchers]

        try:
            watchers[0].wait()
        except KeyboardInterrupt:
            pass
        finally:
            stop()
        return True

    return dict(
        uptodate=[lambda: False],
        task_dep=["dev:ext"],
        actions=[tools.PythonInteractiveAction(_watch)],
    )
예제 #6
0
파일: test_tools.py 프로젝트: rowhit/doit
    def test_returned_string_saved_result(self):
        def val():
            return 'hello'

        my_action = tools.PythonInteractiveAction(val)
        got = my_action.execute()
        assert got is None
        assert my_action.result == 'hello'