aboutsummaryrefslogtreecommitdiff
path: root/tools/interface_generator/private
diff options
context:
space:
mode:
Diffstat (limited to 'tools/interface_generator/private')
-rw-r--r--tools/interface_generator/private/BUILD.bazel5
-rw-r--r--tools/interface_generator/private/defs.bzl22
-rwxr-xr-xtools/interface_generator/private/pytest_wrapper.py7
3 files changed, 34 insertions, 0 deletions
diff --git a/tools/interface_generator/private/BUILD.bazel b/tools/interface_generator/private/BUILD.bazel
new file mode 100644
index 0000000..46436ee
--- /dev/null
+++ b/tools/interface_generator/private/BUILD.bazel
@@ -0,0 +1,5 @@
+""" targets internal to the tool and rule """
+
+package(default_visibility = ["//:__pkg__"])
+
+exports_files(["pytest_wrapper.py"])
diff --git a/tools/interface_generator/private/defs.bzl b/tools/interface_generator/private/defs.bzl
new file mode 100644
index 0000000..080f19a
--- /dev/null
+++ b/tools/interface_generator/private/defs.bzl
@@ -0,0 +1,22 @@
+load("@pip//:requirements.bzl", "requirement")
+
+def py_pytest(name, srcs, deps = [], **kwargs):
+ native.py_test(
+ name = name,
+ srcs = ["//private:pytest_wrapper.py"],
+ main = "//private:pytest_wrapper.py",
+ data = srcs,
+ args = [
+ "--black",
+ "--pylint",
+ #"--mypy",
+ ] + ["$(location :%s)" % x for x in srcs],
+ deps = [
+ requirement("pytest"),
+ requirement("pytest-black"),
+ requirement("pytest-pylint"),
+ requirement("pytest-mypy"),
+ ] + deps,
+ **kwargs
+ )
+
diff --git a/tools/interface_generator/private/pytest_wrapper.py b/tools/interface_generator/private/pytest_wrapper.py
new file mode 100755
index 0000000..b4def3b
--- /dev/null
+++ b/tools/interface_generator/private/pytest_wrapper.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python3
+
+import sys
+import pytest
+
+if __name__ == "__main__":
+ sys.exit(pytest.main(sys.argv[1:]))