From 2882042811bf4c3ed969f4d44149a07195cbca9e Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Mon, 8 Apr 2019 15:52:16 +0800 Subject: [PATCH] Fix mock --- tests/unit/test_unit_outdated.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/unit/test_unit_outdated.py b/tests/unit/test_unit_outdated.py index 0696b71c7a4..9d46ac41c84 100644 --- a/tests/unit/test_unit_outdated.py +++ b/tests/unit/test_unit_outdated.py @@ -1,4 +1,3 @@ -import collections import datetime import os import sys @@ -13,6 +12,14 @@ from pip._internal.utils import outdated +class MockFoundCandidates(object): + def __init__(self, best): + self._best = best + + def get_best(self): + return self._best + + class MockPackageFinder(object): BASE_URL = 'https://pypi.org/simple/pip-{0}.tar.gz' @@ -29,10 +36,8 @@ class MockPackageFinder(object): def __init__(self, *args, **kwargs): pass - def find_candidates(self, project_name, specifier): - return collections.namedtuple("FoundCandidates", "best")( - best=self.INSTALLATION_CANDIDATES[0], - ) + def find_candidates(self, project_name): + return MockFoundCandidates(self.INSTALLATION_CANDIDATES[0]) class MockDistribution(object):