Skip to content

Commit

Permalink
Skip the full file check if the rntuple file has not been produced (#369
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tmadlener authored Sep 17, 2024
1 parent 109fc7b commit 76ae71f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ set_tests_properties(
check_complete_file_rntuple
PROPERTIES
DEPENDS create_complete_file_rntuple
SKIP_REGULAR_EXPRESSION "collected 0 items / 1 skipped"
)

set_tests_properties(
Expand Down
10 changes: 10 additions & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
#!/usr/bin/env python3
"""pytest config module to make passing of input file name possible"""

"""The pytest options after configuration"""
options = None


def pytest_addoption(parser):
"""Hook to add an inputfile argument to pytest for checking EDM4hep file
contents"""
parser.addoption("--inputfile", action="store")


def pytest_configure(config):
"""This is a slighty hacky solution to make the pytest configuration
available in test modules outside of fixtures"""
global options
options = config.option
10 changes: 10 additions & 0 deletions test/test_EDM4hepFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,26 @@
created by scripts/createEDM4hepFile.py has the expected contents
"""

import os
import podio
import edm4hep
import pytest
from itertools import count

from conftest import options

# For now simply copy these from createEDM4hepFile.py
FRAMES = 3
VECTORSIZE = 5
COUNT_START = 42 # Starting point for the counters

# Skip the test if an rntuple file has not been produced
if "rntuple" in options.inputfile and not os.path.isfile(options.inputfile):
pytest.skip(
"Skipping rntuple reading tests, because input is not produced",
allow_module_level=True,
)


@pytest.fixture(scope="module")
def inputfile_name(pytestconfig):
Expand Down

0 comments on commit 76ae71f

Please sign in to comment.