Bump version to 0.10.11 and update installation instructions; enhance progress reporting and estimated time features
This commit is contained in:
@@ -58,7 +58,7 @@ class DownloadProgressTest(unittest.TestCase):
|
||||
|
||||
status = json.loads(status_path.read_text(encoding="utf-8"))
|
||||
self.assertAlmostEqual(status["progress"], 0.275)
|
||||
self.assertEqual(status["message"], "downloading owner/model")
|
||||
self.assertEqual(status["message"], "Downloading owner/model")
|
||||
|
||||
def test_reports_download_speed(self):
|
||||
class FakeTqdmWithRate(FakeTqdm):
|
||||
@@ -87,9 +87,31 @@ class DownloadProgressTest(unittest.TestCase):
|
||||
status = json.loads(status_path.read_text(encoding="utf-8"))
|
||||
self.assertEqual(
|
||||
status["message"],
|
||||
"downloading da3 small 13.4 MB/s",
|
||||
"Downloading da3 small | 13.4 MB/s",
|
||||
)
|
||||
|
||||
def test_reports_estimated_time_remaining(self):
|
||||
times = iter((0.0, 10.0))
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
status_path = Path(directory) / "status.json"
|
||||
progress_class = self.worker.create_download_progress_class(
|
||||
status_path,
|
||||
"owner/model",
|
||||
tqdm_type=FakeTqdm,
|
||||
clock=lambda: next(times),
|
||||
)
|
||||
progress = progress_class(
|
||||
desc="Downloading bytes",
|
||||
total=100,
|
||||
initial=0,
|
||||
unit="B",
|
||||
)
|
||||
|
||||
progress.update(50)
|
||||
|
||||
status = json.loads(status_path.read_text(encoding="utf-8"))
|
||||
self.assertEqual(status["eta_seconds"], 10)
|
||||
|
||||
def test_staged_download_prefixes_speed_with_downloading(self):
|
||||
class FakeTqdmWithRate(FakeTqdm):
|
||||
@property
|
||||
@@ -118,7 +140,10 @@ class DownloadProgressTest(unittest.TestCase):
|
||||
progress.update(50)
|
||||
|
||||
status = json.loads(status_path.read_text(encoding="utf-8"))
|
||||
self.assertEqual(status["message"], "downloading 13.4 MB/s")
|
||||
self.assertEqual(
|
||||
status["message"],
|
||||
"Downloading packages | 13.4 MB/s",
|
||||
)
|
||||
self.assertEqual(status["stage"], 6)
|
||||
self.assertEqual(status["stages"], 8)
|
||||
self.assertEqual(status["stage_label"], "da3 small")
|
||||
|
||||
Reference in New Issue
Block a user