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..f5882cb446b --- /dev/null +++ b/source/src/python/PyRosetta/src/test/T021_Pose_Methods.py @@ -0,0 +1,14 @@ +# :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 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 new file mode 100644 index 00000000000..3005602cfe5 --- /dev/null +++ b/source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py @@ -0,0 +1,14 @@ +# :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 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."""