From cad4a701dbd1fc66ceca02fee6fe246b399c2122 Mon Sep 17 00:00:00 2001 From: Kris Wilson Date: Tue, 11 Jul 2017 17:56:50 -0700 Subject: [PATCH] Improve transitive resolve package checking in tests. (#4738) Problem Currently, tests/python/pants_test/backend/python/tasks2/test_resolve_requirements.py::ResolveRequirementsTest::test_resolve_multiplatform_requirements performs a version-constrained check against an unpinned transitive dependency of CFFI. When new versions of this dep are released on pypi, pants master breaks as seen in https://travis-ci.org/pantsbuild/pants/builds/252126179. Solution Perform a version agnostic check. Result Improved test durability. --- .../python/tasks2/test_resolve_requirements.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/python/pants_test/backend/python/tasks2/test_resolve_requirements.py b/tests/python/pants_test/backend/python/tasks2/test_resolve_requirements.py index c18f93a773f..be62591a4dd 100644 --- a/tests/python/pants_test/backend/python/tasks2/test_resolve_requirements.py +++ b/tests/python/pants_test/backend/python/tasks2/test_resolve_requirements.py @@ -90,7 +90,16 @@ def name_and_platform(whl): # pycparser is a dependency of cffi only on CPython. We might as well check for it, # as extra verification that we correctly fetch transitive dependencies. if PythonInterpreter.get().identity.interpreter == 'CPython': - expected_name_and_platforms.add(('pycparser-2.18', 'any')) + # N.B. Since pycparser is a floating transitive dep of cffi, we do a version-agnostic + # check here to avoid master breakage as new pycparser versions are released on pypi. + self.assertTrue( + any( + (package.startswith('pycparser-') and platform == 'any') + for package, platform + in names_and_platforms + ), + 'could not find pycparser in transitive dependencies!' + ) self.assertTrue(expected_name_and_platforms.issubset(names_and_platforms), '{} is not a subset of {}'.format(expected_name_and_platforms,