1load("@rules_python//python:py_library.bzl", "py_library") 2load("@rules_python//python:py_test.bzl", "py_test") 3load("@rules_python//python:py_binary.bzl", "py_binary") 4 5licenses(["notice"]) 6 7py_library( 8 name = "app", 9 srcs = [ 10 "app.py", 11 ], 12 srcs_version = "PY2AND3", 13 visibility = ["//visibility:public"], 14 deps = [ 15 ":command_name", 16 "//absl/flags", 17 "//absl/logging", 18 ], 19) 20 21py_library( 22 name = "command_name", 23 srcs = ["command_name.py"], 24 srcs_version = "PY2AND3", 25 visibility = ["//visibility:public"], 26) 27 28py_library( 29 name = "tests/app_test_helper", 30 testonly = 1, 31 srcs = ["tests/app_test_helper.py"], 32 srcs_version = "PY2AND3", 33 deps = [ 34 ":app", 35 "//absl/flags", 36 ], 37) 38 39py_binary( 40 name = "tests/app_test_helper_pure_python", 41 testonly = 1, 42 srcs = ["tests/app_test_helper.py"], 43 main = "tests/app_test_helper.py", 44 python_version = "PY3", 45 srcs_version = "PY3", 46 deps = [ 47 ":app", 48 "//absl/flags", 49 ], 50) 51 52py_test( 53 name = "tests/app_test", 54 srcs = ["tests/app_test.py"], 55 data = [":tests/app_test_helper_pure_python"], 56 python_version = "PY3", 57 srcs_version = "PY3", 58 deps = [ 59 ":app", 60 ":tests/app_test_helper", 61 "//absl/flags", 62 "//absl/testing:_bazelize_command", 63 "//absl/testing:absltest", 64 "//absl/testing:flagsaver", 65 ], 66) 67 68py_test( 69 name = "tests/command_name_test", 70 srcs = ["tests/command_name_test.py"], 71 python_version = "PY3", 72 srcs_version = "PY3", 73 deps = [ 74 ":command_name", 75 "//absl/testing:absltest", 76 ], 77) 78 79py_test( 80 name = "tests/python_version_test", 81 srcs = ["tests/python_version_test.py"], 82 python_version = "PY3", 83 srcs_version = "PY3", 84 deps = [ 85 "//absl/flags", 86 "//absl/testing:absltest", 87 ], 88) 89