Skip to content

Commit

Permalink
fix test_platform usages (pantsbuild#9567)
Browse files Browse the repository at this point in the history
[ci skip-rust-tests]
[ci skip-jvm-tests]

### Problem

When I pushed runtime_platform into a mixin, I broke some assumptions that the test_platform supporting code was making. 

### Solution

This fixes it and adds a test to make sure it won't break until it's removed in 1.28.

### Result

Using test_platform continues to work.
  • Loading branch information
baroquebobcat authored Apr 23, 2020
1 parent a19ead1 commit 3bbb27a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/python/pants/backend/jvm/targets/junit_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def __init__(
raise TargetDefinitionException(
self, "Cannot specify runtime_platform and test_platform together."
)
if "test_platform" in kwargs and "runtime_platform" not in kwargs:
kwargs["runtime_platform"] = kwargs["test_platform"]
if "test_platform" in kwargs and not runtime_platform:
runtime_platform = kwargs["test_platform"]
del kwargs["test_platform"]

payload.add_fields(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def test_implicit_junit_dep(self):
sorted(str(x) for x in test2.dependencies),
)

def test_test_platform_sets_runtime_platform(self):
init_subsystem(JUnit)
target = self.make_target("//:test1", JUnitTests, sources=[], test_platform="b")
assert target.payload.runtime_platform == "b"

def test_runtime_and_test_platform_error(self):
with self.assertRaisesWithMessage(
TargetDefinitionException,
Expand Down

0 comments on commit 3bbb27a

Please sign in to comment.