Configuration: Set up CacheWriter.
This commit is contained in:
parent
351811bb30
commit
18f7ea7038
2 changed files with 4 additions and 1 deletions
|
@ -5,7 +5,7 @@ import decimal
|
||||||
import os.path
|
import os.path
|
||||||
import pathlib
|
import pathlib
|
||||||
|
|
||||||
from . import loaders
|
from . import cache, loaders
|
||||||
|
|
||||||
HOME_PATH = pathlib.Path(os.path.expanduser('~'))
|
HOME_PATH = pathlib.Path(os.path.expanduser('~'))
|
||||||
CONFFILE_SEED = """
|
CONFFILE_SEED = """
|
||||||
|
@ -127,6 +127,7 @@ class Configuration:
|
||||||
kwargs['dir_path'] = kwargs.pop('directory')
|
kwargs['dir_path'] = kwargs.pop('directory')
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
self.cache = cache.CacheWriter(**kwargs)
|
||||||
return loaders.FileCache(**kwargs)
|
return loaders.FileCache(**kwargs)
|
||||||
|
|
||||||
def _build_oxrapi_loader(self):
|
def _build_oxrapi_loader(self):
|
||||||
|
|
|
@ -5,6 +5,7 @@ import pytest
|
||||||
|
|
||||||
from . import any_date, relpath
|
from . import any_date, relpath
|
||||||
|
|
||||||
|
import oxrlib.cache
|
||||||
import oxrlib.config
|
import oxrlib.config
|
||||||
import oxrlib.loaders
|
import oxrlib.loaders
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ def test_full_config():
|
||||||
assert type(loaders[0]) is oxrlib.loaders.FileCache
|
assert type(loaders[0]) is oxrlib.loaders.FileCache
|
||||||
assert type(loaders[1]) is oxrlib.loaders.OXRAPIRequest
|
assert type(loaders[1]) is oxrlib.loaders.OXRAPIRequest
|
||||||
assert len(loaders) == 2
|
assert len(loaders) == 2
|
||||||
|
assert type(config.cache) is oxrlib.cache.CacheWriter
|
||||||
|
|
||||||
def test_incomplete_config():
|
def test_incomplete_config():
|
||||||
config = config_from('incomplete.ini')
|
config = config_from('incomplete.ini')
|
||||||
|
|
Loading…
Reference in a new issue