@@ -6,30 +6,27 @@ import pytest
from . import any_date, relpath, StringIO
import oxrlib.cache
import oxrlib.errors
CACHE_PATH = relpath('writecache')
HISTORICAL_PATTERN = '{date}_{base}_cache.json'
class TestCacheFile(oxrlib.cache.WriteCacheFile):
def __init__(self, path, *args, **kwargs):
self.path = path
assert args[0].startswith('w')
def open(self):
last_file = StringIO()
last_file.name = self.path.as_posix()
type(self).last_file = last_file
return self.last_file
self.open_file = StringIO()
self.open_file.name = self.path.as_posix()
type(self).last_file = self.open_file
class FakeRate:
def __init__(self, date, base):
self.timestamp = datetime.datetime(date.year, date.month, date.day)
self.base = base
def serialize(self):
return "test data for {} in {}".format(self.base, self.timestamp.date())
@pytest.fixture