rules_dotnet icon indicating copy to clipboard operation
rules_dotnet copied to clipboard

Allow setting environment variable in csharp_test

Open titusfortner opened this issue 8 months ago • 1 comments

I'm looking to create a set of targets that toggle on a feature. In my test code I have it set to toggle based on the presence of an Environment variable. If you can add an env attribute to pass it in, that would be very helpful.

I'm not certain the right syntax, but based on what I have working in rules_ruby, I think it would look like:

                csharp_test(
                    name = bidi_test_name,
                    srcs = lib_srcs + [src] + ["@rules_dotnet//dotnet/private/rules/common/nunit:shim.cs"],
                    deps = deps + extra_deps,
                    env =  {"WEBDRIVER_BIDI": "true"},
                    target_frameworks = target_frameworks,
                    args = _BROWSERS[browser]["args"] + _HEADLESS_ARGS,
                    data = data + _BROWSERS[browser]["data"],
                    tags = tags + [browser] + COMMON_TAGS + _BROWSERS[browser]["tags"],
                    size = size,
                    **kwargs
                )
                tests.append(bidi_test_name)

titusfortner avatar Jun 06 '24 21:06 titusfortner