Add pytest CI
ci/woodpecker/push/test Pipeline failed Details
ci/woodpecker/push/lint Pipeline failed Details
ci/woodpecker/push/static_analysis Pipeline failed Details

This commit is contained in:
Marty Oehme 2023-08-29 10:40:40 +02:00
parent c9a6030591
commit 13f79d9967
Signed by: Marty
GPG Key ID: EDBF2ED917B2EF6A
4 changed files with 39 additions and 2 deletions

10
.woodpecker/test.yml Normal file
View File

@ -0,0 +1,10 @@
branches: feat/add-ci-pipeline
pipeline:
pytest:
image: ghcr.io/withlogicco/poetry:1.5.1
commands:
- poetry install
- python --version && poetry --version
- echo "------------- running pytest -------------"
- poetry run pytest

View File

@ -173,12 +173,22 @@ Known issues to be fixed:
- [x] if both content and text are empty, do not extract an annotation
- [x] Speed?
- should be fine, on my machine (old i5 laptop) it takes around 90s for ~1000 documents with ~4000 annotations
- [ ] ensure all cmdline options do what they should
- [x] ensure all cmdline options do what they should
- [ ] annotations carry over color object from fitz, should just be Color object or simple tuple with rgb vals
- [ ] docstrings, docstrings!
- [ ] testing testing testing!!
- [ ] refactor into some better abstractions (e.g. Exporter Protocol -> stdout/markdown implementations; Extractor Protocol -> PDF implementation)
features to be implemented:
- [ ] CICD
- [x] static analysis (lint, typecheck etc) on pushes
- [ ] test pipeline on master pushes
- [ ] release pipeline to pypi on tags
- [ ] on_add hook to extract annotations as files are added
- needs upstream help, 'on_add' hook, and pass-through of affected documents
- [ ] add page number if available
- exists in Annotation, just need to place in output
- [ ] show overall amount of extractions at the end
- [ ] custom formatting decided by user
- [ ] improved default exporters
@ -186,7 +196,14 @@ features to be implemented:
- pretty display on stdout (rich?)
- csv/tsv to stdout
- table fmt stdout?
- [ ] arbitrary color -> name settings not dependent on color name existing
- [ ] allow custom colors -> tag name settings not dependent on color name existing (e.g. {"important": (1.0,0.0,0.0)})
- [ ] `--overwrite` mode where existing annotations are not dropped but overwritten on same line of note
- [ ] `--force` mode where we simply do not drop anything
upstream changes:
- [ ] need a hook for adding a document/file
- [ ] need hooks to actually pass through information on the thing they worked on (i.e. their document)
## Issues

View File

@ -18,6 +18,10 @@ python-magic = "^0.4.27"
[tool.poetry.plugins."papis.command"]
extract = "papis_extract:main"
[tool.poetry.group.dev.dependencies]
pytest = "^7.4.0"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

6
tests/test_annotation.py Normal file
View File

@ -0,0 +1,6 @@
from papis_extract.annotation_data import Annotation
def test_colorname_exact():
sut = Annotation("testfile", colors={"stroke": (1.0, 0.0, 0.0)})
c_name = sut.colorname
assert c_name == "red"