def test_cache_setup_with_no_filters_uses_repo_default_excluded(self, MockSetup): interpreter = PythonInterpreter.get() mock_setup = MockSetup.return_value type(mock_setup).interpreter_requirement = mock.PropertyMock(return_value=None) with temporary_dir() as path: mock_setup.scratch_dir.return_value = path cache = PythonInterpreterCache(mock.MagicMock()) def set_interpreters(_): cache._interpreters.add(interpreter) cache._setup_cached = mock.Mock(side_effect=set_interpreters) self.assertEqual(cache.setup(), [interpreter])
def test_cache_setup_with_no_filters_uses_repo_default_excluded( self, MockSetup): interpreter = PythonInterpreter.get() mock_setup = MockSetup.return_value type(mock_setup).interpreter_requirement = mock.PropertyMock( return_value=None) with temporary_dir() as path: mock_setup.scratch_dir.return_value = path cache = PythonInterpreterCache(mock.MagicMock()) def set_interpreters(_): cache._interpreters.add(interpreter) cache._setup_cached = mock.Mock(side_effect=set_interpreters) self.assertEqual(cache.setup(), [interpreter])
def test_cache_setup_with_filter_overrides_repo_default(self, MockSetup): interpreter = PythonInterpreter.get() mock_setup = MockSetup.return_value # Explicitly set a repo-wide requirement that excludes our one interpreter type(mock_setup).interpreter_requirement = mock.PropertyMock( return_value=self._make_bad_requirement(interpreter.identity.requirement)) with temporary_dir() as path: mock_setup.scratch_dir.return_value = path cache = PythonInterpreterCache(mock.MagicMock()) def set_interpreters(_): cache._interpreters.add(interpreter) cache._setup_cached = mock.Mock(side_effect=set_interpreters) self.assertEqual(cache.setup(filters=(str(interpreter.identity.requirement),)), [interpreter])
def test_cache_setup_with_no_filters_uses_repo_default_excluded(self, MockSetup): # This is the interpreter we'll inject into the cache interpreter = PythonInterpreter.get() mock_setup = MockSetup.return_value # Explicitly set a repo-wide requirement that excludes our one interpreter type(mock_setup).interpreter_requirement = mock.PropertyMock( return_value=self._make_bad_requirement(interpreter.identity.requirement)) with temporary_dir() as path: mock_setup.scratch_dir.return_value = path cache = PythonInterpreterCache(mock.MagicMock()) def set_interpreters(_): cache._interpreters.add(interpreter) cache._setup_cached = mock.Mock(side_effect=set_interpreters) cache._setup_paths = mock.Mock() self.assertEqual(len(cache.setup()), 0)
def test_cache_setup_with_filter_overrides_repo_default(self, MockSetup): interpreter = PythonInterpreter.get() mock_setup = MockSetup.return_value # Explicitly set a repo-wide requirement that excludes our one interpreter type(mock_setup).interpreter_requirement = mock.PropertyMock( return_value=self._make_bad_requirement( interpreter.identity.requirement)) with temporary_dir() as path: mock_setup.scratch_dir.return_value = path cache = PythonInterpreterCache(mock.MagicMock()) def set_interpreters(_): cache._interpreters.add(interpreter) cache._setup_cached = mock.Mock(side_effect=set_interpreters) self.assertEqual( cache.setup(filters=(str(interpreter.identity.requirement), )), [interpreter])
def test_cache_setup_with_no_filters_uses_repo_default_excluded( self, MockSetup): # This is the interpreter we'll inject into the cache interpreter = PythonInterpreter.get() mock_setup = MockSetup.return_value # Explicitly set a repo-wide requirement that excludes our one interpreter type(mock_setup).interpreter_requirement = mock.PropertyMock( return_value=self._make_bad_requirement( interpreter.identity.requirement)) with temporary_dir() as path: mock_setup.scratch_dir.return_value = path cache = PythonInterpreterCache(mock.MagicMock()) def set_interpreters(_): cache._interpreters.add(interpreter) cache._setup_cached = mock.Mock(side_effect=set_interpreters) cache._setup_paths = mock.Mock() self.assertEqual(len(cache.setup()), 0)
def setUp(self): super(TestInterpreterCache, self).setUp() self._interpreter = PythonInterpreter.get()
def setUp(self): super().setUp() self._interpreter = PythonInterpreter.get()
def setUp(self): super(TestInterpreterCache, self).setUp() self._interpreter = PythonInterpreter.get()
def setUp(self): self._interpreter = PythonInterpreter.get()
def setUp(self): self._interpreter = PythonInterpreter.get()