Skip to content

Commit

Permalink
Fixup test_test_builder.py interpreter caching.
Browse files Browse the repository at this point in the history
Comparing PythonInterpeters directly is currently broken for systems
that have atime turned on for the filesystem hosting the python binary.
This localizes the 'correct' equality check proposed in:
  https://rbcommons.com/s/twitter/r/1477/

Testing Done:
The same change was tested against OSX here: https://travis-ci.org/pantsbuild/pants-for-travis-osx-ci/builds/43799766

This change went green against linux CI here: https://travis-ci.org/pantsbuild/pants/builds/43803116

Bugs closed: 865

Reviewed at https://rbcommons.com/s/twitter/r/1478/
  • Loading branch information
jsirois committed Dec 12, 2014
1 parent 7488e1e commit 1c9f744
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/python/pants_test/backend/python/test_test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ def _cache_current_interpreter(self):
# We only need to cache the current interpreter, avoid caching for every interpreter on the
# PATH.
current_interpreter = PythonInterpreter.get()
current_id = (current_interpreter.binary, current_interpreter.identity)
for cached_interpreter in cache.setup(filters=[current_interpreter.identity.requirement]):
if cached_interpreter == current_interpreter:
# TODO(John Sirois): Revert to directly comparing interpreters when
# https://github.com/pantsbuild/pex/pull/31 is in, released and consumed by pants.
if (cached_interpreter.binary, cached_interpreter.identity) == current_id:
return cached_interpreter
raise RuntimeError('Could not find suitable interpreter to run tests.')

Expand Down

0 comments on commit 1c9f744

Please sign in to comment.