github.phpd.cn/thought-machine/please@v12.2.0+incompatible/test/python_rules/BUILD (about) 1 # Test for a panic provoked by a python_library using a proto_library as a resource. 2 proto_library( 3 name = 'test_proto', 4 srcs = ['test.proto'], 5 ) 6 7 python_library( 8 name = 'proto_lib', 9 srcs = ['proto_lib.py'], 10 resources = [':test_proto'], 11 ) 12 13 python_test( 14 name = 'proto_test', 15 srcs = ['proto_test.py'], 16 deps = [':proto_lib'], 17 ) 18 19 python_library( 20 name = 'strip_source', 21 srcs = ['strip_source.py'], 22 strip = True, 23 ) 24 25 python_test( 26 name = 'strip_source_test', 27 srcs = ['strip_source_test.py'], 28 labels = ['py3'], 29 deps = [':strip_source'], 30 ) 31 32 # Test that has no actual tests in it. Should still count as a pass. 33 python_test( 34 name = 'empty_test', 35 srcs = ['empty_test.py'], 36 ) 37 38 # Test that the build rules accept a python_binary that has a rule as the main. 39 filegroup( 40 name = 'rule_main', 41 srcs = ['rule_main.py'], 42 ) 43 44 python_binary( 45 name = 'rule_main_pex', 46 main = ':rule_main', 47 ) 48 49 sh_test( 50 name = 'rule_main_test', 51 src = 'rule_main_test.sh', 52 data = [':rule_main_pex'], 53 labels = ['python3'], 54 ) 55 56 # Used to test zip-safety flags. 57 python_test( 58 name = 'zip_unsafe_test', 59 srcs = ['zip_unsafe_test.py'], 60 labels = ['cc'], # Depends on cc rules to build 61 deps = [ 62 '//test/cc_rules/gcc:so_test_py', 63 ], 64 ) 65 66 # Test flags on python_test 67 python_test( 68 name = 'flags_test', 69 srcs = ['flags_test.py'], 70 flags = '--test_flag', 71 ) 72 73 # Tests for a subtle case where python_test rules should get a pex when 74 # specified as data, but not when depending directly. 75 python_binary( 76 name = 'data_dep', 77 main = 'data_dep.py', 78 ) 79 80 python_test( 81 name = 'data_dep_test', 82 srcs = ['data_dep_test.py'], 83 data = [':data_dep'], 84 deps = [':data_dep'], 85 ) 86 87 python_test( 88 name = 'data_dep_only_test', 89 srcs = ['data_dep_only_test.py'], 90 data = [':data_dep'], 91 ) 92 93 python_test( 94 name = 'python2_coverage_test', 95 srcs = ['python_coverage_test.py'], 96 interpreter = 'python2', 97 labels = ['py2'], 98 ) 99 100 python_test( 101 name = 'python3_coverage_test', 102 srcs = ['python_coverage_test.py'], 103 labels = ['py3'], 104 ) 105 106 python_test( 107 name = 'numpy_test', 108 srcs = ['numpy_test.py'], 109 labels = [ 110 'py3', 111 'pip', 112 ], 113 deps = ['//third_party/python:numpy'], 114 ) 115 116 python_test( 117 name = 'tensorflow_test', 118 srcs = ['tensorflow_test.py'], 119 labels = [ 120 'py3', 121 'pip', 122 ], 123 deps = ['//third_party/python:tensorflow'], 124 )