Skip to content

APP-6435: Added support for vcrpy test utilities to mock HTTP interactions with 3rd-party APIs #612

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Aryamanz29
Copy link
Member

@Aryamanz29 Aryamanz29 commented Apr 25, 2025

TODOs

  • Add documentation for VCR utilities and fixtures.
  • Add example tests using vcr to demonstrate HTTP interaction recording and playback.

Sample snippet:

from pyatlan.test_utils.base_vcr import BaseVCR

class TestBaseVCR(BaseVCR):
    @pytest.mark.vcr()
    def test_sample_get(self):
        response = requests.get("https://www.google.com/")
        assert response.status_code == 201

@Aryamanz29 Aryamanz29 added the test Pyatlan test pull request label Apr 25, 2025
@Aryamanz29 Aryamanz29 self-assigned this Apr 25, 2025
@Aryamanz29 Aryamanz29 requested a review from Copilot April 25, 2025 10:24
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 PR adds support for vcrpy test utilities to mock HTTP interactions in tests by introducing a new BaseVCR class and related serializers, along with an error class for handling missing dependencies.

  • Introduces DependencyNotFoundError in utils.py to provide a clear message when required dependencies are missing.
  • Adds BaseVCR and its supporting serializers (for pretty-printing YAML and JSON bodies) along with utilities to clean headers in test_utils/base_vcr.py.
  • Updates copyright information in test_utils/init.py.

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
pyatlan/utils.py Adds DependencyNotFoundError for better dependency handling.
pyatlan/test_utils/base_vcr.py Implements the BaseVCR class with custom serializers and header filtering.
pyatlan/test_utils/init.py Updates copyright year to 2025.
Files not reviewed (1)
  • requirements-dev.txt: Language not supported

@Aryamanz29 Aryamanz29 force-pushed the APP-6435 branch 3 times, most recently from 86c0562 to f5075aa Compare April 25, 2025 11:12
@Aryamanz29 Aryamanz29 requested a review from Copilot April 25, 2025 11:14
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 adds support for vcrpy test utilities to mock HTTP interactions with third-party APIs. Key changes include:

  • Introducing the BaseVCR class with custom JSON and YAML serializers and pytest fixtures for VCR configuration.
  • Updating copyright notices in test_utils.
  • Adding the DependencyNotFoundError exception to handle missing dependencies.

Reviewed Changes

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

File Description
pyatlan/test_utils/base_vcr.py Implements VCR support with custom serializers and fixtures.
pyatlan/test_utils/init.py Updates the copyright year to 2025.
pyatlan/errors.py Adds the DependencyNotFoundError for missing dependencies.
Files not reviewed (1)
  • requirements-dev.txt: Language not supported

…onfigurations

- Introduced integration tests using VCR for recording and replaying HTTP interactions with JSON and YAML formats.
- Applied class-specific VCR configurations to handle both JSON and YAML serializers for different test scenarios.
@Aryamanz29 Aryamanz29 force-pushed the APP-6435 branch 2 times, most recently from 27c79e4 to 881005d Compare April 28, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Pyatlan test pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant