Skip to content

Commit e3a8cfc

Browse files
committed
test from bytes
1 parent 42f3348 commit e3a8cfc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

chia/_tests/plotting/test_plot_manager.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
import pytest
1414
from chia_rs import G1Element
1515
from chia_rs.sized_ints import uint16, uint32
16+
from chiapos import DiskProver
1617

1718
from chia._tests.plotting.util import get_test_plots
1819
from chia._tests.util.misc import boolean_datacases
1920
from chia._tests.util.time_out_assert import time_out_assert
2021
from chia.plotting.cache import CURRENT_VERSION, CacheDataV1
2122
from chia.plotting.manager import Cache, PlotManager
23+
from chia.plotting.prover import V1Prover
2224
from chia.plotting.util import (
2325
PlotInfo,
2426
PlotRefreshEvents,
@@ -743,6 +745,20 @@ async def test_recursive_plot_scan(environment: Environment) -> None:
743745
await env.refresh_tester.run(expected_result)
744746

745747

748+
@pytest.mark.anyio
749+
async def test_disk_prover_from_bytes(environment: Environment):
750+
env: Environment = environment
751+
expected_result = PlotRefreshResult()
752+
expected_result.loaded = env.dir_1.plot_info_list() # type: ignore[assignment]
753+
expected_result.processed = len(env.dir_1)
754+
add_plot_directory(env.root_path, str(env.dir_1.path))
755+
await env.refresh_tester.run(expected_result)
756+
_, plot_info = next(iter(env.refresh_tester.plot_manager.plots.items()))
757+
recreated_prover = V1Prover(DiskProver.from_bytes(bytes(plot_info.prover)))
758+
assert recreated_prover.get_id() == plot_info.prover.get_id()
759+
assert recreated_prover.get_filename() == plot_info.prover.get_filename()
760+
761+
746762
@boolean_datacases(name="follow_links", false="no_follow", true="follow")
747763
@pytest.mark.anyio
748764
async def test_recursive_plot_scan_symlinks(environment: Environment, follow_links: bool) -> None:

0 commit comments

Comments
 (0)