Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheider committed May 19, 2019
1 parent 77acce1 commit b7f4e6e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
8 changes: 4 additions & 4 deletions tests/test_app_path.py
Expand Up @@ -13,27 +13,27 @@

def test_all():
print("-- app dirs (with optional 'version')")
dirs = app_path.AppPath(_app_name, _app_author, app_version="1.0")
dirs = app_path.AppPath(_app_name, _app_author, app_version="1.0", ensure_existence=False)
for prop in props:
print("%s: %s" % (prop, getattr(dirs, prop)))


def test_no_ver():
print("\n-- app dirs (without optional 'version')")
dirs = app_path.AppPath(_app_name, _app_author)
dirs = app_path.AppPath(_app_name, _app_author, ensure_existence=False)
for prop in props:
print("%s: %s" % (prop, getattr(dirs, prop)))


def test_author():
print("\n-- app dirs (without optional '_app_author')")
dirs = app_path.AppPath(_app_name)
dirs = app_path.AppPath(_app_name, ensure_existence=False)
for prop in props:
print("%s: %s" % (prop, getattr(dirs, prop)))


def test_no_author():
print("\n-- app dirs (with disabled '_app_author')")
dirs = app_path.AppPath(_app_name, app_author=False)
dirs = app_path.AppPath(_app_name, app_author=False, ensure_existence=False)
for prop in props:
print("%s: %s" % (prop, getattr(dirs, prop)))
38 changes: 18 additions & 20 deletions warg/app_path.py
Expand Up @@ -37,7 +37,7 @@ def ensure_existence(enabled, out):
out.mkdir(parents=True)

@property
def user_data(self):
def user_data(self) -> pathlib.Path:
out = self.user_data_path(
self._app_name, self._app_author, version=self._app_version, roaming=self._roaming
)
Expand All @@ -46,7 +46,7 @@ def user_data(self):
return out

@property
def site_data(self):
def site_data(self) -> pathlib.Path:
out = self.site_data_path(
self._app_name, self._app_author, version=self._app_version, multi_path=self._multi_path
)
Expand All @@ -56,41 +56,41 @@ def site_data(self):
return out

@property
def user_config(self):
def user_config(self) -> pathlib.Path:
out = self.user_config_path(
self._app_name, self._app_author, version=self._app_version, roaming=self._roaming
)
self.ensure_existence(self._ensure_existence, out)
return out

@property
def site_config(self):
def site_config(self) -> pathlib.Path:
out = self.site_config_path(
self._app_name, self._app_author, version=self._app_version, multi_path=self._multi_path
)
self.ensure_existence(self._ensure_existence, out)
return out

@property
def user_cache(self):
def user_cache(self) -> pathlib.Path:
out = self.user_cache_path(self._app_name, self._app_author, version=self._app_version)
self.ensure_existence(self._ensure_existence, out)
return out

@property
def user_state(self):
def user_state(self) -> pathlib.Path:
out = self.user_state_path(self._app_name, self._app_author, version=self._app_version)
self.ensure_existence(self._ensure_existence, out)
return out

@property
def user_log(self):
def user_log(self) -> pathlib.Path:
out = self.user_log_path(self._app_name, self._app_author, version=self._app_version)
self.ensure_existence(self._ensure_existence, out)
return out

