25 lines
518 B
Python
25 lines
518 B
Python
import datetime
|
|
import decimal
|
|
import io
|
|
import pathlib
|
|
import random
|
|
|
|
import pytest
|
|
|
|
from oxrlib import __main__ as oxrmain
|
|
|
|
decimal.setcontext(oxrmain.decimal_context())
|
|
|
|
TEST_DIR = pathlib.Path(__file__).parent
|
|
|
|
class StringIO(io.StringIO):
|
|
def close(self):
|
|
self.last_value = self.getvalue()
|
|
super().close()
|
|
|
|
def relpath(*parts):
|
|
return TEST_DIR / pathlib.Path(*parts)
|
|
|
|
@pytest.fixture
|
|
def any_date():
|
|
return datetime.date.today() - datetime.timedelta(days=730 - random.randint(0, 365))
|