Skip to content

Commit

Permalink
Remove no-longer necessary test-skips
Browse files Browse the repository at this point in the history
These skips were transitionally necessary, but the underlying imports and
expectations are now stabilized.

Fix one test-bug while were (skipping the assertion!)
  • Loading branch information
khk-globus committed Dec 9, 2024
1 parent b1a47f3 commit 44d7637
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 48 deletions.
33 changes: 14 additions & 19 deletions smoke_tests/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,32 +136,27 @@ def _add_args_for_client_creds_login(api_client_id, api_client_secret, client_ar
funcx_authorizer = AccessTokenAuthorizer(funcx_token)
auth_authorizer = AccessTokenAuthorizer(auth_token)

try:
from globus_compute_sdk.sdk.login_manager import LoginManagerProtocol
except ImportError:
client_args["fx_authorizer"] = funcx_authorizer
client_args["openid_authorizer"] = auth_authorizer
else:
from globus_compute_sdk.sdk.login_manager import LoginManagerProtocol

class TestsuiteLoginManager:
def ensure_logged_in(self) -> None:
pass
class TestsuiteLoginManager:
def ensure_logged_in(self) -> None:
pass

def logout(self) -> None:
pass
def logout(self) -> None:
pass

def get_auth_client(self) -> AuthClient:
return AuthClient(authorizer=auth_authorizer)
def get_auth_client(self) -> AuthClient:
return AuthClient(authorizer=auth_authorizer)

def get_web_client(self, *, base_url: str | None = None) -> WebClient:
return WebClient(base_url=base_url, authorizer=funcx_authorizer)
def get_web_client(self, *, base_url: str | None = None) -> WebClient:
return WebClient(base_url=base_url, authorizer=funcx_authorizer)

login_manager = TestsuiteLoginManager()
login_manager = TestsuiteLoginManager()

# check runtime-checkable protocol
assert isinstance(login_manager, LoginManagerProtocol)
# check runtime-checkable protocol
assert isinstance(login_manager, LoginManagerProtocol)

client_args["login_manager"] = login_manager
client_args["login_manager"] = login_manager


@pytest.fixture(scope="session")
Expand Down
19 changes: 2 additions & 17 deletions smoke_tests/tests/test_running_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@
import typing as t

import globus_compute_sdk as gc
import pytest
from globus_compute_sdk import Client, Executor
from globus_compute_sdk.errors import TaskPending
from packaging.version import Version

try:
from globus_compute_sdk.errors import TaskPending
except ImportError:
from globus_compute_sdk.utils.errors import TaskPending

sdk_version = Version(gc.version.__version__)


Expand All @@ -33,7 +28,6 @@ def ohai():
return "ohai"


@pytest.mark.skipif(sdk_version.release < (2, 2, 5), reason="batch.add iface updated")
def test_batch(compute_client: Client, endpoint: str, linear_backoff: t.Callable):
"""Test batch submission and get_batch_result"""

Expand Down Expand Up @@ -77,19 +71,10 @@ def test_wait_on_new_hello_world_func(

def test_executor(compute_client, endpoint, tutorial_function_id, timeout_s: int):
"""Test using Executor to retrieve results."""
res = compute_client.web_client.get_version()
assert res.http_status == 200, f"Received {res.http_status} instead!"

num_tasks = 10
submit_count = 2 # we've had at least one bug that prevented executor re-use

# use client on newer versions and funcx_client on older
try:
gce = Executor(endpoint_id=endpoint, client=compute_client)
except TypeError:
gce = Executor(endpoint_id=endpoint, funcx_client=compute_client)

with gce:
with Executor(endpoint_id=endpoint, client=compute_client) as gce:
for _ in range(submit_count):
futures = [
gce.submit_to_registered_function(tutorial_function_id)
Expand Down
15 changes: 3 additions & 12 deletions smoke_tests/tests/test_s3_indirect.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import pytest

try:
from globus_compute_sdk.errors import TaskExecutionFailed

has_task_exec_error_type = True
except ImportError:
has_task_exec_error_type = False
from globus_compute_sdk.errors import TaskExecutionFailed


def large_result_producer(size: int) -> str:
Expand All @@ -25,9 +19,6 @@ def test_allowed_result_sizes(submit_function_and_get_result, endpoint, size):
assert len(r.result) == size


@pytest.mark.skipif(
not has_task_exec_error_type, reason="Test requires newer execution exception type"
)
def test_result_size_too_large(submit_function_and_get_result, endpoint):
"""
Globus Compute should raise a MaxResultSizeExceeded exception when results exceeds
Expand All @@ -38,8 +29,8 @@ def test_result_size_too_large(submit_function_and_get_result, endpoint):
submit_function_and_get_result(
endpoint, func=large_result_producer, func_args=(11 * 1024 * 1024,)
)
# ...so unwrap the exception to verify that it's the right type
assert "MaxResultSizeExceeded" in excinfo.value.remote_data
# ...so unwrap the exception to verify that it's the right type
assert "MaxResultSizeExceeded" in excinfo.value.remote_data


@pytest.mark.parametrize("size", [200, 2000, 20000, 200000])
Expand Down

0 comments on commit 44d7637

Please sign in to comment.