Skip to content

Commit f8c6f74

Browse files
committed
Fail quietly during tests if bdsim is not installed
1 parent 5e63b97 commit f8c6f74

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
from .camera import *
1+
try:
2+
from .camera import *
3+
except ImportError:
4+
pass
25

36
url = "https://petercorke.github.io/machinevision-toolbox-python/" + __package__

machinevisiontoolbox/blocks/test_blocks.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env python3
22

3-
from bdsim.blocks.linalg import *
3+
try:
4+
from bdsim.blocks.linalg import *
5+
6+
_bdsim = True
7+
except ImportError:
8+
_bdsim = False
49

510
import unittest
611
import numpy.testing as nt
@@ -11,6 +16,7 @@
1116
from machinevisiontoolbox.blocks import *
1217

1318

19+
@unittest.skipIf(not _bdsim, reason="bdsim is not installed")
1420
class CameraBlockTest(unittest.TestCase):
1521
def test_camera(self):
1622

0 commit comments

Comments
 (0)