Ejemplo n.º 1
0
    def home(self):
        from poetry.utils._compat import Path
        from poetry.utils.appdirs import expanduser

        if os.environ.get("POETRY_HOME"):
            return Path(expanduser(os.environ["POETRY_HOME"]))

        home = Path(expanduser("~"))

        return home / ".poetry"
Ejemplo n.º 2
0
    def home(self):
        from poetry.utils._compat import Path
        from poetry.utils.appdirs import expanduser

        home = Path(expanduser("~"))

        return home / ".poetry"
Ejemplo n.º 3
0
def test_user_data_dir():
    if WINDOWS or (platform == "darwin"):
        return

    environ["POETRY_HOME"] = "/poetry"
    environ["XDG_DATA_HOME"] = "/xdg/.local/share"
    appname = "pypoetry"
    default_user_data_dir = path.join(expanduser("~/.local/share"), appname)

    assert user_data_dir(appname) == path.join(environ["POETRY_HOME"],
                                               ".local/share", appname)

    del environ["POETRY_HOME"]
    assert user_data_dir(appname) == path.join(environ["XDG_DATA_HOME"],
                                               appname)

    del environ["XDG_DATA_HOME"]
    assert user_data_dir(appname) == default_user_data_dir
Ejemplo n.º 4
0
def test_user_config_dir():
    if WINDOWS or (platform == "darwin"):
        return

    environ["POETRY_HOME"] = "/poetry"
    environ["XDG_CONFIG_HOME"] = "/xdg/.config"
    appname = "pypoetry"
    default_user_config_dir = path.join(expanduser("~/.config"), appname)

    assert user_config_dir(appname) == path.join(environ["POETRY_HOME"],
                                                 ".config", appname)

    del environ["POETRY_HOME"]
    assert user_config_dir(appname) == path.join(environ["XDG_CONFIG_HOME"],
                                                 appname)

    del environ["XDG_CONFIG_HOME"]
    assert user_config_dir(appname) == default_user_config_dir