Ejemplo n.º 1
0
def test_instacrash_raises_error():
    http = LambdaHttpClient('crashy', '', cwd=BASE_DIR, interpreter_args=[
        '-e', r'process.exit(5)'
    ])
    with pytest.raises(Exception, match="Subprocess failed with exit code 5"):
        http.get_url()
    assert http.is_running is False
Ejemplo n.º 2
0
def test_unparseable_port_raises_error():
    http = LambdaHttpClient(
        "bad_port",
        "",
        cwd=BASE_DIR,
        interpreter_args=["-e", r'console.log("SUP"); while (1) {}'])
    with pytest.raises(Exception,
                       match="Could not parse port from line: b'SUP"):
        http.get_url()
    assert http.is_running is False
Ejemplo n.º 3
0
def test_hanging_without_stdout_raises_error():
    http = LambdaHttpClient("hang",
                            "",
                            cwd=BASE_DIR,
                            timeout_secs=0.001,
                            interpreter_args=["-e", r"while (1) {}"])
    with pytest.raises(Exception,
                       match="Subprocess produced no output within 0.001s"):
        http.get_url()
    assert http.is_running is False