File always-use-fully-versioned-python-command-in-tests.patch of Package python-sh

From 94774d2574668aa9f7bc775cc13087a7aed03f12 Mon Sep 17 00:00:00 2001
From: Carl George <carl@george.computer>
Date: Wed, 20 Jun 2018 11:02:01 -0500
Subject: [PATCH] always use fully versioned python command in tests

---
 test.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/test.py b/test.py
index 68ef40c..ef4f589 100644
--- a/test.py
+++ b/test.py
@@ -93,13 +93,13 @@ def append_module_path(env, m):
     ioStringIO = StringIO
     from io import BytesIO as cStringIO
     iocStringIO = cStringIO
-    python = sh.Command(sh.which("python%d.%d" % sys.version_info[:2]))
 else:
     from StringIO import StringIO
     from cStringIO import StringIO as cStringIO
     from io import StringIO as ioStringIO
     from io import BytesIO as iocStringIO
-    python = sh.python
+
+system_python = sh.Command(sh.which("python%d.%d" % sys.version_info[:2]))
 
 THIS_DIR = dirname(os.path.abspath(__file__))
 
@@ -108,7 +108,7 @@ def append_module_path(env, m):
 # module, and not the system one
 baked_env = os.environ.copy()
 append_module_path(baked_env, sh)
-python = python.bake(_env=baked_env)
+python = system_python.bake(_env=baked_env)
 
 
 if hasattr(logging, 'NullHandler'):
@@ -1634,10 +1634,10 @@ def test_cmd_eq(self):
 
     def test_fg(self):
         py = create_tmp_test("exit(0)")
-        # notice we're using `sh.python`, and not `python`.  this is because
+        # notice we're using `system_python`, and not `python`.  this is because
         # `python` has an env baked into it, and we want `_env` to be None for
         # coverage
-        sh.python(py.name, _fg=True)
+        system_python(py.name, _fg=True)
 
     def test_fg_env(self):
         py = create_tmp_test("""
@@ -2058,8 +2058,10 @@ def test_signal_group(self):
 """)
 
         parent = create_tmp_test("""
+import sys
 import sh
-p = sh.python("{child_file}", _bg=True, _new_session=False)
+system_python = sh.Command(sh.which("python%d.%d" % sys.version_info[:2]))
+p = system_python("{child_file}", _bg=True, _new_session=False)
 print(p.pid)
 print(p.process.pgid)
 p.wait()
@@ -2875,11 +2877,11 @@ def test_threaded_with_contexts(self):
         def f1():
             with p1:
                 time.sleep(1)
-                results[0] = str(sh.python("one"))
+                results[0] = str(system_python("one"))
 
         def f2():
             with p2:
-                results[1] = str(sh.python("two"))
+                results[1] = str(system_python("two"))
 
         t1 = threading.Thread(target=f1)
         t1.start()