Ejemplo n.º 1
0
def test_script_exception():
    with tutils.chdir(tutils.test_data.path("scripts")):
        s = Script("syntaxerr.py", None)
        with tutils.raises(ScriptException):
            s.load()

        s = Script("starterr.py", None)
        with tutils.raises(ScriptException):
            s.load()

        s = Script("a.py", None)
        s.load()
        with tutils.raises(ScriptException):
            s.load()

        s = Script("a.py", None)
        with tutils.raises(ScriptException):
            s.run("here")

        with tutils.raises(ScriptException):
            with Script("reqerr.py", None) as s:
                s.run("request", None)

        s = Script("unloaderr.py", None)
        s.load()
        with tutils.raises(ScriptException):
            s.unload()
Ejemplo n.º 2
0
def test_script_exception():
    with tutils.chdir(tutils.test_data.path("data/scripts")):
        s = Script("syntaxerr.py", None)
        with tutils.raises(ScriptException):
            s.load()

        s = Script("starterr.py", None)
        with tutils.raises(ScriptException):
            s.load()

        s = Script("a.py", None)
        s.load()
        with tutils.raises(ScriptException):
            s.load()

        s = Script("a.py", None)
        with tutils.raises(ScriptException):
            s.run("here")

        with tutils.raises(ScriptException):
            with Script("reqerr.py", None) as s:
                s.run("request", None)

        s = Script("unloaderr.py", None)
        s.load()
        with tutils.raises(ScriptException):
            s.unload()
Ejemplo n.º 3
0
def test_simple():
    with tutils.chdir(tutils.test_data.path("scripts")):
        s = Script("a.py --var 42", None)
        assert s.filename == "a.py"
        assert s.ns is None

        s.load()
        assert s.ns["var"] == 42

        s.run("here")
        assert s.ns["var"] == 43

        s.unload()
        assert s.ns is None

        with tutils.raises(ScriptException):
            s.run("here")

        with Script("a.py --var 42", None) as s:
            s.run("here")
Ejemplo n.º 4
0
def test_simple():
    with tutils.chdir(tutils.test_data.path("data/scripts")):
        s = Script("a.py --var 42", None)
        assert s.filename == "a.py"
        assert s.ns is None

        s.load()
        assert s.ns["var"] == 42

        s.run("here")
        assert s.ns["var"] == 43

        s.unload()
        assert s.ns is None

        with tutils.raises(ScriptException):
            s.run("here")

        with Script("a.py --var 42", None) as s:
            s.run("here")
Ejemplo n.º 5
0
def test_concurrent_err():
    s = Script(tutils.test_data.path("scripts/concurrent_decorator_err.py"),
               None)
    with tutils.raises(
            "Concurrent decorator not supported for 'start' method"):
        s.load()
Ejemplo n.º 6
0
def test_concurrent_err():
    s = Script(tutils.test_data.path("scripts/concurrent_decorator_err.py"), None)
    with tutils.raises("Concurrent decorator not supported for 'start' method"):
        s.load()