my.coding.commits: actually test on CI, add config stub
This commit is contained in:
parent
8d6f691824
commit
ec8b0e9170
5 changed files with 47 additions and 6 deletions
1
.github/workflows/main.yml
vendored
1
.github/workflows/main.yml
vendored
|
@ -34,6 +34,7 @@ jobs:
|
|||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0 # nicer to have all git history when debugging/for tests
|
||||
|
||||
# uncomment for SSH debugging
|
||||
# - uses: mxschmitt/action-tmate@v3
|
||||
|
|
|
@ -73,3 +73,10 @@ class orgmode:
|
|||
|
||||
class arbtt:
|
||||
logfiles: Paths
|
||||
|
||||
|
||||
from typing import Optional
|
||||
class commits:
|
||||
emails: Optional[Sequence[str]]
|
||||
names: Optional[Sequence[str]]
|
||||
roots: Sequence[PathIsh]
|
||||
|
|
|
@ -14,9 +14,10 @@ if ! [ -z "$CI" ]; then
|
|||
# install OS specific stuff here
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# macos
|
||||
:
|
||||
brew install fd
|
||||
else
|
||||
:
|
||||
sudo apt update
|
||||
sudo apt install fd-find
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,8 +1,36 @@
|
|||
from .common import skip_if_not_karlicoss as pytestmark
|
||||
# TODO need fdfind on CI?
|
||||
from pathlib import Path
|
||||
|
||||
from more_itertools import bucket
|
||||
import pytest
|
||||
|
||||
from more_itertools import ilen
|
||||
|
||||
def test() -> None:
|
||||
from my.coding.commits import commits
|
||||
all_commits = commits()
|
||||
assert ilen(all_commits) > 10
|
||||
all_commits = list(commits())
|
||||
assert len(all_commits) > 100
|
||||
|
||||
buckets = bucket(all_commits, key=lambda c: c.repo)
|
||||
by_repo = {k: list(buckets[k]) for k in buckets}
|
||||
# handle later
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def prepare(tmp_path: Path):
|
||||
# TODO maybe test against actual testdata, could check for
|
||||
# - datetime handling
|
||||
# - bare repos
|
||||
# - canonical name
|
||||
# - caching?
|
||||
hpi_repo_root = Path(__file__).absolute().parent.parent
|
||||
assert (hpi_repo_root / '.git').exists(), hpi_repo_root
|
||||
|
||||
class commits:
|
||||
emails = {'karlicoss@gmail.com'}
|
||||
names = {'Dima'}
|
||||
roots = [hpi_repo_root]
|
||||
|
||||
from my.core.cfg import tmp_config
|
||||
with tmp_config() as config:
|
||||
config.commits = commits
|
||||
yield
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -34,6 +34,8 @@ commands =
|
|||
# my.body.weight dep
|
||||
hpi module install my.orgmode
|
||||
|
||||
pip install gitpython # my.commits dep
|
||||
|
||||
python3 -m pytest tests \
|
||||
# ignore some tests which might take a while to run on ci..
|
||||
--ignore tests/takeout.py \
|
||||
|
@ -77,6 +79,7 @@ commands =
|
|||
hpi module install my.stackexchange.stexport
|
||||
hpi module install my.pinboard
|
||||
hpi module install my.arbtt
|
||||
pip install gitpython # my.commits dep
|
||||
|
||||
# todo fuck. -p my.github isn't checking the subpackages?? wtf...
|
||||
# guess it wants .pyi file??
|
||||
|
@ -96,6 +99,7 @@ commands =
|
|||
-p my.time.tz.via_location \
|
||||
-p my.calendar.holidays \
|
||||
-p my.arbtt \
|
||||
-p my.coding.commits \
|
||||
--txt-report .coverage.mypy-misc \
|
||||
--html-report .coverage.mypy-misc \
|
||||
{posargs}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue