|
13 | 13 | import pytest
|
14 | 14 | from chia_rs import G1Element
|
15 | 15 | from chia_rs.sized_ints import uint16, uint32
|
| 16 | +from chiapos import DiskProver |
16 | 17 |
|
17 | 18 | from chia._tests.plotting.util import get_test_plots
|
18 | 19 | from chia._tests.util.misc import boolean_datacases
|
19 | 20 | from chia._tests.util.time_out_assert import time_out_assert
|
20 | 21 | from chia.plotting.cache import CURRENT_VERSION, CacheDataV1
|
21 | 22 | from chia.plotting.manager import Cache, PlotManager
|
| 23 | +from chia.plotting.prover import V1Prover |
22 | 24 | from chia.plotting.util import (
|
23 | 25 | PlotInfo,
|
24 | 26 | PlotRefreshEvents,
|
@@ -743,6 +745,20 @@ async def test_recursive_plot_scan(environment: Environment) -> None:
|
743 | 745 | await env.refresh_tester.run(expected_result)
|
744 | 746 |
|
745 | 747 |
|
| 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 | + |
746 | 762 | @boolean_datacases(name="follow_links", false="no_follow", true="follow")
|
747 | 763 | @pytest.mark.anyio
|
748 | 764 | async def test_recursive_plot_scan_symlinks(environment: Environment, follow_links: bool) -> None:
|
|
0 commit comments