How to use the virtualenv.interpreters.discovery.py_spec.PythonSpec.from_string_spec function in virtualenv

To help you get started, we’ve selected a few virtualenv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pypa / virtualenv / tests / unit / interpreters / discovery / test_py_spec.py View on Github external
def test_spec_satisfies_arch():
    spec_1 = PythonSpec.from_string_spec("python-32")
    spec_2 = PythonSpec.from_string_spec("python-64")

    assert spec_1.satisfies(spec_1) is True
    assert spec_2.satisfies(spec_1) is False
github pypa / virtualenv / tests / unit / interpreters / discovery / py_info / test_py_info.py View on Github external
def test_satisfy_not_version(spec):
    parsed_spec = PythonSpec.from_string_spec("{}{}".format(CURRENT.implementation, spec))
    matches = CURRENT.satisfies(parsed_spec, True)
    assert matches is False
github pypa / virtualenv / tests / unit / interpreters / discovery / test_py_spec.py View on Github external
def test_bad_py_spec():
    text = "python2.3.4.5"
    spec = PythonSpec.from_string_spec(text)
    assert text in repr(spec)
    assert spec.str_spec == text
    assert spec.path == text
    content = vars(spec)
    del content[str("str_spec")]
    del content[str("path")]
    assert all(v is None for v in content.values())
github pypa / virtualenv / tests / unit / interpreters / discovery / test_py_spec.py View on Github external
def test_spec_satisfies_path_nok(tmp_path):
    spec = PythonSpec.from_string_spec(sys.executable)
    of = PythonSpec.from_string_spec(str(tmp_path))
    assert spec.satisfies(of) is False
github pypa / virtualenv / tests / unit / interpreters / discovery / py_info / test_py_info.py View on Github external
def test_satisfy_not_arch():
    parsed_spec = PythonSpec.from_string_spec(
        "{}-{}".format(CURRENT.implementation, 64 if CURRENT.architecture == 32 else 32)
    )
    matches = CURRENT.satisfies(parsed_spec, True)
    assert matches is False
github pypa / virtualenv / tests / unit / interpreters / discovery / test_py_spec.py View on Github external
def test_spec_satisfies_implementation_ok(req, spec):
    spec_1 = PythonSpec.from_string_spec(req)
    spec_2 = PythonSpec.from_string_spec(spec)
    assert spec_1.satisfies(spec_1) is True
    assert spec_2.satisfies(spec_1) is True
github pypa / virtualenv / tests / unit / interpreters / discovery / test_py_spec.py View on Github external
def test_spec_satisfies_implementation_ok(req, spec):
    spec_1 = PythonSpec.from_string_spec(req)
    spec_2 = PythonSpec.from_string_spec(spec)
    assert spec_1.satisfies(spec_1) is True
    assert spec_2.satisfies(spec_1) is True
github pypa / virtualenv / tests / unit / interpreters / discovery / test_py_spec.py View on Github external
def test_spec_satisfies_path_nok(tmp_path):
    spec = PythonSpec.from_string_spec(sys.executable)
    of = PythonSpec.from_string_spec(str(tmp_path))
    assert spec.satisfies(of) is False
github pypa / virtualenv / tests / unit / interpreters / discovery / test_py_spec.py View on Github external
def test_spec_satisfies_arch():
    spec_1 = PythonSpec.from_string_spec("python-32")
    spec_2 = PythonSpec.from_string_spec("python-64")

    assert spec_1.satisfies(spec_1) is True
    assert spec_2.satisfies(spec_1) is False
github pypa / virtualenv / tests / unit / interpreters / discovery / test_py_spec.py View on Github external
def test_spec_satisfies_implementation_nok():
    spec_1 = PythonSpec.from_string_spec("python")
    spec_2 = PythonSpec.from_string_spec("jython")
    assert spec_2.satisfies(spec_1) is False
    assert spec_1.satisfies(spec_2) is False