Skip to content

Commit 1cb0396

Browse files
committed
test: Location expand environment variables
1 parent 3da60a8 commit 1cb0396

File tree

1 file changed

+8
-34
lines changed

1 file changed

+8
-34
lines changed

scala/private/phases/phase_test_environment.bzl

+8-34
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,11 @@
22
# https://bazel.build/rules/lib/testing#TestEnvironment
33

44
def phase_test_environment(ctx, p):
5-
test_env = ctx.attr.env
6-
inherited_environment = ctx.attr.env_inherit
7-
8-
if inherited_environment and test_env:
9-
return struct(
10-
external_providers = {
11-
"TestingEnvironment": testing.TestEnvironment(
12-
test_env,
13-
inherited_environment,
14-
),
15-
},
16-
)
17-
18-
elif test_env:
19-
return struct(
20-
external_providers = {
21-
"TestingEnvironment": testing.TestEnvironment(
22-
test_env,
23-
),
24-
},
25-
)
26-
27-
elif inherited_environment:
28-
return struct(
29-
external_providers = {
30-
"TestingEnvironment": testing.TestEnvironment(
31-
{},
32-
inherited_environment,
33-
),
34-
},
35-
)
36-
37-
else:
38-
return struct()
5+
return struct(
6+
external_providers = {
7+
"TestingEnvironment": testing.TestEnvironment(
8+
{k: ctx.expand_location(v, ctx.attr.data) for k, v in ctx.attr.env.items()},
9+
ctx.attr.env_inherit,
10+
),
11+
},
12+
)

0 commit comments

Comments
 (0)