Test suite refactor - #440
Draft
Sachin1043 wants to merge 3 commits into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor: modernize the ecommerce_integrations test suite
Summary
Migrates every integration's tests (Amazon, Shopify, Unicommerce) onto a single shared test-suite base, modernizes the app's source for ERPNext v16, and bumps dependencies. Net effect is a leaner, self-contained, and faster test suite with the app code updated to current framework APIs.
Test infrastructure
ecommerce_integrations/tests/utils.py(EcommerceTestSuite) — a central suite all integration tests now inherit from, providing consistent setup, fixture loading (load_fixture), and transaction-based isolation.before_testshook (hooks.py) and deletedecommerce_integrations/utils/before_test.py.amazon/tests/utils.py; rewrittenshopify/tests/utils.pyandunicommerce/tests/utils.py— HTTP now mocked with theresponseslibrary instead of live/ad-hoc mocks.test_data.jsonmoved intoamazon/tests/fixtures/; removed the obsoleteshopify/tests/test_order.py.Source modernization (ERPNext v16 compatibility)
mappermodules —make_sales_invoice,make_delivery_note,make_sales_return— acrossshopify/fulfillment.py,shopify/invoice.py,unicommerce/invoice.py,unicommerce/delivery_note.py,unicommerce/cancellation_and_returns.py.unicommerce/invoice.py: replaced a rawfrappe.db.sqlUPDATE with thefrappe.qbquery builder.ecommerce_integration_log.py: made logging test-safe — skipscommit()/rollback()underfrappe.flags.in_testso log writes don't break test isolation.Efficiency cleanups
unicommerce/tests/utils.py: simplified theenable_settingdecorator — dropped the redundant read +finallyrestore (per-test rollback already undoes it).amazon/tests/utils.py: removed the pointless retry/time.sleep(3)loop in the mock SP-API caller (mocks are deterministic).shopify/.../test_shopify_import_products.py: reuse the inheritedload_fixture()instead of manual file I/O.unicommerce/tests/test_customer.py: removed a redundantsetUpClassoverride (base suite already seeds channels via the non-deprecated path).Dependencies (
pyproject.toml)boto3~=1.28.10->>=1.35.0responses == 0.23.1(HTTP mocking).