Commits

Anonymous committed 03e7cd3

create a test for sudo popen

  • Participants
  • Parent commits e047a94

Comments (0)

Files changed (1)

File testing/test_xspec.py

 import pytest, py
 import execnet
-from execnet.gateway_io import ssh_args
+from execnet.gateway_io import ssh_args, popen_args
 
 XSpec = execnet.XSpec
 
         assert ssh_args(spec)[:6] == [
             "ssh", "-C", "-F", spec.ssh_config, "-p", "22100"]
 
+    def test_popen_with_sudo_python(self):
+        spec = XSpec("popen//python=sudo python3")
+        assert popen_args(spec) == [
+            'sudo', 'python3', '-u', '-c',
+            'import sys;exec(eval(sys.stdin.readline()))'
+        ]
+
     def test_env(self):
         xspec = XSpec("popen//env:NAME=value1")
         assert xspec.env['NAME'] == "value1"