From 3fedf9e618cbce3dbdd00559b2de0bb8e2d43171 Mon Sep 17 00:00:00 2001 From: Luis Fernando Pino Duque Date: Thu, 28 Apr 2016 15:47:29 +0000 Subject: Inject the Constants.TOOLS_REPOSITORY in SkylarkRuleClassFunctions.testBaseRule via the Skylark and delete the constant. Also, change the isLoadingPhase in the Skylark environment an enum Phase in order to: - Decide whether testRules are enabled or not and, - Check that the toolsRepository is set when in the LOADING phase. Finally, a few tests that were using ConfiguredRuleClassProvider directly had to be updated to set a tools repository, otherwise createGlobals() fails. -- MOS_MIGRATED_REVID=121022804 --- .../com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/test/java/com/google/devtools/build/lib/skylark') diff --git a/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java b/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java index 01af86f231..c19af161a0 100644 --- a/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/skylark/util/SkylarkTestCase.java @@ -28,8 +28,10 @@ import com.google.devtools.build.lib.rules.SkylarkModules; import com.google.devtools.build.lib.rules.SkylarkRuleContext; import com.google.devtools.build.lib.rules.SkylarkRuleContext.Kind; import com.google.devtools.build.lib.syntax.Environment; +import com.google.devtools.build.lib.syntax.Environment.Phase; import com.google.devtools.build.lib.syntax.EvalException; import com.google.devtools.build.lib.syntax.util.EvaluationTestCase; +import com.google.devtools.build.lib.testutil.TestConstants; import org.junit.Before; @@ -55,7 +57,8 @@ public abstract class SkylarkTestCase extends BuildViewTestCase { .setSkylark() .setEventHandler(getEventHandler()) .setGlobals(SkylarkModules.getGlobals(SkylarkModules.MODULES)) - .setLoadingPhase() + .setToolsRepository(TestConstants.TOOLS_REPOSITORY) + .setPhase(Phase.LOADING) .build() .setupDynamic( PackageFactory.PKG_CONTEXT, -- cgit v1.2.3