tests: thinking about external repositories
This commit is contained in:
parent
41c5b34006
commit
44aa062756
2 changed files with 30 additions and 2 deletions
23
my/demo.py
23
my/demo.py
|
@ -2,23 +2,42 @@
|
|||
Just a demo module for testing and documentation purposes
|
||||
'''
|
||||
|
||||
from .core import Paths
|
||||
from .core import Paths, PathIsh
|
||||
|
||||
from typing import Optional
|
||||
from datetime import tzinfo
|
||||
import pytz
|
||||
|
||||
from my.config import demo as user_config
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class demo(user_config):
|
||||
data_path: Paths
|
||||
username: str
|
||||
timezone: tzinfo = pytz.utc
|
||||
|
||||
external: Optional[PathIsh] = None
|
||||
|
||||
@property
|
||||
def external_module(self):
|
||||
rpath = self.external
|
||||
if rpath is not None:
|
||||
from .cfg import set_repo
|
||||
set_repo('external', rpath)
|
||||
|
||||
import my.config.repos.external as m # type: ignore
|
||||
return m
|
||||
|
||||
|
||||
from .core import make_config
|
||||
config = make_config(demo)
|
||||
|
||||
# TODO not sure about type checking?
|
||||
external = config.external_module
|
||||
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Sequence, Iterable
|
||||
from datetime import datetime
|
||||
|
@ -46,6 +65,6 @@ def items() -> Iterable[Item]:
|
|||
for raw in j:
|
||||
yield Item(
|
||||
username=config.username,
|
||||
raw=raw,
|
||||
raw=external.identity(raw),
|
||||
dt=dt,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue