Skip to content

Commit bf2173c

Browse files
committed
wip: analysis tests basic
1 parent 6181509 commit bf2173c

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

python/private/pypi/dependency_specifier_flag.bzl

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def pypa_dep_spec(**kwargs):
8585
"//conditions:default": "",
8686
}),
8787
# todo: copied from pep508_env.bzl
88+
# todo: pep508_env and evaluate have an "aliases" thing that needs
89+
# to be incorporated
8890
# todo: there are many more cpus. Unfortunately, it doesn't look like
8991
# the value is directly accessible to starlark. It might be possible to
9092
# get it via CcToolchain.cpu though.

tests/pypi/pep508/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load(":deps_tests.bzl", "deps_test_suite")
2+
load(":depspec_flag_tests.bzl", "depspec_flag_test_suite")
23
load(":evaluate_tests.bzl", "evaluate_test_suite")
34
load(":requirement_tests.bzl", "requirement_test_suite")
45

@@ -13,3 +14,7 @@ evaluate_test_suite(
1314
requirement_test_suite(
1415
name = "requirement_tests",
1516
)
17+
18+
depspec_flag_test_suite(
19+
name = "depspec_flag_tests",
20+
)
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
load("@rules_testing//lib:test_suite.bzl", "test_suite")
2+
load("//python/private/pypi:pep508_env.bzl", pep508_env = "env") # buildifier: disable=bzl-visibility
3+
load("//python/private/pypi:pep508_evaluate.bzl", "evaluate", "tokenize") # buildifier: disable=bzl-visibility
4+
5+
_tests = []
6+
7+
def test_whatever(name):
8+
def impl(env, target):
9+
# todo: create FeatureFlagInfo subject
10+
actual = target[config_common.FeatureFlagInfo].value
11+
env.expect.that_string(actual).equals("yes")
12+
13+
depspec_flag(
14+
name = name + "_subject",
15+
)
16+
analysis_test(
17+
name = name,
18+
impl = impl,
19+
target = name + "_subject",
20+
config_settings = {
21+
},
22+
)
23+
24+
def depspec_flag_tests(name):
25+
test_suite(
26+
name = name,
27+
tests = _tests,
28+
)

0 commit comments

Comments
 (0)