{"id":24603635,"url":"https://github.com/apkawa/pytest-image-diff","last_synced_at":"2025-10-06T02:41:13.629Z","repository":{"id":38246069,"uuid":"252186039","full_name":"Apkawa/pytest-image-diff","owner":"Apkawa","description":"pytest helps for compare images and regression","archived":false,"fork":false,"pushed_at":"2024-12-31T09:05:01.000Z","size":235,"stargazers_count":11,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-04T16:56:18.863Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Apkawa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-01T13:40:38.000Z","updated_at":"2025-01-05T08:43:02.000Z","dependencies_parsed_at":"2024-06-20T00:15:35.985Z","dependency_job_id":"4b2841d0-be38-4fc4-a9c8-11e25ea78086","html_url":"https://github.com/Apkawa/pytest-image-diff","commit_stats":{"total_commits":41,"total_committers":3,"mean_commits":"13.666666666666666","dds":0.04878048780487809,"last_synced_commit":"93c598b2b12bc78ac45d72b3328a296ceabc0124"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/Apkawa/pytest-image-diff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fpytest-image-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fpytest-image-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fpytest-image-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fpytest-image-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Apkawa","download_url":"https://codeload.github.com/Apkawa/pytest-image-diff/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apkawa%2Fpytest-image-diff/sbom","scorecard":{"id":15203,"data":{"date":"2025-08-11","repo":{"name":"github.com/Apkawa/pytest-image-diff","commit":"7194bfbf2758713d5fc14d5ce9366124f4312aaa"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:56: update your workflow using https://app.stepsecurity.io/secureworkflow/Apkawa/pytest-image-diff/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/Apkawa/pytest-image-diff/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/Apkawa/pytest-image-diff/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/Apkawa/pytest-image-diff/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:81: update your workflow using https://app.stepsecurity.io/secureworkflow/Apkawa/pytest-image-diff/ci.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:83: update your workflow using https://app.stepsecurity.io/secureworkflow/Apkawa/pytest-image-diff/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:102: update your workflow using https://app.stepsecurity.io/secureworkflow/Apkawa/pytest-image-diff/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:110: update your workflow using https://app.stepsecurity.io/secureworkflow/Apkawa/pytest-image-diff/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:116: update your workflow using https://app.stepsecurity.io/secureworkflow/Apkawa/pytest-image-diff/ci.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:66","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:67","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:88","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned","Info:   0 out of   3 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.0.14 not signed: https://api.github.com/repos/Apkawa/pytest-image-diff/releases/192768695","Warn: release artifact v0.0.7 not signed: https://api.github.com/repos/Apkawa/pytest-image-diff/releases/57559645","Warn: release artifact v0.0.14 does not have provenance: https://api.github.com/repos/Apkawa/pytest-image-diff/releases/192768695","Warn: release artifact v0.0.7 does not have provenance: https://api.github.com/repos/Apkawa/pytest-image-diff/releases/57559645"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/ci.yml:75"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-43017 / GHSA-qwmp-2cf2-g9g6"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-14T15:36:48.044Z","repository_id":38246069,"created_at":"2025-08-14T15:36:48.044Z","updated_at":"2025-08-14T15:36:48.044Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278551494,"owners_count":26005386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-24T15:15:18.839Z","updated_at":"2025-10-06T02:41:13.576Z","avatar_url":"https://github.com/Apkawa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPi](https://img.shields.io/pypi/v/pytest-image-diff.svg)](https://pypi.python.org/pypi/pytest-image-diff)\n[![ci](https://github.com/Apkawa/pytest-image-diff/actions/workflows/ci.yml/badge.svg)](https://github.com/Apkawa/pytest-image-diff/actions/workflows/ci.yml)\n[![Documentation Status](https://readthedocs.org/projects/pytest-image-diff/badge/?version=latest)](https://pytest-image-diff.readthedocs.io/en/latest/?badge=latest)\n[![Codecov](https://codecov.io/gh/Apkawa/pytest-image-diff/branch/master/graph/badge.svg)](https://codecov.io/gh/Apkawa/pytest-image-diff)\n[![PyPi Python versions](https://img.shields.io/pypi/pyversions/pytest-image-diff.svg)](https://pypi.python.org/pypi/pytest-image-diff)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\n# pytest-image-diff\n\n# Installation\n\n```bash\npip install pytest-image-diff\n```\n\nor from git\n\n```bash\npip install -e git+https://githib.com/Apkawa/pytest-image-diff.git@master#egg=pytest-image-diff\n```\n\nPython\u003e=3.6\n\n\n# Usage\n\n```python\nfrom typing import Union\nfrom PIL import Image\n\n\ndef test_compare(image_diff):\n    image: Image or str or bytes = Image.new()\n    image2: Image or str or bytes = '/path/to/image.jpeg'\n    image_diff(image, image2)\n\n\ndef test_regression(image_regression):\n    image: Union[Image, str, bytes] = Image.new()\n    image_regression(image, threshold=0.5)\n```\n\nAlso use with assert\n\n```python\nimport pytest\n\nfrom typing import Union\nfrom PIL import Image\n\n@pytest.fixture(scope=\"session\")\ndef image_diff_throw_exception() -\u003e bool:\n    \"\"\"\n    Set default throw exception. By default - True\n    \"\"\"\n    return False\n\ndef test_compare(image_diff):\n    image: Image or str or bytes = Image.new()\n    image2: Image or str or bytes = '/path/to/image.jpeg'\n    assert image_diff(image, image2)\n    assert image_diff(image, image2, threshold=0.5)\n    # Also can check threshold in compare, ie\n    assert image_diff(image, image2) \u003c 0.5\n    # For different checks in one test\n    assert image_diff(image, image2, threshold=0.5, suffix=\"one\")\n    # Or without fixture image_diff_throw_exception\n    assert image_diff(image, image2, threshold=0.5, throw_exception=False)\n\n\ndef test_regression(image_regression):\n    image: Union[Image, str, bytes] = Image.new()\n    assert image_regression(image, threshold=0.5)\n    # Also can check threshold in compare, ie\n    assert image_regression(image) \u003c 0.5\n    # For different checks in one test\n    assert image_regression(image, threshold=0.5, suffix=\"foo\")\n    # Or without fixture image_diff_throw_exception\n    assert image_regression(image, threshold=0.5, throw_exception=False)\n```\n\nFirst run creates reference images\n\n## pytest-splinter\n\nFixture `screenshot_regression` enabled if pytest-splinter installed\n\n```python3\nimport pytest\n\n@pytest.fixture\ndef admin_browser(request, browser_instance_getter):\n    \"\"\"Admin browser fixture.\"\"\"\n    # browser_instance_getter function receives parent fixture -- our admin_browser\n    return browser_instance_getter(request, admin_browser)\n\ndef test_2_browsers(browser, admin_browser, screenshot_regression):\n    \"\"\"Test using 2 browsers at the same time.\"\"\"\n    browser.visit('http://google.com')\n    admin_browser.visit('http://admin.example.com')\n\n    screenshot_regression(suffix=\"browser\")\n    screenshot_regression(admin_browser, suffix=\"admin browser\")\n\ndef test_pytest_splinter(browser, screenshot_regression):\n    # Recommend fix window size for avoid regression\n    browser.driver.set_window_size(1280, 1024)\n\n    browser.visit('http://google.com')\n\n    screenshot_regression(suffix=\"main\")\n    # ... some interaction\n    browser.click()\n    screenshot_regression(suffix=\"success\")\n    # you can use xpath expression for part of page\n    screenshot_regression(xpath=\"//h1\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapkawa%2Fpytest-image-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapkawa%2Fpytest-image-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapkawa%2Fpytest-image-diff/lists"}