Improve support for splitting some

This commit is contained in:
Reid 'arrdem' McKenzie 2021-08-03 20:02:50 -06:00
parent d51eb85fa1
commit 4e35261dd1

View file

@ -148,8 +148,10 @@ py_resources = rule(
def py_project(name=None, def py_project(name=None,
lib_srcs=None, lib_srcs=None,
lib_deps=None, lib_deps=None,
lib_data=None,
test_srcs=None, test_srcs=None,
test_deps=None): test_deps=None,
test_data=None):
""" """
A helper for defining conventionally-formatted python project. A helper for defining conventionally-formatted python project.
@ -167,14 +169,19 @@ def py_project(name=None,
name=name, name=name,
srcs=lib_srcs, srcs=lib_srcs,
deps=lib_deps, deps=lib_deps,
data=lib_data,
imports=["src/python"], imports=["src/python"],
visibility = [
"//visibility:public",
],
) )
for src in test_srcs: for src in test_srcs:
if "test_" in src: if "test_" in src:
py_pytest( py_pytest(
name=name + ".test." + str(hash(src)).replace("-", "") + "." + src.split("/")[-1], name=name + ".test." + str(hash(src)).replace("-", "") + "." + src.split("/")[-1],
srcs=test_srcs, srcs=[src] + [f for f in test_srcs if "test_" not in f],
deps=[name] + test_deps, deps=[name] + (test_deps or []),
data=test_data,
imports=["test/python"], imports=["test/python"],
) )