Skip to content

Commit

Permalink
Make sure junit_run task only runs on targets that are junit compaible
Browse files Browse the repository at this point in the history
Testing Done:
Two questions:

1. any suggestions on how to write a unit test for the code change? I didn't find unittest for this class.

2. how do I test the changes? Should I just create some dummy BUILD files and only put resources targets into it to make sure they're all filtered out and junit_run does an no-opt?

Thanks for bearing with me.

Bugs closed: 508

Reviewed at https://rbcommons.com/s/twitter/r/924/
  • Loading branch information
Jin Feng authored and ericzundel committed Aug 24, 2014
1 parent fb6c987 commit c5d922c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/python/pants/backend/jvm/tasks/junit_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from pants.util.dirutil import safe_mkdir, safe_open



# TODO(ji): Add unit tests.
# TODO(ji): Add coverage in ci.run (https://github.com/pantsbuild/pants/issues/83)

Expand Down Expand Up @@ -161,6 +160,9 @@ def __init__(self, task_exports, context):
self._opts.extend(context.options.junit_run_arg)

def execute(self, targets):
# filter out non-junit-test targets
targets = list(self._test_target_candidates(targets))

tests = list(self._get_tests_to_run() if self._tests_to_run
else self._calculate_tests_from_targets(targets))
if tests:
Expand Down

0 comments on commit c5d922c

Please sign in to comment.