Skip to content

Commit

Permalink
test geant4-config wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed Dec 1, 2023
1 parent 2314976 commit 0f7e900
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/geant4_python_application/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ def install_datasets(always: bool = False) -> None:
Application,
PrimaryGeneratorAction,
StackingAction,
__awkward_version__,
__doc__,
__geant4_version__,
__pybind11_version__,
__version__,
)
from geant4_python_application.gdml import basic_gdml
Expand All @@ -88,6 +90,8 @@ def install_datasets(always: bool = False) -> None:
"__doc__",
"__version__",
"__geant4_version__",
"__awkward_version__",
"__pybind11_version__",
"Application",
"PrimaryGeneratorAction",
"StackingAction",
Expand Down
2 changes: 2 additions & 0 deletions src/python/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ PYBIND11_MODULE(_core, m) {
m.attr("__version__") = "dev";
#endif
m.attr("__geant4_version__") = MACRO_STRINGIFY(GEANT4_VERSION);
m.attr("__awkward_version__") = MACRO_STRINGIFY(AWKWARD_VERSION);
m.attr("__pybind11_version__") = MACRO_STRINGIFY(PYBIND11_VERSION);
}
23 changes: 23 additions & 0 deletions tests/test_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from __future__ import annotations

import pathlib

import geant4_python_application


def test_versions():
awkward_version = geant4_python_application.__awkward_version__
assert awkward_version
pybind11_version = geant4_python_application.__pybind11_version__
assert pybind11_version
geant4_version = geant4_python_application.__geant4_version__
assert geant4_version


def test_geant4_config():
geant4_config = pathlib.Path(geant4_python_application.geant4_config)
assert geant4_config.exists()
assert geant4_config.is_file()

geant4_python_application.check_datasets()
geant4_python_application.install_datasets()

0 comments on commit 0f7e900

Please sign in to comment.