mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-03 13:53:21 +01:00
fix tests on win32
This commit is contained in:
parent
8562b9191c
commit
dda1e040a8
@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import base64
|
||||
import sys
|
||||
from typing import Any
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
@ -153,9 +154,7 @@ class MockAPINoiseFrameHelper(APINoiseFrameHelper):
|
||||
) from err
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"in_bytes, pkt_data, pkt_type",
|
||||
[
|
||||
_PLAINTEXT_TESTS = [
|
||||
(PREAMBLE + varuint_to_bytes(0) + varuint_to_bytes(1), b"", 1),
|
||||
(
|
||||
PREAMBLE + varuint_to_bytes(192) + varuint_to_bytes(1) + (b"\x42" * 192),
|
||||
@ -173,10 +172,7 @@ class MockAPINoiseFrameHelper(APINoiseFrameHelper):
|
||||
100,
|
||||
),
|
||||
(
|
||||
PREAMBLE
|
||||
+ varuint_to_bytes(8192)
|
||||
+ varuint_to_bytes(8192)
|
||||
+ (b"\x42" * 8192),
|
||||
PREAMBLE + varuint_to_bytes(8192) + varuint_to_bytes(8192) + (b"\x42" * 8192),
|
||||
(b"\x42" * 8192),
|
||||
8192,
|
||||
),
|
||||
@ -185,6 +181,12 @@ class MockAPINoiseFrameHelper(APINoiseFrameHelper):
|
||||
(b"\x42" * 256),
|
||||
256,
|
||||
),
|
||||
]
|
||||
if sys.platform != "win32":
|
||||
# pytest sets name of the test as an env var as win32 has a max char
|
||||
# limit that will cause the test to fail
|
||||
_PLAINTEXT_TESTS.extend(
|
||||
[
|
||||
(
|
||||
PREAMBLE + varuint_to_bytes(1) + varuint_to_bytes(32768) + b"\x42",
|
||||
b"\x42",
|
||||
@ -198,7 +200,13 @@ class MockAPINoiseFrameHelper(APINoiseFrameHelper):
|
||||
(b"\x42" * 32768),
|
||||
32768,
|
||||
),
|
||||
],
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"in_bytes, pkt_data, pkt_type",
|
||||
_PLAINTEXT_TESTS,
|
||||
)
|
||||
@pytest.mark.asyncio
|
||||
async def test_plaintext_frame_helper(
|
||||
|
Loading…
Reference in New Issue
Block a user