Skip to content

PTHMINT-112: Improve E2E test environment isolation#53

Open
zulquer wants to merge 3 commits intomasterfrom
PTHMINT-112
Open

PTHMINT-112: Improve E2E test environment isolation#53
zulquer wants to merge 3 commits intomasterfrom
PTHMINT-112

Conversation

@zulquer
Copy link
Copy Markdown
Collaborator

@zulquer zulquer commented Apr 6, 2026

Use a dedicated E2E_API_KEY, centralize E2E SDK bootstrap in shared fixtures, and keep end-to-end tests isolated from the general SDK environment configuration. Update the E2E documentation and environment example accordingly.

Use a dedicated E2E_API_KEY, centralize E2E SDK bootstrap in shared fixtures, and keep end-to-end tests isolated from the general SDK environment configuration. Update the E2E documentation and environment example accordingly.
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.81%. Comparing base (ee15a54) to head (b94cd02).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #53   +/-   ##
=======================================
  Coverage   90.81%   90.81%           
=======================================
  Files         147      147           
  Lines        2579     2579           
=======================================
  Hits         2342     2342           
  Misses        237      237           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

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 improves end-to-end (E2E) test isolation by introducing a dedicated E2E_API_KEY and centralizing E2E SDK creation in shared pytest fixtures, keeping E2E configuration separate from the general SDK environment setup.

Changes:

  • Added E2E_API_KEY handling and shared e2e_sdk / e2e_sdk_factory fixtures in tests/multisafepay/e2e/conftest.py.
  • Updated E2E example tests to consume the shared fixtures instead of reading API_KEY + .env per module.
  • Documented the dedicated E2E environment variable in README.md and .env.example.

Reviewed changes

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

Show a summary per file
File Description
tests/multisafepay/e2e/conftest.py Adds session-scoped E2E API key + SDK factory fixtures and skips E2E suite cleanly when missing.
tests/multisafepay/e2e/examples/transport/test_custom_urllib3_transport.py Switches to e2e_sdk_factory and updates docs to E2E_API_KEY.
tests/multisafepay/e2e/examples/transport/test_custom_requests_session_transport.py Switches to e2e_sdk_factory for custom requests.Session transport.
tests/multisafepay/e2e/examples/transport/test_custom_httpx_transport.py Switches to e2e_sdk_factory and updates docs to E2E_API_KEY.
tests/multisafepay/e2e/examples/transaction_manager/test_get_transactions.py Uses shared e2e_sdk fixture instead of loading env vars locally.
tests/multisafepay/e2e/examples/recurring_manager/test_recurring.py Uses shared e2e_sdk fixture for SDK setup.
tests/multisafepay/e2e/examples/payment_method_manager/test_get_payment_methods.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/payment_method_manager/test_get_by_gateway_code.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/order_manager/test_update.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/order_manager/test_refund.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/order_manager/test_refund_by_shopping_cart.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/order_manager/test_refund_by_item.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/order_manager/test_get_order.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/order_manager/test_create.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/order_manager/test_capture.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/me_manager/test_get_me.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/issuer_manager/test_get_issuers_by_gateway_code.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/gateway_manager/test_get_gateways.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/gateway_manager/test_get_by_code.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/category_manager/test_get_categories.py Uses shared e2e_sdk fixture for manager creation.
tests/multisafepay/e2e/examples/capture_manager/test_capture_reservation_cancel.py Uses shared e2e_sdk fixture for SDK setup.
tests/multisafepay/e2e/examples/auth_manager/test_get_api_token.py Uses shared e2e_sdk fixture for manager creation.
README.md Documents E2E test environment targeting and E2E_API_KEY usage.
.env.example Adds E2E_API_KEY alongside API_KEY.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@zulquer zulquer requested a review from danielcivit April 7, 2026 08:03
zulquer added 2 commits April 13, 2026 10:38
Ensure E2E fixtures remain isolated from local custom-base-url overrides. The E2E SDK factory now temporarily clears MSP_SDK_BUILD_PROFILE, MSP_SDK_ALLOW_CUSTOM_BASE_URL and MSP_SDK_CUSTOM_BASE_URL while instantiating the SDK, then restores previous values. Added a guard to assert the resulting client URL is Client.TEST_URL, so E2E always targets the test environment when using E2E_API_KEY.
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.

2 participants