From 737977f45d4fa5e478aa5ddb78e6a64c0a400468 Mon Sep 17 00:00:00 2001 From: "Jason C. Klima" Date: Sat, 16 May 2026 14:22:33 -0700 Subject: [PATCH 1/2] Initial commit --- .../python/PyRosetta/src/test/T021_Pose_Methods.py | 13 +++++++++++++ .../PyRosetta/src/test/T022_Pose_Alignment.py | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 source/src/python/PyRosetta/src/test/T021_Pose_Methods.py create mode 100644 source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py diff --git a/source/src/python/PyRosetta/src/test/T021_Pose_Methods.py b/source/src/python/PyRosetta/src/test/T021_Pose_Methods.py new file mode 100644 index 00000000000..c0f5156e6a9 --- /dev/null +++ b/source/src/python/PyRosetta/src/test/T021_Pose_Methods.py @@ -0,0 +1,13 @@ +# :noTabs=true: +# (c) Copyright Rosetta Commons Member Institutions. +# (c) This file is part of the Rosetta software suite and is made available under license. +# (c) The Rosetta software is developed by the contributing members of the Rosetta Commons. +# (c) For more information, see http://www.rosettacommons.org. +# (c) Questions about this can be addressed to University of Washington CoMotion, email: license@uw.edu. + +__author__ = "Jason C. Klima" + +from utils.distributed import run_unittest + +if __name__ == "__main__": + run_unittest("pyrosetta.tests.bindings.core.test_pose", timeout=60) diff --git a/source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py b/source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py new file mode 100644 index 00000000000..0fac4583560 --- /dev/null +++ b/source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py @@ -0,0 +1,13 @@ +# :noTabs=true: +# (c) Copyright Rosetta Commons Member Institutions. +# (c) This file is part of the Rosetta software suite and is made available under license. +# (c) The Rosetta software is developed by the contributing members of the Rosetta Commons. +# (c) For more information, see http://www.rosettacommons.org. +# (c) Questions about this can be addressed to University of Washington CoMotion, email: license@uw.edu. + +__author__ = "Jason C. Klima" + +from utils.distributed import run_unittest + +if __name__ == "__main__": + run_unittest("pyrosetta.tests.numeric.test_alignment", timeout=30) From 0cf5cafd81bb20dcb70d1c230245bbd8ad71d0e1 Mon Sep 17 00:00:00 2001 From: "Jason C. Klima" Date: Wed, 20 May 2026 00:10:38 -0700 Subject: [PATCH 2/2] Remove duplicate tests; exit if numpy is not installed --- .../PyRosetta/src/test/T021_Pose_Methods.py | 3 ++- .../PyRosetta/src/test/T022_Pose_Alignment.py | 3 ++- .../PyRosetta/src/test/T900_distributed.py | 2 -- .../PyRosetta/src/test/utils/distributed.py | 22 ++++++++++++++++--- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/source/src/python/PyRosetta/src/test/T021_Pose_Methods.py b/source/src/python/PyRosetta/src/test/T021_Pose_Methods.py index c0f5156e6a9..f5882cb446b 100644 --- a/source/src/python/PyRosetta/src/test/T021_Pose_Methods.py +++ b/source/src/python/PyRosetta/src/test/T021_Pose_Methods.py @@ -7,7 +7,8 @@ __author__ = "Jason C. Klima" -from utils.distributed import run_unittest +from utils.distributed import exit_if_missing_numpy_requirement, run_unittest if __name__ == "__main__": + exit_if_missing_numpy_requirement() run_unittest("pyrosetta.tests.bindings.core.test_pose", timeout=60) diff --git a/source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py b/source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py index 0fac4583560..3005602cfe5 100644 --- a/source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py +++ b/source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py @@ -7,7 +7,8 @@ __author__ = "Jason C. Klima" -from utils.distributed import run_unittest +from utils.distributed import exit_if_missing_numpy_requirement, run_unittest if __name__ == "__main__": + exit_if_missing_numpy_requirement() run_unittest("pyrosetta.tests.numeric.test_alignment", timeout=30) diff --git a/source/src/python/PyRosetta/src/test/T900_distributed.py b/source/src/python/PyRosetta/src/test/T900_distributed.py index 4dd74cd17d6..c80a39eff94 100644 --- a/source/src/python/PyRosetta/src/test/T900_distributed.py +++ b/source/src/python/PyRosetta/src/test/T900_distributed.py @@ -13,13 +13,11 @@ def main(wait: bool, streaming: bool, timeout: int) -> None: run_test_cases( "pyrosetta.tests.bindings.init.test_init_files", - "pyrosetta.tests.bindings.core.test_pose", "pyrosetta.tests.distributed.test_concurrency", "pyrosetta.tests.distributed.test_dask", "pyrosetta.tests.distributed.test_gil", "pyrosetta.tests.distributed.test_smoke", "pyrosetta.tests.distributed.test_viewer", - "pyrosetta.tests.numeric.test_alignment", wait=wait, streaming=streaming, timeout=timeout, diff --git a/source/src/python/PyRosetta/src/test/utils/distributed.py b/source/src/python/PyRosetta/src/test/utils/distributed.py index 304275a4fee..f83fcafa832 100644 --- a/source/src/python/PyRosetta/src/test/utils/distributed.py +++ b/source/src/python/PyRosetta/src/test/utils/distributed.py @@ -24,8 +24,6 @@ Any, Callable, List, - NoReturn, - Optional, TypeVar, cast, ) @@ -62,12 +60,22 @@ def has_pyrosetta_distributed_package_requirements() -> bool: return False +def has_numpy_installed() -> bool: + """Test if `numpy` is installed in the virtual environment.""" + try: + import numpy + return True + except ImportError as ex: + print(f"{type(ex).__name__}: {ex}") + return False + + def has_python_version(major: int, minor: int) -> bool: """Test if the Python version is greater than or equal to the provided `major` and `minor` values.""" return tuple(sys.version_info) >= (major, minor) -def exit_if_missing_pyrosetta_distributed_requirements(returncode: int = 0) -> Optional[NoReturn]: +def exit_if_missing_pyrosetta_distributed_requirements(returncode: int = 0) -> None: """Exit the Python process if the `pyrosetta.distributed` framework requirements are missing from the virtual environment.""" if not has_python_version(3, 6): @@ -81,6 +89,14 @@ def exit_if_missing_pyrosetta_distributed_requirements(returncode: int = 0) -> O sys.exit(returncode) +def exit_if_missing_numpy_requirement(returncode: int = 0) -> None: + """Exit the Python process if `numpy` is missing from the virtual environment.""" + + if not has_numpy_installed(): + print(f"The `numpy` package required for the tests is missing. Skipping the tests...") + sys.exit(returncode) + + def print_environment_export() -> None: """Print the active virtual environment export."""