|
14 | 14 |
|
15 | 15 | """Tests for grid_builder.""" |
16 | 16 |
|
| 17 | +import mock |
17 | 18 | import unittest |
18 | 19 |
|
19 | 20 | from compatibility_lib import compatibility_store |
|
24 | 25 |
|
25 | 26 | PACKAGE_1 = package.Package("package1") |
26 | 27 | PACKAGE_2 = package.Package("package2") |
| 28 | +PACKAGE_3 = package.Package("package3") |
27 | 29 |
|
28 | 30 |
|
29 | 31 | class TestResultHolder(unittest.TestCase): |
@@ -250,3 +252,38 @@ def test_pairwise_failure(self): |
250 | 252 | grid = grid_builder.GridBuilder(store) |
251 | 253 | html_grid = grid.build_grid([PACKAGE_1, PACKAGE_2]) |
252 | 254 | self.assertIn("Installation failure", html_grid) |
| 255 | + |
| 256 | + def test_not_show_py_ver_incompatible_results(self): |
| 257 | + """CompatibilityResult failure between pair of packages. Do not display |
| 258 | + the packages that are incompatible with a specific Python version. |
| 259 | + """ |
| 260 | + store = fake_compatibility_store.CompatibilityStore() |
| 261 | + store.save_compatibility_statuses([ |
| 262 | + compatibility_store.CompatibilityResult( |
| 263 | + packages=[PACKAGE_1], |
| 264 | + python_major_version=3, |
| 265 | + status=compatibility_store.Status.SUCCESS |
| 266 | + ), |
| 267 | + compatibility_store.CompatibilityResult( |
| 268 | + packages=[PACKAGE_3], |
| 269 | + python_major_version=3, |
| 270 | + status=compatibility_store.Status.INSTALL_ERROR |
| 271 | + ), |
| 272 | + compatibility_store.CompatibilityResult( |
| 273 | + packages=[PACKAGE_1, PACKAGE_3], |
| 274 | + python_major_version=3, |
| 275 | + status=compatibility_store.Status.INSTALL_ERROR, |
| 276 | + details="Installation failure" |
| 277 | + ), |
| 278 | + ]) |
| 279 | + patch = mock.patch( |
| 280 | + 'compatibility_lib.configs.PKG_PY_VERSION_NOT_SUPPORTED', { |
| 281 | + 2: ['package4'], |
| 282 | + 3: ['package3'], |
| 283 | + }) |
| 284 | + |
| 285 | + with patch: |
| 286 | + grid = grid_builder.GridBuilder(store) |
| 287 | + html_grid = grid.build_grid([PACKAGE_1, PACKAGE_2]) |
| 288 | + |
| 289 | + self.assertNotIn("Installation failure", html_grid) |
0 commit comments