diff --git a/python/podio/__init__.py b/python/podio/__init__.py index 477247fde..483885729 100644 --- a/python/podio/__init__.py +++ b/python/podio/__init__.py @@ -26,6 +26,14 @@ from . import EventStore + try: + # For some reason the test_utils only work at (test) runtime if they are + # imported with the rest of podio. Otherwise they produce a weird c++ error. + # This happens even if we import the *exact* same file. + from . import test_utils # noqa: F401 + except ImportError: + pass + # Make sure that this module is actually usable as podio even though most of # it is dynamically populated by cppyy sys.modules["podio"] = podio diff --git a/tests/root_io/write_frame_root.py b/tests/root_io/write_frame_root.py index 2609c602a..e0525a268 100644 --- a/tests/root_io/write_frame_root.py +++ b/tests/root_io/write_frame_root.py @@ -1,12 +1,7 @@ #!/usr/bin/env python3 """Script to write a Frame in ROOT format""" -import os -import sys - -sys.path.append(os.path.join(os.environ.get("PODIO_BASE"), "python", "podio")) - -import test_utils # pylint: disable=import-error, disable=wrong-import-position +from podio import test_utils from podio.root_io import Writer # pylint: disable=wrong-import-position