Skip to content

Commit 35e9149

Browse files
authored
Revert "Make the sync store tests synchronous (#16529)" (#16941)
1 parent c7bb694 commit 35e9149

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

tests/core/full_node/stores/test_sync_store.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
import random
44

5+
import pytest
6+
57
from chia.full_node.sync_store import SyncStore
68
from chia.types.blockchain_format.sized_bytes import bytes32
79
from chia.util.hash import std_hash
810

911

10-
def test_basic_store():
12+
@pytest.mark.anyio
13+
async def test_basic_store():
1114
store = SyncStore()
1215

1316
# Save/get sync
@@ -53,7 +56,8 @@ def test_basic_store():
5356
assert store.get_heaviest_peak().weight == 700
5457

5558

56-
def test_is_backtrack_syncing_works_when_not_present(seeded_random: random.Random) -> None:
59+
@pytest.mark.anyio
60+
async def test_is_backtrack_syncing_works_when_not_present(seeded_random: random.Random) -> None:
5761
store = SyncStore()
5862
node_id = bytes32.random(r=seeded_random)
5963

@@ -63,7 +67,8 @@ def test_is_backtrack_syncing_works_when_not_present(seeded_random: random.Rando
6367
assert node_id not in store._backtrack_syncing
6468

6569

66-
def test_increment_backtrack_syncing_adds(seeded_random: random.Random) -> None:
70+
@pytest.mark.anyio
71+
async def test_increment_backtrack_syncing_adds(seeded_random: random.Random) -> None:
6772
store = SyncStore()
6873
node_id = bytes32.random(r=seeded_random)
6974

@@ -73,7 +78,8 @@ def test_increment_backtrack_syncing_adds(seeded_random: random.Random) -> None:
7378
assert node_id in store._backtrack_syncing
7479

7580

76-
def test_increment_backtrack_syncing_increments(seeded_random: random.Random) -> None:
81+
@pytest.mark.anyio
82+
async def test_increment_backtrack_syncing_increments(seeded_random: random.Random) -> None:
7783
store = SyncStore()
7884
node_id = bytes32.random(r=seeded_random)
7985

@@ -82,7 +88,10 @@ def test_increment_backtrack_syncing_increments(seeded_random: random.Random) ->
8288
assert store._backtrack_syncing[node_id] == 2
8389

8490

85-
def test_decrement_backtrack_syncing_does_nothing_when_not_present(seeded_random: random.Random) -> None:
91+
@pytest.mark.anyio
92+
async def test_decrement_backtrack_syncing_does_nothing_when_not_present(
93+
seeded_random: random.Random,
94+
) -> None:
8695
store = SyncStore()
8796
node_id = bytes32.random(r=seeded_random)
8897

@@ -92,7 +101,8 @@ def test_decrement_backtrack_syncing_does_nothing_when_not_present(seeded_random
92101
assert node_id not in store._backtrack_syncing
93102

94103

95-
def test_decrement_backtrack_syncing_decrements(seeded_random: random.Random) -> None:
104+
@pytest.mark.anyio
105+
async def test_decrement_backtrack_syncing_decrements(seeded_random: random.Random) -> None:
96106
store = SyncStore()
97107
node_id = bytes32.random(r=seeded_random)
98108

@@ -101,7 +111,8 @@ def test_decrement_backtrack_syncing_decrements(seeded_random: random.Random) ->
101111
assert store._backtrack_syncing[node_id] == 1
102112

103113

104-
def test_decrement_backtrack_syncing_removes_at_0(seeded_random: random.Random) -> None:
114+
@pytest.mark.anyio
115+
async def test_decrement_backtrack_syncing_removes_at_0(seeded_random: random.Random) -> None:
105116
store = SyncStore()
106117
node_id = bytes32.random(r=seeded_random)
107118

@@ -110,7 +121,8 @@ def test_decrement_backtrack_syncing_removes_at_0(seeded_random: random.Random)
110121
assert node_id not in store._backtrack_syncing
111122

112123

113-
def test_backtrack_syncing_removes_on_disconnect(seeded_random: random.Random) -> None:
124+
@pytest.mark.anyio
125+
async def test_backtrack_syncing_removes_on_disconnect(seeded_random: random.Random) -> None:
114126
store = SyncStore()
115127
node_id = bytes32.random(r=seeded_random)
116128

0 commit comments

Comments
 (0)