Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip tests with extra requirements #26324

Merged
Merged
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
5 changes: 5 additions & 0 deletions tests/colocated_python_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import threading
import time
from typing import Sequence
import unittest

from absl.testing import absltest
from absl.testing import parameterized
Expand All @@ -30,6 +31,10 @@
config.parse_flags_with_absl()
jtu.request_cpu_devices(8)

try:
import cloudpickle # noqa
except (ModuleNotFoundError, ImportError):
raise unittest.SkipTest("tests depend on cloudpickle library")

def _colocated_cpu_devices(
devices: Sequence[jax.Device],
Expand Down
3 changes: 3 additions & 0 deletions tests/export_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def f(a_b_pair, a, b):
exp_f.call((a, b), a=a, b=b))

def test_pytree_namedtuple(self):
if not CAN_SERIALIZE: raise unittest.SkipTest("test requires flatbuffers")
T = collections.namedtuple("SomeType", ("a", "b", "c"))
export.register_namedtuple_serialization(
T,
Expand All @@ -317,6 +318,7 @@ def f(x):
tree_util.tree_structure(res))

def test_pytree_namedtuple_error(self):
if not CAN_SERIALIZE: raise unittest.SkipTest("test requires flatbuffers")
T = collections.namedtuple("SomeType", ("a", "b"))
x = T(a=1, b=2)
with self.assertRaisesRegex(
Expand Down Expand Up @@ -363,6 +365,7 @@ def test_pytree_namedtuple_error(self):
)

def test_pytree_custom_types(self):
if not CAN_SERIALIZE: raise unittest.SkipTest("test requires flatbuffers")
x1 = collections.OrderedDict([("foo", 34), ("baz", 101), ("something", -42)])

@tree_util.register_pytree_node_class
Expand Down
Loading