diff --git a/online-tests/benchmark.py b/online-tests/benchmark.py index 3e2e90b1..4a7bb551 100644 --- a/online-tests/benchmark.py +++ b/online-tests/benchmark.py @@ -19,6 +19,7 @@ def test_tls_smtp(benchmark, smtp): benchmark(smtp_connect, 10) + def test_login_smtp(benchmark, smtp, gencreds): def smtp_connect_and_login(): smtp.connect() @@ -39,3 +40,17 @@ def test_send_and_receive_10(benchmark, cmfactory, lp): ac2.wait_next_incoming_message() benchmark(send_10_receive_all, 1) + + +def test_ping_pong(benchmark, cmfactory, lp): + """send many messages between two accounts""" + ac1, ac2 = cmfactory.get_online_accounts(2) + chat = cmfactory.get_accepted_chat(ac1, ac2) + + def ping_pong(): + chat.send_text("ping") + msg = ac2.wait_next_incoming_message() + msg.chat.send_text("pong") + ac1.wait_next_incoming_message() + + benchmark(ping_pong, 5) diff --git a/online-tests/conftest.py b/online-tests/conftest.py index 8abde3d1..a4696698 100644 --- a/online-tests/conftest.py +++ b/online-tests/conftest.py @@ -68,9 +68,10 @@ def benchmark(request): for i in range(num): now = time.time() func() - durations.append(time.time()-now) + durations.append(time.time() - now) durations.sort() request.config._benchresults[name] = durations + return bench @@ -84,7 +85,6 @@ def pytest_terminal_summary(terminalreporter): tr.write_line(f"{name: <30} {median:2.4f} seconds") - @pytest.fixture def imap(maildomain): return ImapConn(maildomain)