def test_get_pyenv_paths(self): local_pyenv_version = "3.5.5" all_pyenv_versions = ["2.7.14", local_pyenv_version] self.create_file(".python-version", local_pyenv_version + "\n") with fake_pyenv_root(all_pyenv_versions, local_pyenv_version) as ( pyenv_root, expected_paths, expected_local_paths, ): paths = PythonSetup.get_pyenv_paths( pyenv_root_func=lambda: pyenv_root) local_paths = PythonSetup.get_pyenv_paths( pyenv_root_func=lambda: pyenv_root, pyenv_local=True) assert expected_paths == paths assert expected_local_paths == local_paths
def test_get_pyenv_paths(rule_runner: RuleRunner) -> None: local_pyenv_version = "3.5.5" all_pyenv_versions = ["2.7.14", local_pyenv_version] rule_runner.write_files({".python-version": f"{local_pyenv_version}\n"}) with fake_pyenv_root(all_pyenv_versions, local_pyenv_version) as ( pyenv_root, expected_paths, expected_local_paths, ): paths = PythonSetup.get_pyenv_paths(Environment({"PYENV_ROOT": pyenv_root})) local_paths = PythonSetup.get_pyenv_paths( Environment({"PYENV_ROOT": pyenv_root}), pyenv_local=True ) assert expected_paths == paths assert expected_local_paths == local_paths
def test_get_pyenv_paths(self): with fake_pyenv_root(["2.7.14", "3.5.5"]) as (pyenv_root, expected_paths): paths = PythonSetup.get_pyenv_paths( pyenv_root_func=lambda: pyenv_root) self.assertListEqual(expected_paths, paths)