$46 GRAYBYTE WORDPRESS FILE MANAGER $65

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/distutils/tests/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/distutils/tests//test_shell_utils.py
import pytest
import subprocess
import json
import sys

from numpy.distutils import _shell_utils
from numpy.testing import IS_WASM

argv_cases = [
    [r'exe'],
    [r'path/exe'],
    [r'path\exe'],
    [r'\\server\path\exe'],
    [r'path to/exe'],
    [r'path to\exe'],

    [r'exe', '--flag'],
    [r'path/exe', '--flag'],
    [r'path\exe', '--flag'],
    [r'path to/exe', '--flag'],
    [r'path to\exe', '--flag'],

    # flags containing literal quotes in their name
    [r'path to/exe', '--flag-"quoted"'],
    [r'path to\exe', '--flag-"quoted"'],
    [r'path to/exe', '"--flag-quoted"'],
    [r'path to\exe', '"--flag-quoted"'],
]


@pytest.fixture(params=[
    _shell_utils.WindowsParser,
    _shell_utils.PosixParser
])
def Parser(request):
    return request.param


@pytest.fixture
def runner(Parser):
    if Parser != _shell_utils.NativeParser:
        pytest.skip('Unable to run with non-native parser')

    if Parser == _shell_utils.WindowsParser:
        return lambda cmd: subprocess.check_output(cmd)
    elif Parser == _shell_utils.PosixParser:
        # posix has no non-shell string parsing
        return lambda cmd: subprocess.check_output(cmd, shell=True)
    else:
        raise NotImplementedError


@pytest.mark.skipif(IS_WASM, reason="Cannot start subprocess")
@pytest.mark.parametrize('argv', argv_cases)
def test_join_matches_subprocess(Parser, runner, argv):
    """
    Test that join produces strings understood by subprocess
    """
    # invoke python to return its arguments as json
    cmd = [
        sys.executable, '-c',
        'import json, sys; print(json.dumps(sys.argv[1:]))'
    ]
    joined = Parser.join(cmd + argv)
    json_out = runner(joined).decode()
    assert json.loads(json_out) == argv


@pytest.mark.skipif(IS_WASM, reason="Cannot start subprocess")
@pytest.mark.parametrize('argv', argv_cases)
def test_roundtrip(Parser, argv):
    """
    Test that split is the inverse operation of join
    """
    try:
        joined = Parser.join(argv)
        assert argv == Parser.split(joined)
    except NotImplementedError:
        pytest.skip("Not implemented")

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
14 Aug 2025 9.24 PM
root / root
0755
__pycache__
--
14 Aug 2025 9.24 PM
root / root
0755
__init__.py
0 KB
17 Apr 2025 8.10 PM
root / root
0644
test_build_ext.py
2.704 KB
17 Apr 2025 8.10 PM
root / root
0644
test_ccompiler_opt.py
28.104 KB
17 Apr 2025 8.10 PM
root / root
0644
test_ccompiler_opt_conf.py
6.198 KB
17 Apr 2025 8.10 PM
root / root
0644
test_exec_command.py
7.222 KB
17 Apr 2025 8.10 PM
root / root
0644
test_fcompiler.py
1.247 KB
17 Apr 2025 8.10 PM
root / root
0644
test_fcompiler_gnu.py
2.086 KB
17 Apr 2025 8.10 PM
root / root
0644
test_fcompiler_intel.py
1.033 KB
17 Apr 2025 8.10 PM
root / root
0644
test_fcompiler_nagfor.py
1.076 KB
17 Apr 2025 8.10 PM
root / root
0644
test_from_template.py
1.077 KB
17 Apr 2025 8.10 PM
root / root
0644
test_log.py
0.848 KB
17 Apr 2025 8.10 PM
root / root
0644
test_mingw32ccompiler.py
1.571 KB
17 Apr 2025 8.10 PM
root / root
0644
test_misc_util.py
3.143 KB
17 Apr 2025 8.10 PM
root / root
0644
test_npy_pkg_config.py
2.497 KB
17 Apr 2025 8.10 PM
root / root
0644
test_shell_utils.py
2.064 KB
17 Apr 2025 8.10 PM
root / root
0644
test_system_info.py
10.741 KB
17 Apr 2025 8.10 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF