diff --git a/gaitmap/trajectory_reconstruction/__init__.py b/gaitmap/trajectory_reconstruction/__init__.py index 1f2248fc..0032f1e5 100644 --- a/gaitmap/trajectory_reconstruction/__init__.py +++ b/gaitmap/trajectory_reconstruction/__init__.py @@ -4,6 +4,11 @@ to make applying these methods to the default gaitmap datasets easier. """ +from gaitmap.trajectory_reconstruction._region_level_trajectory import RegionLevelTrajectory +from gaitmap.trajectory_reconstruction._stride_level_trajectory import StrideLevelTrajectory +from gaitmap.trajectory_reconstruction.orientation_methods import MadgwickAHRS, SimpleGyroIntegration +from gaitmap.trajectory_reconstruction.position_methods._forward_backwards_integration import ForwardBackwardIntegration +from gaitmap.trajectory_reconstruction.trajectory_methods import MadgwickRtsKalman, RtsKalman from gaitmap.utils._gaitmap_mad import patch_gaitmap_mad_import _gaitmap_mad_modules = { @@ -14,15 +19,6 @@ del __getattr__ from gaitmap_mad.trajectory_reconstruction.position_methods import PieceWiseLinearDedriftedIntegration - -from gaitmap.trajectory_reconstruction._region_level_trajectory import RegionLevelTrajectory -from gaitmap.trajectory_reconstruction._stride_level_trajectory import StrideLevelTrajectory -from gaitmap.trajectory_reconstruction.orientation_methods import MadgwickAHRS, SimpleGyroIntegration -from gaitmap.trajectory_reconstruction.position_methods import ( - ForwardBackwardIntegration, -) -from gaitmap.trajectory_reconstruction.trajectory_methods import MadgwickRtsKalman, RtsKalman - __all__ = [ "MadgwickAHRS", "SimpleGyroIntegration", diff --git a/tests/_test_gaitmap_mad_split.py b/tests/_test_gaitmap_mad_split.py index d9aa6910..3b2113a3 100644 --- a/tests/_test_gaitmap_mad_split.py +++ b/tests/_test_gaitmap_mad_split.py @@ -25,7 +25,7 @@ def _gaitmap_mad_sys_modifier(): sys.modules["gaitmap_mad"] = None yield - sys.modules.pop("gaitmap_mad") + sys.modules.pop("gaitmap_mad", None) import gaitmap_mad # noqa: F401, F811 # We just go overboard to be save and reimport all gaitmap modules after the cleanup. @@ -40,13 +40,12 @@ def _gaitmap_mad_sys_modifier(): @pytest.fixture(scope="module") def _gaitmap_mad_change_version(): + sys.modules.pop("gaitmap_mad", None) import gaitmap_mad - real_version = gaitmap_mad.__version__ gaitmap_mad.__version__ = "0.0.0" yield - gaitmap_mad.__version__ = real_version - importlib.reload(gaitmap_mad) + sys.modules.pop("gaitmap_mad") def test_raises_error_gaitmap_mad_not_installed(_gaitmap_mad_sys_modifier) -> None: @@ -73,12 +72,13 @@ def test_error_not_raised_when_importing_ori_methods(_gaitmap_mad_sys_modifier) def test_gaitmap_mad_version_mismatch(_gaitmap_mad_change_version) -> None: # We need to make sure that this is a fresh import: sys.modules.pop("gaitmap.stride_segmentation", None) - with pytest.raises(AssertionError): + with pytest.raises(ImportError): from gaitmap.stride_segmentation import BarthDtw # noqa: F401 def test_raises_no_error_gaitmap_mad_installed() -> None: # We need to make sure that this is a fresh import: + sys.modules.pop("gaitmap_mad", None) sys.modules.pop("gaitmap.stride_segmentation", None) from gaitmap.stride_segmentation import BarthDtw # noqa: F401