Previously the c++ compiler was resolved in the constructor. Doing this
work in the constructor made every indirect user pay the price with the
concrete example being the test_cpp_toolchain.py unit tests which would
fail if run without CXX exported.
Also, only the compiler tool was cached, other tool lookups via
register_tool populated but did not use the cache. Fixup register_tool
to fully self-contain its caching behavior.
Finally, fixup test_cpp_toolchain.py to be unit-friendly and run in the
absence of CXX being exported and also tighten up
test_cpp_integration.py exception trapping.
contrib/cpp/src/python/pants/contrib/cpp/toolchain/cpp_toolchain.py | 41 +++++++++++++++++++++++------------------
contrib/cpp/tests/python/pants_test/contrib/cpp/test_cpp_integration.py | 6 +++---
contrib/cpp/tests/python/pants_test/contrib/cpp/test_cpp_toolchain.py | 40 +++++++++++++++++++++++-----------------
3 files changed, 49 insertions(+), 38 deletions(-)
Previously this failed but now passes:
$ PANTS_DEV=1 ./pants test contrib/cpp/::
And this still works, with no skips:
$ CXX=g++ PANTS_DEV=1 ./pants test contrib/cpp/::
CI went green here:
can this overwrite tools now? maybe it's worth erroring if we already have a tool with 'name' in the cache.
pulling the basename out of the path is harder to reason about than just using 'good-tool' directly.
Review request changed
Also rename TestCppToolchainTest CppToolchainTest to fit standard test
naming in pants (which unlike src naming does not mirror filenames and
contrib/cpp/tests/python/pants_test/contrib/cpp/test_cpp_toolchain.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-) --publish