From 2fe28180762ac7f3cb49d54d6b40e3245862b4e1 Mon Sep 17 00:00:00 2001 From: Earle Lowe <30607889+emlowe@users.noreply.github.com> Date: Wed, 12 Jun 2024 07:46:35 -0700 Subject: [PATCH] Use TYPE_CHECKING to work around python 3.8 limitations with generics (#18152) * Use TYPE_CHECKING to work around python 3.8 limitations with generics * Add comment about 3.8 specific workaround --- chia/_tests/wallet/test_new_wallet_protocol.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/chia/_tests/wallet/test_new_wallet_protocol.py b/chia/_tests/wallet/test_new_wallet_protocol.py index c59560e24cdd..9ba62057ecf8 100644 --- a/chia/_tests/wallet/test_new_wallet_protocol.py +++ b/chia/_tests/wallet/test_new_wallet_protocol.py @@ -3,7 +3,7 @@ from asyncio import Queue from dataclasses import dataclass from random import Random -from typing import AsyncGenerator, Dict, List, Optional, OrderedDict, Set, Tuple +from typing import TYPE_CHECKING, AsyncGenerator, Dict, List, Optional, OrderedDict, Set, Tuple import pytest from chia_rs import AugSchemeMPL, Coin, CoinSpend, CoinState, Program @@ -33,6 +33,11 @@ IDENTITY_PUZZLE_HASH = IDENTITY_PUZZLE.get_tree_hash() OneNode = Tuple[List[SimulatorFullNodeService], List[WalletService], BlockTools] +# python 3.8 workaround follows - can be removed when 3.8 support is removed +if TYPE_CHECKING: + Mpu = Tuple[FullNodeSimulator, Queue[Message], WSChiaConnection] +else: + Mpu = Tuple[FullNodeSimulator, Queue, WSChiaConnection] ALL_FILTER = wallet_protocol.CoinStateFilters(True, True, True, uint64(0)) @@ -798,9 +803,6 @@ async def assert_mempool_removed( assert set(update.removed_items) == removed_items -Mpu = Tuple[FullNodeSimulator, Queue[Message], WSChiaConnection] - - @pytest.fixture async def mpu_setup(one_node: OneNode, self_hostname: str) -> Mpu: return await raw_mpu_setup(one_node, self_hostname)