From e3fd2fada86833c29f3e34d1d683e6ddba936be5 Mon Sep 17 00:00:00 2001 From: Marcin Czenko Date: Mon, 31 Mar 2025 15:07:51 +0200 Subject: [PATCH] fix failing test in torrentdownloader --- codex/bittorrent/torrentdownloader.nim | 1 - tests/codex/bittorrent/testtorrentdownloader.nim | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/codex/bittorrent/torrentdownloader.nim b/codex/bittorrent/torrentdownloader.nim index d1b02dd4..cc3911d9 100644 --- a/codex/bittorrent/torrentdownloader.nim +++ b/codex/bittorrent/torrentdownloader.nim @@ -218,7 +218,6 @@ proc getNext*( except CancelledError as e: trace "Getting next block from downloader cancelled" raise e - # return success((-1, newSeq[byte]())) except CatchableError as e: warn "Could not get block from local store", error = e.msg return failure("Could not get block from local store: " & e.msg) diff --git a/tests/codex/bittorrent/testtorrentdownloader.nim b/tests/codex/bittorrent/testtorrentdownloader.nim index a9bfb1b0..397d4938 100644 --- a/tests/codex/bittorrent/testtorrentdownloader.nim +++ b/tests/codex/bittorrent/testtorrentdownloader.nim @@ -235,6 +235,5 @@ asyncchecksuite "Torrent Downloader": assert dataFut.finished - let (blockIndex, data) = dataFut.read.tryGet() - check blockIndex == -1 - check data.len == 0 + expect CancelledError: + discard await dataFut