Skip to content

Commit

Permalink
Remove test_utils from imported modules
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Sep 15, 2023
1 parent 380c190 commit e94cb78
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
13 changes: 10 additions & 3 deletions python/podio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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",
]
2 changes: 1 addition & 1 deletion python/podio/test_EventStoreSio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion python/podio/test_Frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion python/podio/test_ReaderSio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions python/podio/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 6 additions & 1 deletion tests/root_io/write_frame_root.py
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit e94cb78

Please sign in to comment.