Browse Source

tests: fix futures test when building without true threading

rdb 7 years ago
parent
commit
4bc0a1ef5e
1 changed files with 8 additions and 1 deletions
  1. 8 1
      tests/event/test_futures.py

+ 8 - 1
tests/event/test_futures.py

@@ -1,6 +1,5 @@
 from panda3d import core
 from panda3d import core
 import pytest
 import pytest
-import threading
 import time
 import time
 import sys
 import sys
 
 
@@ -39,7 +38,11 @@ def test_future_timeout():
         fut.result(0.001)
         fut.result(0.001)
 
 
 
 
[email protected](not core.Thread.is_threading_supported(),
+                    reason="Threading support disabled")
 def test_future_wait():
 def test_future_wait():
+    threading = pytest.importorskip("direct.stdpy.threading")
+
     fut = core.AsyncFuture()
     fut = core.AsyncFuture()
 
 
     # Launch a thread to set the result value.
     # Launch a thread to set the result value.
@@ -59,7 +62,11 @@ def test_future_wait():
     assert fut.result() is None
     assert fut.result() is None
 
 
 
 
[email protected](not core.Thread.is_threading_supported(),
+                    reason="Threading support disabled")
 def test_future_wait_cancel():
 def test_future_wait_cancel():
+    threading = pytest.importorskip("direct.stdpy.threading")
+
     fut = core.AsyncFuture()
     fut = core.AsyncFuture()
 
 
     # Launch a thread to cancel the future.
     # Launch a thread to cancel the future.