@staticmethod
def user_data_path(app_name=None, app_author=None, version=None, roaming=False):
def user_data_path(app_name=None, app_author=None, version=None, roaming=False) -> pathlib.Path:
r"""Return full path to the user-specific data dir for this application.
"app_name" is the name of application.
Expand Down Expand Up @@ -154,7 +154,7 @@ def user_data_path(app_name=None, app_author=None, version=None, roaming=False):
return path

@staticmethod
def site_data_path(app_name=None, app_author=None, version=None, multi_path=False):
def site_data_path(app_name=None, app_author=None, version=None, multi_path=False) -> pathlib.Path:
r"""Return full path to the user-shared data dir for this application.
"app_name" is the name of application.
Expand Down Expand Up @@ -221,7 +221,7 @@ def site_data_path(app_name=None, app_author=None, version=None, multi_path=Fals
return path

@staticmethod
def user_config_path(app_name=None, app_author=None, version=None, roaming=False):
def user_config_path(app_name=None, app_author=None, version=None, roaming=False) -> pathlib.Path:
r"""Return full path to the user-specific config dir for this application.
"app_name" is the name of application.
Expand Down Expand Up @@ -265,7 +265,7 @@ def user_config_path(app_name=None, app_author=None, version=None, roaming=False
return path

@staticmethod
def site_config_path(app_name=None, app_author=None, version=None, multi_path=False):
def site_config_path(app_name=None, app_author=None, version=None, multi_path=False) -> pathlib.Path:
r"""Return full path to the user-shared data dir for this application.
"app_name" is the name of application.
Expand Down Expand Up @@ -322,7 +322,7 @@ def site_config_path(app_name=None, app_author=None, version=None, multi_path=Fa
return path

@staticmethod
def user_cache_path(app_name=None, app_author=None, version=None, opinion=True):
def user_cache_path(app_name=None, app_author=None, version=None, opinion=True) -> pathlib.Path:
r"""Return full path to the user-specific cache dir for this application.
"appname" is the name of application.
Expand Down Expand Up @@ -380,7 +380,7 @@ def user_cache_path(app_name=None, app_author=None, version=None, opinion=True):
return path

@staticmethod
def user_state_path(app_name=None, app_author=None, version=None, roaming=False):
def user_state_path(app_name=None, app_author=None, version=None, roaming=False) -> pathlib.Path:
r"""Return full path to the user-specific state dir for this application.
"app_name" is the name of application.
Expand Down Expand Up @@ -422,7 +422,7 @@ def user_state_path(app_name=None, app_author=None, version=None, roaming=False)
return path

@staticmethod
def user_log_path(app_name=None, app_author=None, version=None, opinion=True):
def user_log_path(app_name=None, app_author=None, version=None, opinion=True) -> pathlib.Path:
r"""Return full path to the user-specific log dir for this application.
"app_name" is the name of application.
Expand Down Expand Up @@ -478,24 +478,22 @@ def user_log_path(app_name=None, app_author=None, version=None, opinion=True):

props = ("user_data", "user_config", "user_cache", "user_state", "user_log", "site_data", "site_config")

print("-- app dirs %s --" % __version__)

print("-- app dirs (with optional 'version')")
dirs = AppPath(_app_name, _app_author, app_version="1.0")
dirs = AppPath(_app_name, _app_author, app_version="1.0", ensure_existence=False)
for prop in props:
print("%s: %s" % (prop, getattr(dirs, prop)))

print("\n-- app dirs (without optional 'version')")
dirs = AppPath(_app_name, _app_author)
dirs = AppPath(_app_name, _app_author, ensure_existence=False)
for prop in props:
print("%s: %s" % (prop, getattr(dirs, prop)))

print("\n-- app dirs (without optional '_app_author')")
dirs = AppPath(_app_name)
dirs = AppPath(_app_name, ensure_existence=False)
for prop in props:
print("%s: %s" % (prop, getattr(dirs, prop)))

print("\n-- app dirs (with disabled '_app_author')")
dirs = AppPath(_app_name, app_author=False)
dirs = AppPath(_app_name, app_author=False, ensure_existence=False)
for prop in props:
print("%s: %s" % (prop, getattr(dirs, prop)))
2 changes: 1 addition & 1 deletion warg/version.py
Expand Up @@ -5,7 +5,7 @@
from warnings import warn

__author__ = "cnheider"
__version__ = "0.1.2"
__version__ = "0.1.4"
__version_info__ = tuple(int(segment) for segment in __version__.split("."))
__doc__ = """
Created on 27/04/2019
Expand Down

0 comments on commit b7f4e6e

Please sign in to comment.