Add pytest CI
This commit is contained in:
parent
c9a6030591
commit
13f79d9967
4 changed files with 39 additions and 2 deletions
10
.woodpecker/test.yml
Normal file
10
.woodpecker/test.yml
Normal 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
|
21
README.md
21
README.md
|
@ -173,12 +173,22 @@ Known issues to be fixed:
|
||||||
- [x] if both content and text are empty, do not extract an annotation
|
- [x] if both content and text are empty, do not extract an annotation
|
||||||
- [x] Speed?
|
- [x] Speed?
|
||||||
- should be fine, on my machine (old i5 laptop) it takes around 90s for ~1000 documents with ~4000 annotations
|
- 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:
|
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
|
- [ ] 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
|
- [ ] add page number if available
|
||||||
|
- exists in Annotation, just need to place in output
|
||||||
- [ ] show overall amount of extractions at the end
|
- [ ] show overall amount of extractions at the end
|
||||||
- [ ] custom formatting decided by user
|
- [ ] custom formatting decided by user
|
||||||
- [ ] improved default exporters
|
- [ ] improved default exporters
|
||||||
|
@ -186,7 +196,14 @@ features to be implemented:
|
||||||
- pretty display on stdout (rich?)
|
- pretty display on stdout (rich?)
|
||||||
- csv/tsv to stdout
|
- csv/tsv to stdout
|
||||||
- table fmt 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
|
## Issues
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,10 @@ python-magic = "^0.4.27"
|
||||||
[tool.poetry.plugins."papis.command"]
|
[tool.poetry.plugins."papis.command"]
|
||||||
extract = "papis_extract:main"
|
extract = "papis_extract:main"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.poetry.group.dev.dependencies]
|
||||||
|
pytest = "^7.4.0"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
6
tests/test_annotation.py
Normal file
6
tests/test_annotation.py
Normal 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"
|
Loading…
Reference in a new issue