Skip to content

Commit

Permalink
Make import of test_utils more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Sep 15, 2023
1 parent 6a0b5f2 commit 380c190
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
20 changes: 10 additions & 10 deletions python/podio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
# Check if we can locate the dictionary wthout loading it as this allows us to
# silence any ouptput. If we can find it, we can also safely load it
if ROOT.gSystem.DynamicPathName("libpodioDict.so", True):
ROOT.gSystem.Load("libpodioDict.so")
from ROOT import podio
ROOT.gSystem.Load("libpodioDict.so")
from ROOT import podio

_DYNAMIC_LIBS_LOADED = True
_DYNAMIC_LIBS_LOADED = True

if _DYNAMIC_LIBS_LOADED:
from .frame import Frame
from . import root_io, sio_io, reading
from .test_utils import *
from .frame import Frame
from . import root_io, sio_io, reading
from .test_utils import *

from . import EventStore
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
# Make sure that this module is actually usable as podio even though most of
# it is dynamically populated by cppyy
sys.modules["podio"] = podio
5 changes: 3 additions & 2 deletions python/podio/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

import os
import ROOT
ROOT.gSystem.Load("libTestDataModelDict.so") # noqa: E402
from ROOT import ExampleHitCollection, ExampleClusterCollection # noqa: E402 # pylint: disable=wrong-import-position

if ROOT.gSystem.Load("libTestDataModelDict.so") >= 0: # 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

0 comments on commit 380c190

Please sign in to comment.