File: test_outgoing.py

package info (click to toggle)
python-zeroconf 0.147.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,380 kB
  • sloc: python: 15,356; makefile: 23
file content (22 lines) | stat: -rw-r--r-- 555 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Benchmark for DNSOutgoing."""

from __future__ import annotations

import pytest
pytest_codspeed = pytest.importorskip("pytest_codspeed")
from pytest_codspeed import BenchmarkFixture

from zeroconf._protocol.outgoing import State

from .helpers import generate_packets


def test_parse_outgoing_message(benchmark: BenchmarkFixture) -> None:
    out = generate_packets()

    @benchmark
    def make_outgoing_message() -> None:
        out.packets()
        out.state = State.init.value
        out.finished = False
        out._reset_for_next_packet()