@@ -23,6 +23,7 @@ def engine(driver_name: str | None = None) -> pyttsx3.engine.Engine:
2323 engine .stop () # Ensure the engine stops after tests
2424
2525
26+ @pytest .mark .parallel_threads (1 )
2627def test_engine_name (engine ) -> None :
2728 expected = pyttsx3 .engine .default_engine_by_sys_platform ()
2829 assert engine .driver_name == expected
@@ -31,6 +32,7 @@ def test_engine_name(engine) -> None:
3132
3233
3334@pytest .mark .skipif (sys .platform == "win32" , reason = "TODO: Fix this test to pass on Windows" )
35+ # @pytest.mark.parallel_threads(1)
3436def test_speaking_text (engine ) -> None :
3537 engine .say ("Sally sells seashells by the seashore." )
3638 engine .say (quick_brown_fox )
@@ -39,6 +41,7 @@ def test_speaking_text(engine) -> None:
3941
4042
4143@pytest .mark .skipif (sys .platform not in ("darwin" , "ios" ), reason = "Testing only on macOS and iOS" )
44+ @pytest .mark .parallel_threads (1 )
4245def test_apple_avspeech_voices (engine ):
4346 import platform # noqa: PLC0415 # Only needed on macOS and iOS
4447
@@ -80,6 +83,7 @@ def test_apple_avspeech_voices(engine):
8083
8184
8285@pytest .mark .skipif (sys .platform not in ("darwin" , "ios" ), reason = "Testing only on macOS and iOS" )
86+ @pytest .mark .parallel_threads (1 )
8387def test_apple_nsss_voices (engine ):
8488 import platform # noqa: PLC0415 # Only needed on macOS and iOS
8589
@@ -117,6 +121,7 @@ def test_apple_nsss_voices(engine):
117121 engine .setProperty ("voice" , voice ) # Reset voice to original value
118122
119123
124+ @pytest .mark .parallel_threads (1 )
120125def test_saving_to_file (engine , tmp_path : Path ) -> None :
121126 """
122127 Apple writes .aiff, not .wav. https://github.com/nateshmbhat/pyttsx3/issues/361
@@ -144,6 +149,7 @@ def test_saving_to_file(engine, tmp_path: Path) -> None:
144149
145150
146151@pytest .mark .skipif (sys .platform == "win32" , reason = "TODO: Fix this test to pass on Windows" )
152+ @pytest .mark .parallel_threads (1 )
147153def test_listening_for_events (engine ) -> None :
148154 onStart = mock .Mock ()
149155 onWord = mock .Mock ()
@@ -166,6 +172,7 @@ def test_listening_for_events(engine) -> None:
166172 sys .platform in ("linux" , "win32" ),
167173 reason = "TODO: Fix this test to pass on Linux and Windows" ,
168174)
175+ @pytest .mark .parallel_threads (1 )
169176def test_interrupting_utterance (engine ) -> None :
170177 def onWord (name , location , length ) -> None :
171178 if location > 10 :
@@ -181,6 +188,7 @@ def onWord(name, location, length) -> None:
181188
182189
183190@pytest .mark .skipif (sys .platform == "win32" , reason = "TODO: Fix this test to pass on Windows" )
191+ @pytest .mark .parallel_threads (1 )
184192def test_changing_speech_rate (engine ) -> None :
185193 rate = engine .getProperty ("rate" )
186194 rate_plus_fifty = rate + 50
@@ -191,6 +199,7 @@ def test_changing_speech_rate(engine) -> None:
191199
192200
193201@pytest .mark .skipif (sys .platform == "win32" , reason = "TODO: Fix this test to pass on Windows" )
202+ @pytest .mark .parallel_threads (1 )
194203def test_changing_volume (engine ) -> None :
195204 volume = engine .getProperty ("volume" )
196205 volume_minus_a_quarter = volume - 0.25
@@ -201,6 +210,7 @@ def test_changing_volume(engine) -> None:
201210
202211
203212@pytest .mark .skipif (sys .platform == "win32" , reason = "TODO: Fix this test to pass on Windows" )
213+ @pytest .mark .parallel_threads (1 )
204214def test_changing_voices (engine ) -> None :
205215 voices = engine .getProperty ("voices" )
206216 for voice in voices : # TODO: This could be lots of voices! (e.g. 177 on macOS v15.x)
@@ -210,6 +220,8 @@ def test_changing_voices(engine) -> None:
210220
211221
212222@pytest .mark .skipif (sys .platform == "win32" , reason = "TODO: Fix this test to pass on Windows" )
223+ @pytest .mark .iterations (1 )
224+ @pytest .mark .parallel_threads (1 )
213225def test_running_driver_event_loop (engine ) -> None :
214226 def onStart (name ) -> None :
215227 print ("starting" , name )
@@ -234,6 +246,7 @@ def onEnd(name, completed) -> None:
234246 sys .platform in ("linux" , "win32" ),
235247 reason = "TODO: Fix this test to pass on Linux and Windows" ,
236248)
249+ @pytest .mark .parallel_threads (1 )
237250def test_external_event_loop (engine ) -> None :
238251 def externalLoop () -> None :
239252 for _ in range (5 ):
0 commit comments