Skip to content

Replace httpretty with requests-mock, update runtimes and add type annotations #24

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

Merged
merged 5 commits into from
Mar 18, 2025

Conversation

rkoopmans
Copy link
Contributor

No description provided.

@rkoopmans rkoopmans requested a review from Copilot March 17, 2025 17:39
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request updates the test suite to replace HTTPretty with requests-mock and adjusts the supported runtimes. Key changes include converting tests from unittest to pytest style, revising mocking handlers and fixtures accordingly, and updating runtime support (dropping Python 3.7 and adding Python 3.12/3.13).

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/conftest.py Introduces new pytest fixtures including dummy_file and reset_tinify fixtures; adds a mock_requests fixture using requests-mock.
test/integration.py Refactors integration tests to pytest-style functions and updates assertions.
test/tinify_test.py Converts tests from HTTPretty-based mocking to using requests-mock; updates client and app identifier tests.
test/tinify_result_meta_test.py Updates meta tests to use pytest fixtures and assertions.
test/tinify_result_test.py Rewrites result tests in pytest style with streamlined assertions.
setup.py Updates installation and test dependencies; revises package metadata and classifiers.
CHANGES.md Documents runtime support changes and the switch from HTTPretty to requests-mock.
.github/workflows/ci-cd.yml Adjusts the testing matrix to match the new runtime support.
test/tinify_source_test.py Refactors source tests to pytest style; updates mocking logic and helper functions.
tinify/version.py Bumps the version to 1.6.1.
test/helper.py Removes deprecated helper methods previously based on HTTPretty.
Comments suppressed due to low confidence (2)

setup.py:40

  • The classifiers still list Python 2.7 even though the changelog indicates dropping Python 3.7; please verify the intended supported Python versions and update the classifiers accordingly to avoid confusion.
"Programming Language :: Python :: 2.7",

test/tinify_source_test.py:11

  • [nitpick] Consider removing this duplicate helper function if a shared version exists in the conftest.py to reduce code duplication and maintain a single source of truth for temporary file creation.
def create_named_tmpfile():

@rkoopmans rkoopmans changed the title Replace httpretty with requests-mock and update runtimes Replace httpretty with requests-mock, update runtimes and add type annotations Mar 18, 2025
@rkoopmans rkoopmans merged commit 4f5365b into tinify:master Mar 18, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant