Skip to content

Commit

Permalink
Version 3.21rc0
Browse files Browse the repository at this point in the history
  • Loading branch information
mborsetti committed Apr 14, 2024
1 parent 5dd1e01 commit 8ba8cbf
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 3 additions & 2 deletions docs/dependencies.rst
Expand Up @@ -37,8 +37,6 @@ square brackets, like this::
| ``bs4`` method of the | * `beautifulsoup4 <https://www.crummy.com/software/BeautifulSoup/>`__ |
| html2text filter | |
+-------------------------+-------------------------------------------------------------------------+
| ``deepdiff`` differ | * `deepdiff <https://github.com/seperman/deepdiff>`__ |
+-------------------------+-------------------------------------------------------------------------+
| ``html5lib`` parser for | * `html5lib <https://pypi.org/project/html5lib/>`__ |
| the bs4 method of the | |
| html2text filter | |
Expand Down Expand Up @@ -71,6 +69,9 @@ square brackets, like this::
+-------------------------+-------------------------------------------------------------------------+
| ``deepdiff`` differ | * `deepdiff <https://github.com/seperman/deepdiff>`__ |
+-------------------------+-------------------------------------------------------------------------+
| ``deepdiff_xml`` differ | * `deepdiff <https://github.com/seperman/deepdiff>`__ |
| for XML | * `xmltodict <https://github.com/martinblech/xmltodict>`__ |
+-------------------------+-------------------------------------------------------------------------+
| :underline:`Reporters` |
+-------------------------+-------------------------------------------------------------------------+
| ``matrix`` reporter | * `matrix_client <https://github.com/matrix-org/matrix-python-sdk>`__ |
Expand Down
2 changes: 2 additions & 0 deletions docs/differs.rst
Expand Up @@ -369,6 +369,8 @@ This differ is currently in BETA and the directives may change in the future.

* ``data_type`` (``url``, ``filename``, or ``bytes``): What the data represent: a link to the image, the path to the
file containing the image or the image itself as bytes (default: ``url``).
* ``mse_threshold`` (float): The minimum mean squared error (MSE) between two images to consider them changed;
requires the package ``numppy`` to be installed (default: 2.5).

Required packages
`````````````````
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Expand Up @@ -78,6 +78,7 @@ pypdf = ['pypdf']
pypdf_crypto = ['pypdf', 'cryptography']
# differs
deepdiff = ['deepdiff']
deepdiff_xml = ['deepdiff', 'xmltodict']
imagediff = ['Pillow']
# reporters
matrix = ['matrix_client']
Expand All @@ -89,7 +90,7 @@ redis = ['redis']
requests = ['requests']
safe_password = ['keyring']
all = [
'webchanges[use_browser,beautify,bs4,html5lib,ical2text,jq,ocr,pdf2text,pypdf_crypto,deepdiff,imagediff,matrix,pushbullet,pushover,xmpp,redis,requests,safe_password]'
'webchanges[use_browser,beautify,bs4,html5lib,ical2text,jq,ocr,pdf2text,pypdf_crypto,deepdiff_xml,imagediff,matrix,pushbullet,pushover,xmpp,redis,requests,safe_password]'
]


Expand Down
3 changes: 2 additions & 1 deletion tests/requirements_pytest.txt
Expand Up @@ -19,7 +19,8 @@ jsbeautifier
keyring
matrix-client
minidb
Pillow
numpy; python_version == '3.12
Pillow; python_version == '3.12
playwright
psutil
pushbullet.py
Expand Down
7 changes: 3 additions & 4 deletions tests/test_jobs.py
Expand Up @@ -51,6 +51,7 @@ def is_connected() -> bool:
Callable[[Callable], Callable],
pytest.mark.skipif(sys.version_info < (3, 12), reason='Time ' 'consuming; testing latest version only'),
)

TEST_JOBS = [
(
{
Expand Down Expand Up @@ -131,8 +132,6 @@ def is_connected() -> bool:
'test echo command',
),
]


TEST_ALL_URL_JOBS = [
{},
{'use_browser': True},
Expand Down Expand Up @@ -362,8 +361,8 @@ def test_check_ignore_http_error_codes_and_error_message(job_data: dict[str, Any
job_data['ignore_http_error_codes'] = None


@py_latest_only # type: ignore[misc]
@connection_required # type: ignore[misc]
@py_latest_only
@connection_required
def test_stress_use_browser() -> None:
jobs_file = data_path.joinpath('jobs-use_browser.yaml')
config_file = data_path.joinpath('config.yaml')
Expand Down
3 changes: 2 additions & 1 deletion webchanges/differs.py
Expand Up @@ -940,7 +940,8 @@ def compute_diff_image(img1: Image, img2: Image) -> tuple[Image, Optional[np.flo
return {'text': '', 'markdown': '', 'html': ''}

diff_image, mse_value = compute_diff_image(old_image, new_image)
logger.debug(f'Job {self.job.index_number}: MSE value {mse_value:.2f}')
if mse_value:
logger.debug(f'Job {self.job.index_number}: MSE value {mse_value:.2f}')

if mse_value and mse_value < mse_threshold:
logger.info(
Expand Down

0 comments on commit 8ba8cbf

Please sign in to comment.