From 6cfcd564c0684c52618235e6366f4a81c02b9a5b Mon Sep 17 00:00:00 2001 From: historia Date: Tue, 1 Sep 2026 14:32:05 -0400 Subject: slop refactor/dedup --- app/tests/test_backends_common.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'app/tests/test_backends_common.py') diff --git a/app/tests/test_backends_common.py b/app/tests/test_backends_common.py index 08ffc2c..68a5543 100644 --- a/app/tests/test_backends_common.py +++ b/app/tests/test_backends_common.py @@ -51,6 +51,34 @@ class RunConsoleSubprocessStreamingTests(unittest.TestCase): on_cancel=lambda: touched.append(True)) self.assertEqual(touched, [True]) + def test_carriage_return_progress_streams_incrementally(self): + # tqdm/HuggingFace-style \r-only progress: a readline-based reader + # blocked until the next \n, so the updates arrived in one burst + # (or the stall watchdog fired first). Each \r segment must be + # emitted as its own line. + lines = [] + rc = common.run_console_subprocess( + [sys.executable, "-c", + "import sys, time\n" + "for i in range(4):\n" + " sys.stdout.write(f'pct {i}\\r'); sys.stdout.flush()\n" + " time.sleep(0.2)\n" + "sys.stdout.write('done\\n'); sys.stdout.flush()\n"], + emit=lines.append, stall_timeout=1.0) + self.assertEqual(rc, 0) + self.assertEqual(lines, [f"pct {i}" for i in range(4)] + ["done"]) + + def test_url_with_port_preserves_userinfo_and_ipv6(self): + self.assertEqual( + common.url_with_port("http://user:pass@host:8000", 8080), + "http://user:pass@host:8080") + self.assertEqual( + common.url_with_port("http://[::1]:8000", 8080), + "http://[::1]:8080") + self.assertEqual( + common.url_with_port("http://host:8000/path", 8080), + "http://host:8080/path") + class RunConsoleSubprocessStallTests(unittest.TestCase): """The no-output watchdog: a silent child is killed and reported 124.""" -- cgit v1.2.3