From f45ca29351d36b5c4fea3a1441cf3c9b2b653ae8 Mon Sep 17 00:00:00 2001 From: Santiago Vila Date: Mon, 11 Nov 2024 11:37:00 +0100 Subject: [PATCH] gensim/test/test_coherencemodel.py: Make testProcesses match implementation Fixes this error when building on a single-CPU system: =================================== FAILURES =================================== _______________________ TestCoherenceModel.testProcesses _______________________ self = def testProcesses(self): get_model = partial(CoherenceModel, topics=self.topics1, corpus=self.corpus, dictionary=self.dictionary, coherence='u_mass' ) model, used_cpus = get_model(), mp.cpu_count() - 1 > self.assertEqual(model.processes, used_cpus) E AssertionError: 1 != 0 gensim/test/test_coherencemodel.py:152: AssertionError ------------------------------ Captured log call ------------------------------- WARNING gensim.models.ldamodel:ldamodel.py:959 too few updates, training might not converge; consid er increasing the number of passes or iterations to improve accuracy --- gensim/test/test_coherencemodel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gensim/test/test_coherencemodel.py b/gensim/test/test_coherencemodel.py index de26bc8646..52534c9446 100644 --- a/gensim/test/test_coherencemodel.py +++ b/gensim/test/test_coherencemodel.py @@ -148,7 +148,7 @@ def testProcesses(self): topics=self.topics1, corpus=self.corpus, dictionary=self.dictionary, coherence='u_mass' ) - model, used_cpus = get_model(), mp.cpu_count() - 1 + model, used_cpus = get_model(), max(1, mp.cpu_count() - 1) self.assertEqual(model.processes, used_cpus) for p in range(-2, 1): self.assertEqual(get_model(processes=p).processes, used_cpus)