Skip to content

Commit 62c8f06

Browse files
author
Dmitry Vorobjev
committed
1.0.0.dev2
1 parent 3a4792a commit 62c8f06

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.0.dev2
2+
### Добавлено
3+
- добавлена настройка максимально допустимого количество отличающихся пикселей
4+
15
## 1.0.0.dev1
26
### Изменено
37
- убрана привязка плагина к Playwright

pytest_assert_screenshot/plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def compare(
2525
name=test_name,
2626
fail_fast=False,
2727
fail_msg: str = '',
28+
max_diff_pixels_count=0,
2829
) -> None:
2930
update_screenshot = pytestconfig.getoption('--update-screenshots')
3031
test_file_name = Path(request.node.fspath).stem
@@ -52,7 +53,7 @@ def compare(
5253
img_b = Image.open(file)
5354
img_diff = Image.new('RGBA', img_a.size)
5455
mismatch = pixelmatch(img_a, img_b, img_diff, threshold=threshold, fail_fast=fail_fast)
55-
if mismatch == 0:
56+
if mismatch <= max_diff_pixels_count:
5657
return
5758
else:
5859
# Create new test_results folder

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name='pytest-assert-screenshot',
7-
version='1.0.0.dev1',
7+
version='1.0.0.dev2',
88
author='Dmitry Vorobjev',
99
author_email='dmitry.vorobjev@gmail.com',
1010
description='A pytest fixture for visual testing',

0 commit comments

Comments
 (0)