Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/test'
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Sep 21, 2022
2 parents 5749e03 + 8630bae commit 7c40065
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 89 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/clean.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
name: Clean docker hub tags

on: delete

on:
delete:
pull_request:
types:
- closed
jobs:
clean:
runs-on: ubuntu-20.04
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/pr-check.yaml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Pull request check

on:
pull_request:
types:
- opened
- reopened
- labeled
- unlabeled
- edit
- synchronize

jobs:
build:
name: Pull request check
runs-on: ubuntu-20.04
timeout-minutes: 5

steps:
- uses: actions/checkout@v3

- run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
- run: python3 -m pip install --user --pre c2cciutils[pr_checks]

- name: Check pull request
run: c2cciutils-pull-request-checks
env:
GITHUB_EVENT: ${{ toJson(github) }}
2 changes: 1 addition & 1 deletion ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
c2cciutils==1.2.1
c2cciutils[checks,publish]==1.3.4
jsonschema2md==0.4.0
jsonschema-gentypes==1.3.1
poetry-dynamic-versioning==0.19.0
185 changes: 141 additions & 44 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ zxing-cpp = "1.4.0"
pyperclip = "1.8.2"
tifffile = "2022.8.12"
deepmerge = "1.0.1"
matplotlib = "3.5.3"
matplotlib = "3.6.0"

[tool.poetry.dev-dependencies]
prospector = { version = "1.7.7", extras = ["with_bandit", "with_mypy", "with_pyroma"] }
Expand Down
6 changes: 3 additions & 3 deletions scan_to_paperless/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ def transform(
"sources": images,
"name": "split"
if config["args"].setdefault("assisted_split", schema.ASSISTED_SPLIT_DEFAULT)
else "finalise",
else "finalize",
"process_count": process_count,
}

Expand Down Expand Up @@ -1445,7 +1445,7 @@ def split(
transformed_images.append(img2)
process_count += 1

return {"sources": transformed_images, "name": "finalise", "process_count": process_count}
return {"sources": transformed_images, "name": "finalize", "process_count": process_count}


def finalize(
Expand Down Expand Up @@ -1684,7 +1684,7 @@ def _process(config_file_name: str, dirty: bool = False, print_waiting: bool = T
elif step["name"] == "split":
print("Split")
next_step = split(config, step, root_folder)
elif step["name"] == "finalise":
elif step["name"] == "finalize":
print("Finalize")
finalize(config, step, root_folder)
done = True
Expand Down
12 changes: 6 additions & 6 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def test_assisted_split_full(type_, limit, better_value, cut_white):
config["assisted_split"][0]["limits"][0]["value"] = better_value
step = process.split(config, step, root_folder)
assert len(step["sources"]) == 2
assert step["name"] == "finalise"
assert step["name"] == "finalize"
check_image_file(
root_folder,
step["sources"][0],
Expand Down Expand Up @@ -277,7 +277,7 @@ def test_assisted_split_join_full():
config["assisted_split"][number]["limits"] = [limit]
config["assisted_split"][number]["destinations"] = destinations
step = process.split(config, step, root_folder)
assert step["name"] == "finalise"
assert step["name"] == "finalize"
assert len(step["sources"]) == 1
check_image_file(
root_folder,
Expand Down Expand Up @@ -352,7 +352,7 @@ def test_assisted_split_booth():
"sources": ["image-1.png"],
}
step = process.split(config, step, root_folder)
assert step["name"] == "finalise"
assert step["name"] == "finalize"
assert len(step["sources"]) == 4
check_image_file(
root_folder,
Expand Down Expand Up @@ -407,7 +407,7 @@ def test_full(progress):
else:
assert not os.path.exists(os.path.join(root_folder, "1-level"))

assert step["name"] == "finalise"
assert step["name"] == "finalize"
process.finalize(config, step, root_folder)

pdf_filename = os.path.join("/results", f"{os.path.basename(root_folder)}.pdf")
Expand Down Expand Up @@ -460,7 +460,7 @@ def test_credit_card_full():
}
step = process.transform(config, step, "/tmp/test-config.yaml", root_folder)
assert len(step["sources"]) == 2
assert step["name"] == "finalise"
assert step["name"] == "finalize"
process.finalize(config, step, root_folder)
pdfinfo = process.output(
["pdfinfo", os.path.join("/results", f"{os.path.basename(root_folder)}.pdf")]
Expand Down Expand Up @@ -504,7 +504,7 @@ def test_empty():
}
step = process.transform(config, step, "/tmp/test-config.yaml", root_folder)
assert len(step["sources"]) == 0
assert step["name"] == "finalise"
assert step["name"] == "finalize"
shutil.rmtree(root_folder)


Expand Down

0 comments on commit 7c40065

Please sign in to comment.