ray/bazel/python.bzl
Yi Cheng 8ec558dcb9
[core] Reenable GCS test with redis as backend. (#23506)
Since ray supports Redis as a storage backend, we should ensure the code path with Redis as storage is still being covered e2e.

The tests don't run for a while after we switch to memory mode by default. This PR tries to fix this and make it run with every commit.

In the future, if we support more and more storage backends, this should be revised to be more efficient and selective. But now I think the cost should be ok.

This PR is part of GCS HA testing-related work.
2022-05-19 21:46:55 -07:00

49 lines
1.8 KiB
Python

load("@bazel_skylib//lib:paths.bzl", "paths")
# py_test_module_list creates a py_test target for each
# Python file in `files`
def py_test_module_list(files, size, deps, extra_srcs, name_suffix="", **kwargs):
for file in files:
# remove .py
name = paths.split_extension(file)[0] + name_suffix
if name == file:
basename = basename + "_test"
native.py_test(
name = name,
size = size,
main = file,
srcs = extra_srcs + [file],
**kwargs
)
def py_test_run_all_subdirectory(include, exclude, extra_srcs, **kwargs):
for file in native.glob(include = include, exclude = exclude, allow_empty=False):
print(file)
basename = paths.split_extension(file)[0]
if basename == file:
basename = basename + "_test"
native.py_test(
name = basename,
srcs = extra_srcs + [file],
**kwargs
)
# Runs all included notebooks as py_test targets, by first converting them to .py files with "test_myst_doc.py".
def py_test_run_all_notebooks(include, exclude, **kwargs):
for file in native.glob(include = include, exclude = exclude, allow_empty=False):
print(file)
basename = paths.split_extension(file)[0]
if basename == file:
basename = basename + "_test"
native.py_test(
name = basename,
main = "test_myst_doc.py",
srcs = ["//doc:test_myst_doc.py"],
# --find-recursively will look for file in all
# directories inside cwd recursively if it cannot
# find it right away. This allows to deal with
# mismatches between `name` and `data` args.
args = ["--find-recursively", "--path", file],
**kwargs
)