Skip to content

Commit bda07f7

Browse files
committed
expand testing a bit
1 parent 77decbc commit bda07f7

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

tests/pypi/pep508/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ requirement_test_suite(
1515
name = "requirement_tests",
1616
)
1717

18+
# todo: move to subdir; it generates many test targets
1819
depspec_flag_test_suite(
1920
name = "depspec_flag_tests",
2021
)

tests/pypi/pep508/depspec_flag_tests.bzl

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,26 @@ _tests = []
1010

1111
def _test_expr(name):
1212
def impl(env, target):
13-
attrs = target[TestingAspectInfo].attrs
14-
1513
# todo: create FeatureFlagInfo subject
16-
actual = target[config_common.FeatureFlagInfo].value
1714
env.expect.where(
18-
expression = attrs.expression,
19-
).that_str(actual).equals("yes")
15+
expression = target[TestingAspectInfo].attrs.expression,
16+
).that_str(
17+
target[config_common.FeatureFlagInfo].value,
18+
).equals(
19+
env.ctx.attr.expected,
20+
)
2021

2122
cases = {
2223
"python_version_gte": {
2324
"expression": "python_version >= '3.12.0'",
25+
"expected": "yes",
26+
"config_settings": {
27+
PYTHON_VERSION: "3.12.0",
28+
},
29+
},
30+
"python_full_version_lt_negative": {
31+
"expression": "python_full_version < '3.8'",
32+
"expected": "no",
2433
"config_settings": {
2534
PYTHON_VERSION: "3.12.0",
2635
},
@@ -40,6 +49,12 @@ def _test_expr(name):
4049
impl = impl,
4150
target = test_name + "_subject",
4251
config_settings = case["config_settings"],
52+
attr_values = {
53+
"expected": case["expected"],
54+
},
55+
attrs = {
56+
"expected": attr.string(),
57+
},
4358
)
4459
native.test_suite(
4560
name = name,

0 commit comments

Comments
 (0)