diff --git a/python/podio/__init__.py b/python/podio/__init__.py index 4b6e3df0f..1cd0b0212 100644 --- a/python/podio/__init__.py +++ b/python/podio/__init__.py @@ -3,10 +3,10 @@ from .__version__ import __version__ -import ROOT - from .podio_config_reader import * +import ROOT + # Track whether we were able to dynamially load the library that is built by # podio and enable certain features of the bindings only if they are actually # available. @@ -23,10 +23,17 @@ if _DYNAMIC_LIBS_LOADED: from .frame import Frame from . import root_io, sio_io, reading - from .test_utils import * from . import EventStore # Make sure that this module is actually usable as podio even though most of # it is dynamically populated by cppyy sys.modules["podio"] = podio + + __all__ = [ + "__version__", + "Frame", + "root_io", + "sio_io", + "reading", + ] diff --git a/python/podio/test_EventStoreSio.py b/python/podio/test_EventStoreSio.py index eaa330bd9..e86d25147 100644 --- a/python/podio/test_EventStoreSio.py +++ b/python/podio/test_EventStoreSio.py @@ -6,7 +6,7 @@ from podio.EventStore import EventStore from test_EventStore import EventStoreBaseTestCaseMixin -from podio.test_utils import SKIP_SIO_TESTS +from test_utils import SKIP_SIO_TESTS @unittest.skipIf(SKIP_SIO_TESTS, "no SIO support") diff --git a/python/podio/test_Frame.py b/python/podio/test_Frame.py index 7761deaf0..1255e3a8d 100644 --- a/python/podio/test_Frame.py +++ b/python/podio/test_Frame.py @@ -7,7 +7,8 @@ # using root_io as that should always be present regardless of which backends are built from podio.root_io import Reader -from podio.test_utils import ExampleHitCollection +from test_utils import ExampleHitCollection # noqa: E402 # pylint: disable=wrong-import-position + # The expected collections in each frame EXPECTED_COLL_NAMES = { diff --git a/python/podio/test_ReaderSio.py b/python/podio/test_ReaderSio.py index d9877e4da..e0d95da69 100644 --- a/python/podio/test_ReaderSio.py +++ b/python/podio/test_ReaderSio.py @@ -4,7 +4,7 @@ import unittest from test_Reader import ReaderTestCaseMixin, LegacyReaderTestCaseMixin -from podio.test_utils import SKIP_SIO_TESTS +from test_utils import SKIP_SIO_TESTS @unittest.skipIf(SKIP_SIO_TESTS, "no SIO support") diff --git a/python/podio/test_utils.py b/python/podio/test_utils.py index efd2d53f4..3fed5959a 100644 --- a/python/podio/test_utils.py +++ b/python/podio/test_utils.py @@ -4,8 +4,8 @@ import os import ROOT -if ROOT.gSystem.Load("libTestDataModelDict.so") >= 0: # noqa: E402 - from ROOT import ExampleHitCollection, ExampleClusterCollection # noqa: E402 # pylint: disable=wrong-import-position +ROOT.gSystem.Load("libTestDataModelDict.so") # noqa: E402 +from ROOT import ExampleHitCollection, ExampleClusterCollection # noqa: E402 # pylint: disable=wrong-import-position from podio import Frame # pylint: disable=wrong-import-position diff --git a/tests/root_io/write_frame_root.py b/tests/root_io/write_frame_root.py index 38bece171..e67a0ffea 100644 --- a/tests/root_io/write_frame_root.py +++ b/tests/root_io/write_frame_root.py @@ -1,7 +1,12 @@ #!/usr/bin/env python3 """Script to write a Frame in ROOT format""" -from podio import test_utils +import os +import sys + +sys.path.append(os.path.join(os.environ.get("PODIO_BASE"), "python", "podio")) + +import test_utils from podio.root_io import Writer test_utils.write_file(Writer, "example_frame_with_py.root")