Fix distribution tests in the face of many javas.

Review Request #3778 — Created April 28, 2016 and submitted — Latest diff uploaded

jsirois
pants
jsirois/distribution/fix_tests/distribution_environment
2894, 3296
095cdfa...
pants-reviews
gmalmquist, patricklaw, peiyu, stuhood, zundel
Previously, the distribution test failed on machine with multiple java
distributions installed.  This change re-factors `DistributionLocator`
into a thin factory class that produces a `_Locator` from option values.
This results in a more easily testable system.

 src/python/pants/java/distribution/distribution.py                         | 442 ++++++++++++++++++++++++++++++--------------------
 tests/python/pants_test/backend/jvm/tasks/test_junit_run_integration.py    |   2 +-
 tests/python/pants_test/java/distribution/test_distribution.py             | 277 ++++++++++---------------------
 tests/python/pants_test/java/distribution/test_distribution_integration.py |  98 ++++++-----
 4 files changed, 406 insertions(+), 413 deletions(-)

In the context of my machine, which has:

$ archlinux-java status
Available Java environments:
  java-6-jdk
  java-7-jdk
  java-7-openjdk
  java-8-jdk
  java-8-openjdk (default)
  java-9-jdk

Previously failed quite solidly:

./pants test.pytest --no-timeouts tests/python/pants_test/java/distribution/::
...
 ===== 17 failed, 43 passed in 83.05 seconds ======
...

Now green.

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/127109011

Loading...