Skip to content

Commit

Permalink
Merge pull request #957 from dstl/plugin_test
Browse files Browse the repository at this point in the history
Add pyehm plugin as optional tests
  • Loading branch information
sdhiscocks committed Feb 13, 2024
2 parents ed5cf52 + a3f2a95 commit aa6e55b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
python -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install -e .[dev,orbital] opencv-python-headless
pip install -e .[dev,orbital] opencv-python-headless pyehm
- save_cache:
paths:
- ./venv
Expand Down
26 changes: 19 additions & 7 deletions stonesoup/dataassociator/tests/test_probability.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,26 @@
from ...types.detection import Detection, MissedDetection
from ...types.state import GaussianState
from ...types.track import Track


@pytest.fixture(params=[PDA, JPDA])
try:
from ...plugins.pyehm import JPDAWithEHM, JPDAWithEHM2
except ImportError:
JPDAWithEHM = None
JPDAWithEHM2 = None


@pytest.fixture(
params=[
PDA,
JPDA,
pytest.param(
JPDAWithEHM,
marks=pytest.mark.skipif(JPDAWithEHM is None, reason="pyehm required")),
pytest.param(
JPDAWithEHM2,
marks=pytest.mark.skipif(JPDAWithEHM2 is None, reason="pyehm required")),
])
def associator(request, probability_hypothesiser):
if request.param is PDA:
return request.param(probability_hypothesiser)
elif request.param is JPDA:
return request.param(probability_hypothesiser)
return request.param(probability_hypothesiser)


def test_probability(associator):
Expand Down
4 changes: 2 additions & 2 deletions stonesoup/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
except TypeError: # Older interface, doesn't accept group keyword
try:
_plugin_points = entry_points()['stonesoup.plugins']
except KeyError:
except KeyError: # pragma: no cover
_plugin_points = []

for entry_point in _plugin_points:
Expand All @@ -45,5 +45,5 @@
plugin_module = f'{__name__}.{name}'
sys.modules[plugin_module] = entry_point.load()

except (ImportError, ModuleNotFoundError) as e:
except (ImportError, ModuleNotFoundError) as e: # pragma: no cover
warnings.warn(f'Failed to load module. {e}')

0 comments on commit aa6e55b

Please sign in to comment.