cpath tests, rely more on it
This commit is contained in:
parent
8b8a85e8c3
commit
55ac85c7e7
3 changed files with 10 additions and 13 deletions
|
@ -9,7 +9,7 @@ from typing import Dict, List, Optional, Iterator
|
|||
from datetime import datetime
|
||||
|
||||
from .common import LazyLogger, get_files, group_by_key, cproperty, make_dict
|
||||
from .kython.kompress import open as kopen
|
||||
from .kython.kompress import CPath
|
||||
|
||||
from my.config import rtm as config
|
||||
|
||||
|
@ -80,7 +80,7 @@ class MyTodo:
|
|||
|
||||
|
||||
class DAL:
|
||||
def __init__(self, data: bytes, revision=None) -> None:
|
||||
def __init__(self, data: str, revision=None) -> None:
|
||||
self.cal = icalendar.Calendar.from_ical(data)
|
||||
self.revision = revision
|
||||
|
||||
|
@ -99,8 +99,7 @@ class DAL:
|
|||
|
||||
def dal():
|
||||
last = get_files(config.export_path)[-1]
|
||||
with kopen(last) as fo:
|
||||
data = fo.read()
|
||||
data = CPath(last).read_text() # TODO make it automatic
|
||||
return DAL(data=data, revision='TODO')
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import lzma
|
|||
import io
|
||||
import zipfile
|
||||
|
||||
from my.kython.kompress import kopen, kexists
|
||||
from my.kython.kompress import kopen, kexists, CPath
|
||||
|
||||
|
||||
import pytest # type: ignore
|
||||
|
@ -41,10 +41,7 @@ def test_kexists(prepare, tmp_path: Path) -> None:
|
|||
assert not kexists(tmp_path / 'nosuchzip.zip', 'path/in/archive')
|
||||
|
||||
|
||||
def test_cpath():
|
||||
# TODO
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
# TODO FIXME these tests should def run on CI
|
||||
# TODO get rid of all decode utf8?
|
||||
def test_cpath(prepare, tmp_path: Path) -> None:
|
||||
CPath(str(tmp_path / 'file' )).read_text() == 'just plaintext'
|
||||
CPath( tmp_path / 'file.xz').read_text() == 'compressed text'
|
||||
# TODO not sure about zip files??
|
||||
|
|
3
tox.ini
3
tox.ini
|
@ -8,11 +8,12 @@ passenv = CI CI_*
|
|||
# deliberately set to nonexistent pathe to check the fallback logic
|
||||
setenv = MY_CONFIG = nonexistent
|
||||
commands =
|
||||
pip install -e .
|
||||
pip install -e .[testing]
|
||||
# TODO ??
|
||||
# python -m pytest {posargs}
|
||||
python3 -c 'import my.init; from my.config import stub as config; print(config.key)'
|
||||
python3 -c 'import my.init; import my.config; import my.config.repos' # shouldn't fail at least
|
||||
python3 -m pytest tests/misc.py tests/get_files.py
|
||||
# TODO run demo.py? just make sure with_my is a bit cleverer?
|
||||
# TODO e.g. under CI, rely on installing
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue