From 213613f9b28ccd3db311ec2e7f5f80f302623172 Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Sat, 19 Sep 2026 21:09:55 +0800 Subject: [PATCH] Improve logical spacing in profile testing Signed-off-by: Loren Eteval --- Furious/Service/ProfileTesting.py | 2 ++ tests/test_profile_test_jobs.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/Furious/Service/ProfileTesting.py b/Furious/Service/ProfileTesting.py index 0c0c4d5..55a3099 100644 --- a/Furious/Service/ProfileTesting.py +++ b/Furious/Service/ProfileTesting.py @@ -531,6 +531,7 @@ class _LatencyScheduler(QtCore.QObject): continue job.state = ProfileTestJobState.Running + worker = self.pingWorkerFactory(job, self) self.activeJobs[id(job)] = (job, worker) @@ -1269,6 +1270,7 @@ class _DownloadSpeedScheduler(QtCore.QObject): return _, job, port = active + lease = worker.takeRuntimeLease() # Completion may notify reentrant consumers. Establish the durable diff --git a/tests/test_profile_test_jobs.py b/tests/test_profile_test_jobs.py index f1e895f..7d63831 100644 --- a/tests/test_profile_test_jobs.py +++ b/tests/test_profile_test_jobs.py @@ -428,6 +428,7 @@ class ProfileTestServiceTest(unittest.TestCase): self.assertEqual(runtime.isRunning(), failure == 'stop') runtime.failure = None + worker._releaseRuntime() self.assertIsNone(worker._runtimeLease) @@ -446,16 +447,19 @@ class ProfileTestServiceTest(unittest.TestCase): if concurrent else manager._serialDownloadScheduler ) + results = [] manager.resultApplied.connect( lambda _profile, result: results.append(result) ) + manager.testDownloadSpeed(profiles, concurrent=concurrent) processQtEvents() worker, runtime = workers[0], runtimes[0] port = worker.port lease = worker._runtimeLease + destroyed = [] worker.destroyed.connect(lambda: destroyed.append(True)) results.clear() @@ -479,9 +483,11 @@ class ProfileTestServiceTest(unittest.TestCase): runtime.publishExit(RuntimeExit(1, RuntimeExitReason.Unexpected)) processQtEvents() + self.assertEqual(len(results), 1) runtime.failure = None + scheduler.scheduleDrain() processQtEvents() @@ -500,7 +506,9 @@ class ProfileTestServiceTest(unittest.TestCase): manager.testDownloadSpeed(profiles[:1], concurrent=False) manager.testDownloadSpeed(profiles[1:], concurrent=True) processQtEvents() + self.assertEqual(len(workers), 2) + runtimes[1].failure = None with self.assertLogs('Furious.Service.RuntimeLease', level='ERROR'): @@ -516,9 +524,11 @@ class ProfileTestServiceTest(unittest.TestCase): manager.testDownloadSpeed(profiles) processQtEvents() + self.assertEqual(len(workers), 2) runtimes[0].failure = None + manager.shutdown() processQtEvents()