diff --git a/README.md b/README.md index f44347d..4b33580 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To set up additional external tools that are used: * Run `diffoscope --list-tools` for a full list. Also, the Dockerfile should install all of them. -Note that it is much simpler to run Vessel in a Docker container, which already contains all these dependencies. See [Docker Setup](#docker). +Note that it is much simpler to run Vessel in a Docker container, which already contains all these dependencies. See [Docker Setup](#docker-setup). ### Docker Setup @@ -65,14 +65,19 @@ Example running on two images from a private Docker registry: ## Development -To lint the code, execute: -* `ruff check` +Follow the instructions at [Local Environment Setup](#local-environment-setup) first to set up your local environment. -To apply the safe lint fixes, execute: -* `ruff check --fix` +To lint the code, and check for format and type issues, execute: +* `make check` -To format the code, execute: -* `ruff format` +To apply the safe lint fixes, and format fixes, execute: +* `make qa` + +To run unit tests, execute: +* `make test` + +To run all the above, execute: +* `make ci` ### Building diff --git a/poetry.lock b/poetry.lock index ffc3b9a..3aa8b1e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -529,6 +529,17 @@ files = [ docs = ["Sphinx", "furo"] test = ["objgraph", "psutil"] +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + [[package]] name = "ipython" version = "8.29.0" @@ -1407,6 +1418,21 @@ docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-a test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"] type = ["mypy (>=1.11.2)"] +[[package]] +name = "pluggy" +version = "1.5.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, + {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, +] + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + [[package]] name = "portion" version = "2.6.0" @@ -1538,6 +1564,26 @@ docs = ["myst_parser", "sphinx", "sphinx_rtd_theme"] full = ["Pillow (>=8.0.0)", "PyCryptodome", "cryptography"] image = ["Pillow (>=8.0.0)"] +[[package]] +name = "pytest" +version = "7.4.4" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + [[package]] name = "python-dateutil" version = "2.9.0.post0" @@ -1883,4 +1929,4 @@ dev = ["black (>=19.3b0)", "pytest (>=4.6.2)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "775f14982a8ebb35d53757778229aeda596a889ccb706592451859a6042fe1c8" +content-hash = "4421746b635668569027efc5dcfda13e561a92ff71af6ccbbdc227359b2b101f" diff --git a/pyproject.toml b/pyproject.toml index b65cd76..34e6c4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,7 @@ ruff = "^0.7.4" mypy = "^1.13.0" types-PyYAML = "^6.0.12" actionlint-py = "^1.7.4.18" +pytest = "^7.3.1" [build-system] requires = ["poetry-core"] diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/vessel/cli.py b/vessel/cli.py index 95bef27..edb1260 100644 --- a/vessel/cli.py +++ b/vessel/cli.py @@ -79,8 +79,8 @@ def vessel(logging_level: str) -> None: resolve_path=True, ), help=( - "Specify a data directory for unpacking the images. Default: Create a temporary directory that is " - "auto-deleted." + "Specify a data directory for unpacking the images. Default: Create a " + "temporary directory that is auto-deleted." ), ) @click.option( @@ -93,7 +93,8 @@ def vessel(logging_level: str) -> None: resolve_path=True, ), help=( - "Specify a output directory for diffoscope output. Default: Stores in current directory." + "Specify a output directory for diffoscope output. Default: Stores " + "in current directory." ), ) def diff( diff --git a/vessel/utils/diffoscope.py b/vessel/utils/diffoscope.py index b2f5d44..33b9eb0 100644 --- a/vessel/utils/diffoscope.py +++ b/vessel/utils/diffoscope.py @@ -186,7 +186,8 @@ def parse_diffoscope_output( ( diff.comments != [] and not any( - flag.regex["comment"].search(comment) for comment in diff.comments + flag.regex["comment"].search(comment) + for comment in diff.comments ) ) or (