Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions source/src/python/PyRosetta/src/test/T021_Pose_Methods.py
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 14 additions & 0 deletions source/src/python/PyRosetta/src/test/T022_Pose_Alignment.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 0 additions & 2 deletions source/src/python/PyRosetta/src/test/T900_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
22 changes: 19 additions & 3 deletions source/src/python/PyRosetta/src/test/utils/distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
Any,
Callable,
List,
NoReturn,
Optional,
TypeVar,
cast,
)
Expand Down Expand Up @@ -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):
Expand All @@ -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."""

Expand Down