Example #1
0
def subprocess_supports_unicode(suffix):
    """Return True if both the fs and the subprocess module can
    deal with a unicode file name.
    """
    if PY3:
        return True
    sproc = None
    testfn = get_testfn(suffix=suffix)
    try:
        safe_rmpath(testfn)
        create_exe(testfn)
        sproc = spawn_testproc(cmd=[testfn])
    except UnicodeEncodeError:
        return False
    else:
        return True
    finally:
        if sproc is not None:
            terminate(sproc)
        safe_rmpath(testfn)
def try_unicode(suffix):
    """Return True if both the fs and the subprocess module can
    deal with a unicode file name.
    """
    sproc = None
    testfn = get_testfn(suffix=suffix)
    try:
        safe_rmpath(testfn)
        create_exe(testfn)
        sproc = spawn_testproc(cmd=[testfn])
        shutil.copyfile(testfn, testfn + '-2')
        safe_rmpath(testfn + '-2')
    except (UnicodeEncodeError, IOError):
        return False
    else:
        return True
    finally:
        if sproc is not None:
            terminate(sproc)
        safe_rmpath(testfn)
Example #3
0
 def setUpClass(cls):
     cls.pid = spawn_testproc().pid
Example #4
0
 def setUpClass(cls):
     cls.pid = spawn_testproc([PYTHON_EXE, "-E", "-O"],
                              stdin=subprocess.PIPE).pid
Example #5
0
 def setUpClass(cls):
     super().setUpClass()
     cls.subp = spawn_testproc()
     cls.proc = psutil.Process(cls.subp.pid)
     cls.proc.kill()
     cls.proc.wait()