How to use the pythonfinder.models.python.PythonVersion function in pythonfinder

To help you get started, we’ve selected a few pythonfinder 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 sarugaku / pythonfinder / tests / test_python.py View on Github external
def test_python_versions(monkeypatch, special_character_python):
    def mock_version(*args, **kwargs):
        version_output = "2.7.15+ (default, Jun 28 2018, 13:15:42)\n[GCC 7.2.0]"

        class FakeObj(object):
            def __init__(self, out):
                self.out = out

        c = FakeObj(version_output.split()[0])
        return c

    os.environ["PYTHONFINDER_IGNORE_UNSUPPORTED"] = str("1")
    with monkeypatch.context() as m:
        m.setattr("vistir.misc.run", mock_version)
        parsed = pythonfinder.models.python.PythonVersion.from_path(
            special_character_python.strpath
        )
        assert isinstance(parsed.version, Version)
github sarugaku / pythonfinder / tests / test_python.py View on Github external
def test_python_version_output_variants(monkeypatch, path, version_output, version):
    def mock_version(*args, **kwargs):
        class FakeObj(object):
            def __init__(self, out):
                self.out = out

        c = FakeObj(version_output.split()[0])
        return c

    with monkeypatch.context() as m:
        os.environ["PYTHONFINDER_IGNORE_UNSUPPORTED"] = str("1")
        m.setattr("vistir.misc.run", mock_version)
        parsed = pythonfinder.models.python.PythonVersion.from_path(path)
        assert isinstance(parsed.version, Version)