Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy test env update #3

Merged
merged 6 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tests

on:
pull_request:
branches:
- '**'
workflow_call:
inputs:
check-service-test:
required: false
default: false
type: boolean

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.10.11]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install MeCab dependencies
run: |
sudo apt-get update
sudo apt-get install -y mecab libmecab-dev mecab-ipadic-utf8

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV

- name: Install dependencies
run: |
poetry install

- name: Run tests
run: |
poetry run tox
544 changes: 269 additions & 275 deletions poetry.lock

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,41 @@ flake8-isort = ">=4.1.1"
flake8-quotes = ">=3.3.1"
flake8-print = ">=4.0.0"
isort = ">=5.10.1"
black = ">=22.10.0"
black = {extras = ["jupyter"], version = "^22.6.0"}
mypy = ">=0.971"
tox = ">=3.25.1"
pre-commit = ">=3.3.3"
nbstripout = "0.6.1"

[tool.isort]
profile = "black"
line_length = 88
multi_line_output = 3
include_trailing_comma = true
skip = [".venv", ".tox"]

[tool.black]
skip-string-normalization = true
include = '\.py$'

[tool.pytest.ini_options]
testpaths = "tests/"

[tool.mypy]
python_version=3.10
files = "src/unlock_pdf_password"
ignore_missing_imports = true
disallow_untyped_defs = true
no_implicit_optional = true
allow_redefinition = true
show_error_codes = true
pretty = true
allow_untyped_globals = true

[tool.flake8]
max-line-length = 119
ignore = "D, E203, W391, W503"
exclude = " .git, .venv, __pycache__, data, dist, misc, notebooks, prof, tmp, workspacea, .tox"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
6 changes: 4 additions & 2 deletions scripts/unlock_pdf_password.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import logging
from typing import Union, Optional
from pathlib import Path
from typing import Optional, Union

import fire

from unlock_pdf_password.unlock_pdf_password import unlock_pdf_password, unlock_pdf
from unlock_pdf_password.unlock_pdf_password import unlock_pdf, unlock_pdf_password

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


def unlock_pdf_password_wrapper(
input_pdf_path: Union[str, Path],
output_pdf_path: Union[str, Path],
Expand Down Expand Up @@ -42,5 +43,6 @@ def unlock_pdf_password_wrapper(
logger.info(f'PDF unlocked successfully! Password: {password}')
logger.error('Password not found')


if __name__ == '__main__':
fire.Fire(unlock_pdf_password)
1 change: 1 addition & 0 deletions src/unlock_pdf_password/env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VERSION = '0.1.0'
Empty file added tests/__init__.py
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions tests/unlock_pdf_password/test_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from unlock_pdf_password.env import VERSION


def test_version():
assert VERSION == '0.1.0'
26 changes: 26 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[tox]
envlist = py310, lint

[gh-actions]
python =
3.10: py310, lint

[testenv]
allowlist_externals =
pytest
skip_install = true
commands =
pytest tests/

[testenv:lint]
allowlist_externals =
pflake8
mypy
black
isort
skip_install = true
commands =
# pflake8 --show-source --statistics src/ tests {posargs}
# mypy . {posargs}
black --check . {posargs}
isort --check-only . {posargs}
Loading