Skip to content

Commit

Permalink
Keep test_utils in podio module to make tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Sep 15, 2023
1 parent 3632f0a commit f1b6bee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 8 additions & 0 deletions python/podio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions tests/root_io/write_frame_root.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit f1b6bee

Please sign in to comment.