-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathtest_aquery.py
More file actions
181 lines (130 loc) · 4.47 KB
/
Copy pathtest_aquery.py
File metadata and controls
181 lines (130 loc) · 4.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is dual-licensed under either the MIT license found in the
# LICENSE-MIT file in the root directory of this source tree or the Apache
# License, Version 2.0 found in the LICENSE-APACHE file in the root directory
# of this source tree. You may select, at your option, one of the
# above-listed licenses.
# pyre-strict
from buck2.tests.e2e_util.api.buck import Buck
from buck2.tests.e2e_util.buck_workspace import buck_test
from buck2.tests.e2e_util.helper.golden import golden
@buck_test()
async def test_target(buck: Buck) -> None:
stdout = (await buck.aquery("//:test", "-a", "identifier")).stdout
golden(
output=stdout,
rel_path="target.golden.json",
)
@buck_test()
async def test_all_outputs(buck: Buck) -> None:
stdout = (await buck.aquery("all_outputs(//:test)", "-a", "identifier")).stdout
golden(
output=stdout,
rel_path="all_outputs.golden.json",
)
@buck_test()
async def test_all_actions(buck: Buck) -> None:
stdout = (await buck.aquery("all_actions(//:test)", "-a", "identifier")).stdout
golden(
output=stdout,
rel_path="all_actions.golden.json",
)
@buck_test()
async def test_all_outputs_subtarget(buck: Buck) -> None:
stdout = (
await buck.aquery("all_outputs('//:test[sub]')", "-a", "identifier")
).stdout
golden(
output=stdout,
rel_path="all_outputs_subtarget.golden.json",
)
@buck_test()
async def test_filter(buck: Buck) -> None:
stdout = (
await buck.aquery(
"attrfilter('identifier', 'other', all_actions('//:test[sub]'))",
"-a",
"identifier",
)
).stdout
golden(
output=stdout,
rel_path="filter.golden.json",
)
@buck_test()
async def test_deps(buck: Buck) -> None:
stdout = (await buck.aquery("deps(//:test)", "-a", "identifier")).stdout
golden(
output=stdout,
rel_path="deps.golden.json",
)
@buck_test()
async def test_bxl_aquery_target(buck: Buck) -> None:
stdout = (await buck.bxl("//:aquery.bxl:target")).stdout
golden(
output=stdout,
rel_path="bxl_target.golden.json",
)
@buck_test()
async def test_bxl_aquery_all_outputs(buck: Buck) -> None:
stdout = (await buck.bxl("//:aquery.bxl:all_outputs")).stdout
golden(
output=stdout,
rel_path="bxl_all_outputs.golden.json",
)
@buck_test()
async def test_bxl_aquery_all_actions(buck: Buck) -> None:
stdout = (await buck.bxl("//:aquery.bxl:all_actions")).stdout
golden(
output=stdout,
rel_path="bxl_all_actions.golden.json",
)
@buck_test()
async def test_bxl_aquery_all_outputs_subtarget(buck: Buck) -> None:
stdout = (await buck.bxl("//:aquery.bxl:all_outputs_subtarget")).stdout
golden(
output=stdout,
rel_path="bxl_all_outputs_subtarget.golden.json",
)
@buck_test()
async def test_bxl_aquery_attrfilter(buck: Buck) -> None:
stdout = (await buck.bxl("//:aquery.bxl:attrfilter")).stdout
golden(
output=stdout,
rel_path="bxl_filter.golden.json",
)
@buck_test()
async def test_bxl_aquery_deps(buck: Buck) -> None:
stdout = (await buck.bxl("//:aquery.bxl:deps")).stdout
golden(
output=stdout,
rel_path="bxl_deps.golden.json",
)
@buck_test()
async def test_bxl_aquery_eval(buck: Buck) -> None:
stdout = (await buck.bxl("//:aquery.bxl:eval")).stdout
golden(
output=stdout,
rel_path="bxl_eval.golden.json",
)
@buck_test()
async def test_bxl_aquery_action_query_node(buck: Buck) -> None:
await buck.bxl("//:aquery.bxl:action_query_node")
# Tests for bxl.Action support in aquery operations
@buck_test()
async def test_bxl_action_deps_0(buck: Buck) -> None:
"""Test passing a bxl.Action to aquery.deps() with depth=0 returns itself"""
await buck.bxl("//:aquery.bxl:action_deps_0")
@buck_test()
async def test_bxl_action_deps(buck: Buck) -> None:
"""Test that you can isolate the deps of one action by itself"""
await buck.bxl("//:aquery.bxl:action_deps")
@buck_test()
async def test_bxl_atarget_set(buck: Buck) -> None:
"""Test bxl.atarget_set() creates a target set from ActionQueryNodes"""
await buck.bxl("//:aquery.bxl:atarget_set_test")
@buck_test()
async def test_bxl_analysis_label(buck: Buck) -> None:
"""Test analysis.label() returns the configured providers label"""
await buck.bxl("//:aquery.bxl:analysis_label_test")