File: test_cmdline.py

package info (click to toggle)
mozjs52 52.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 250,248 kB
  • sloc: cpp: 818,254; ansic: 278,823; python: 205,544; sh: 27,794; asm: 13,536; makefile: 10,661; perl: 7,438; xml: 2,812; java: 1,421; exp: 499; lisp: 258; objc: 234; csh: 17; sed: 17
file content (44 lines) | stat: -rw-r--r-- 1,389 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import sys
import subprocess
import virtualenv
import pytest

VIRTUALENV_SCRIPT = virtualenv.__file__

def test_commandline_basic(tmpdir):
    """Simple command line usage should work"""
    subprocess.check_call([
        sys.executable,
        VIRTUALENV_SCRIPT,
        str(tmpdir.join('venv'))
    ])

def test_commandline_explicit_interp(tmpdir):
    """Specifying the Python interpreter should work"""
    subprocess.check_call([
        sys.executable,
        VIRTUALENV_SCRIPT,
        '-p', sys.executable,
        str(tmpdir.join('venv'))
    ])

# The registry lookups to support the abbreviated "-p 3.5" form of specifying
# a Python interpreter on Windows don't seem to work with Python 3.5. The
# registry layout is not well documented, and it's not clear that the feature
# is sufficiently widely used to be worth fixing.
# See https://github.com/pypa/virtualenv/issues/864
@pytest.mark.skipif("sys.platform == 'win32' and sys.version_info[:2] >= (3,5)")
def test_commandline_abbrev_interp(tmpdir):
    """Specifying abbreviated forms of the Python interpreter should work"""
    if sys.platform == 'win32':
        fmt = '%s.%s'
    else:
        fmt = 'python%s.%s'
    abbrev = fmt % (sys.version_info[0], sys.version_info[1])
    subprocess.check_call([
        sys.executable,
        VIRTUALENV_SCRIPT,
        '-p', abbrev,
        str(tmpdir.join('venv'))
    ])