mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Fix failing test
This commit is contained in:
@@ -224,6 +224,7 @@ class TestDownloadManager(unittest.TestCase):
|
||||
def test_progress_with_explicit_total_size(self):
|
||||
"""Test progress tracking with explicitly provided total_size."""
|
||||
import asyncio
|
||||
import unittest
|
||||
|
||||
async def run_test():
|
||||
progress_calls = []
|
||||
@@ -231,14 +232,20 @@ class TestDownloadManager(unittest.TestCase):
|
||||
async def track_progress(percent):
|
||||
progress_calls.append(percent)
|
||||
|
||||
data = await DownloadManager.download_url(
|
||||
"https://httpbin.org/bytes/3072", # 3KB
|
||||
total_size=3072,
|
||||
progress_callback=track_progress
|
||||
)
|
||||
try:
|
||||
data = await DownloadManager.download_url(
|
||||
"https://httpbin.org/bytes/3072", # 3KB
|
||||
total_size=3072,
|
||||
progress_callback=track_progress
|
||||
)
|
||||
|
||||
self.assertIsNotNone(data)
|
||||
self.assertTrue(len(progress_calls) > 0)
|
||||
self.assertIsNotNone(data)
|
||||
self.assertTrue(len(progress_calls) > 0)
|
||||
except RuntimeError as e:
|
||||
# Skip test if httpbin.org is unavailable (HTTP 502, etc.)
|
||||
if "HTTP" in str(e):
|
||||
self.skipTest(f"httpbin.org unavailable: {e}")
|
||||
raise
|
||||
|
||||
asyncio.run(run_test())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user