Skip to content

Commit 4ef03bb

Browse files
moodyjoneukreign
authored andcommitted
Try separate file_manager.stop() and start() calls to better
control order of events in test. While file_manager is stopped, we get no response to file_list().
1 parent 4bd4bcd commit 4ef03bb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/integration/datanetwork/test_streaming.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import aiohttp.web
55
import asyncio
66

7+
from lbry.file.source import ManagedDownloadSource
78
from lbry.utils import aiohttp_request
89
from lbry.blob.blob_file import MAX_BLOB_SIZE
910
from lbry.testcase import CommandTestCase
@@ -354,10 +355,15 @@ async def test_file_save_stop_before_finished_streaming_only(self, wait_for_star
354355
if wait_for_start_writing:
355356
await stream.started_writing.wait()
356357
self.assertTrue(os.path.isfile(path))
357-
await self._restart_stream_manager()
358+
await self.daemon.file_manager.stop()
359+
# while stopped, we get no response to query and no file is present
360+
self.assertEqual((await self.daemon.jsonrpc_file_list())['items'], [])
361+
self.assertEqual(os.path.isfile(path), stream.status == ManagedDownloadSource.STATUS_FINISHED)
362+
await self.daemon.file_manager.start()
363+
# after restart, we get a response to query and same file path
358364
stream = (await self.daemon.jsonrpc_file_list())['items'][0]
359365
self.assertIsNotNone(stream.full_path)
360-
self.assertFalse(os.path.isfile(path))
366+
self.assertEqual(stream.full_path, path)
361367
if wait_for_start_writing:
362368
await stream.started_writing.wait()
363369
self.assertTrue(os.path.isfile(path))

0 commit comments

Comments
 (0)