File pip_no_plugins.patch of Package python-straight-plugin
From fbe969310abfb0294313372da20a4b7dc99ea0a8 Mon Sep 17 00:00:00 2001
From: Lars van de Kerkhof <lars@permanentmarkers.nl>
Date: Thu, 28 Jun 2018 15:40:39 +0200
Subject: [PATCH 1/3] Fixes pip with no plugins installed.
---
straight/plugin/manager.py | 2 +-
tests.py | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
--- a/straight/plugin/manager.py
+++ b/straight/plugin/manager.py
@@ -50,7 +50,7 @@ class PluginManager(object):
Useful to utilize plugins as sets of filters.
"""
-
+ r = first_arg
for plugin in self._plugins:
method = getattr(plugin, methodname, None)
if method is None:
--- a/tests.py
+++ b/tests.py
@@ -257,9 +257,12 @@ class PluginManagerTestCase(unittest.Tes
return x + 1
self.m._plugins[0].x.side_effect = plus_one
self.m._plugins[1].x.side_effect = plus_one
-
self.assertEqual(3, self.m.pipe('x', 1))
+ def test_pipe_no_plugins_found(self):
+ no_plugins = manager.PluginManager([])
+ self.assertEqual(1, no_plugins.pipe('x', 1))
+
def test_call(self):
results = self.m.call('x', 1)
self.assertTrue(self.m._plugins[0].called_with('a'))