-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge GH-365/emcee-submit into test/willard
- Loading branch information
Showing
6 changed files
with
96 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
flepimop/gempyor_pkg/tests/info/test__infer_cluster_from_fqdn.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
||
from gempyor.info import _infer_cluster_from_fqdn | ||
|
||
|
||
@pytest.mark.parametrize("fqdn", ("new.cluster.com", "unsupported.cluster")) | ||
def test_no_matching_fqdn_found_value_error(fqdn: str) -> None: | ||
def socket_fqdn_wraps() -> str: | ||
return fqdn | ||
|
||
with patch("gempyor.info.getfqdn", wraps=socket_fqdn_wraps) as socket_fqdn_patch: | ||
with pytest.raises( | ||
ValueError, | ||
match=f"^The fqdn, '{fqdn}', does not match any of the expected clusters.$", | ||
): | ||
_infer_cluster_from_fqdn() | ||
socket_fqdn_patch.assert_called_once() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("fqdn", "expected"), | ||
( | ||
("login01.cm.cluster", "rockfish"), | ||
("login3.cm.cluster", "rockfish"), | ||
("longleaf-login1.its.unc.edu", "longleaf"), | ||
("longleaf-login07.its.unc.edu", "longleaf"), | ||
), | ||
) | ||
def test_exact_results_for_select_values(fqdn: str, expected: str) -> None: | ||
def socket_fqdn_wraps() -> str: | ||
return fqdn | ||
|
||
with patch("gempyor.info.getfqdn", wraps=socket_fqdn_wraps) as socket_fqdn_patch: | ||
assert _infer_cluster_from_fqdn() == expected | ||
socket_fqdn_patch.assert_called_once() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters