Skip to content

[MPT-19878] Enabled skipped catalog e2e tests#273

Merged
robcsegal merged 1 commit intomainfrom
MPT-19878-enable-skipped-catalog-tests
Apr 2, 2026
Merged

[MPT-19878] Enabled skipped catalog e2e tests#273
robcsegal merged 1 commit intomainfrom
MPT-19878-enable-skipped-catalog-tests

Conversation

@robcsegal
Copy link
Copy Markdown
Contributor

@robcsegal robcsegal commented Apr 2, 2026

This pull request primarily removes @pytest.mark.skip decorators from several end-to-end test cases, enabling tests that were previously skipped due to concerns about leaving test data in the system or features not being implemented. Additionally, there are minor refactorings to improve result variable naming and test assertions, as well as a change to apply pytest.mark.flaky globally in some test modules rather than per test. These changes aim to expand test coverage and improve test maintainability.

Test enablement and coverage:

  • Removed @pytest.mark.skip from review, publish, and unpublish tests for items, documents, and products, activating tests that were previously skipped due to side effects or incomplete implementation. [1] [2] [3] [4] [5] [6] [7] [8]

Test refactoring and consistency:

  • Updated result variable usage and assertions in publish/unpublish tests to consistently check the returned object’s status after actions. [1] [2] [3] [4]

Test reliability annotation:

  • Applied pytest.mark.flaky at the module level in product test files, removing redundant per-test decorators for cleaner code. [1] [2] [3] [4]

Overall, these changes will lead to more comprehensive and maintainable test suites by enabling important tests and improving code clarity.

Closes MPT-19878

Release Notes

  • Enabled previously skipped catalog e2e tests across items, documents, and products by removing @pytest.mark.skip decorators
  • Refactored publish/unpublish test assertions to consistently check the returned result object's status instead of reusing test data variables
  • Moved pytest.mark.flaky decorators to module level in product test files (test_async_product.py and test_sync_product.py), eliminating per-test redundant flaky markers
  • Activated test_review_and_publish_item for both sync and async item tests
  • Activated test_review_and_publish_document for both sync and async document tests
  • Activated test_product_review_and_publish for both sync and async product tests
  • Activated test_create for units of measure tests (sync and async)
  • Expanded overall e2e test coverage and improved test maintainability

@robcsegal robcsegal requested a review from a team as a code owner April 2, 2026 13:53
@robcsegal robcsegal requested review from d3rky and jentyk April 2, 2026 13:53
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 2, 2026

📝 Walkthrough

Walkthrough

This pull request enables previously skipped end-to-end tests across multiple catalog test modules by removing pytest.mark.skip decorators. Several test methods are updated to capture and assert against return values from operations. Module-level pytestmark declarations are added to product test files to apply the flaky marker uniformly across all tests, replacing individual per-test decorators.

Changes

Cohort / File(s) Summary
Item Tests
tests/e2e/catalog/items/test_async_item.py, tests/e2e/catalog/items/test_sync_item.py
Removed @pytest.mark.skip decorator from test_review_and_publish_item, enabling the test. Updated publish operation to capture return value in result variable and changed assertion from item.status to result.status.
Document Tests
tests/e2e/catalog/product/documents/test_async_document.py, tests/e2e/catalog/product/documents/test_sync_document.py
Removed @pytest.mark.skip decorator from test_review_and_publish_document variants, enabling tests. Updated unpublish operation to capture return value in result and assert result.status == "Unpublished" instead of checking document.status.
Product Tests
tests/e2e/catalog/product/test_async_product.py, tests/e2e/catalog/product/test_sync_product.py
Added module-level pytestmark = [pytest.mark.flaky] and removed individual @pytest.mark.flaky decorators from six test functions. Removed @pytest.mark.skip decorator from test_product_review_and_publish, enabling the test. Added inline comment to publish operation.
Units of Measure Tests
tests/e2e/catalog/units_of_measure/test_async_units_of_measure.py, tests/e2e/catalog/units_of_measure/test_sync_units_of_measure.py
Removed @pytest.mark.skip(reason="Not implemented yet") decorator from test_create, enabling the test to run in the e2e suite.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • mpt-api-python-client#146: Added the initial units_of_measure test modules with skip markers; this PR removes those skip decorators and enables the tests to run.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Jira Issue Key In Title ✅ Passed The PR title contains the Jira issue key MPT-19878 in the correct MPT-XXXX format.
Test Coverage Required ✅ Passed PR modifies 153 code files in mpt_api_client/ and 407 test files in tests/, satisfying the requirement that test files accompany code changes.
Single Commit Required ✅ Passed The pull request contains exactly one commit with hash 5a5c58c and message 'Enabled skipped catalog e2e tests', satisfying requirements for clean git history.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 2, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
tests/e2e/catalog/product/test_sync_product.py (1)

35-38: Consider adding an assertion to verify publish succeeded.

Same as the async product test: this test lacks assertions after publish(), unlike the item and document tests in this PR that verify result.status == "Published". Adding assertions would ensure the test fails on actual publish errors rather than silently passing.

♻️ Suggested improvement
 def test_product_review_and_publish(mpt_vendor, mpt_ops, created_product):
-    mpt_vendor.catalog.products.review(created_product.id)
+    product = mpt_vendor.catalog.products.review(created_product.id)
+    assert product.status == "Pending"

-    mpt_ops.catalog.products.publish(created_product.id)  # act
+    result = mpt_ops.catalog.products.publish(created_product.id)
+
+    assert result.status == "Published"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/catalog/product/test_sync_product.py` around lines 35 - 38, The
test_product_review_and_publish test calls
mpt_vendor.catalog.products.review(created_product.id) and then
mpt_ops.catalog.products.publish(created_product.id) but doesn't assert the
publish outcome; modify the test to capture the publish return (e.g., assign the
result of mpt_ops.catalog.products.publish(created_product.id) to a variable)
and add an assertion that result.status == "Published" (or the appropriate
success status) and optionally assert the returned object's id matches
created_product.id to ensure the publish actually succeeded.
tests/e2e/catalog/product/test_async_product.py (1)

39-43: Consider adding an assertion to verify publish succeeded.

Unlike the item and document tests in this PR, test_product_review_and_publish does not assert on the returned status after publish(). For consistency and to catch publish failures, consider capturing and verifying the result:

♻️ Suggested improvement
 async def test_product_review_and_publish(async_mpt_vendor, async_mpt_ops, async_created_product):
-    await async_mpt_vendor.catalog.products.review(async_created_product.id)
+    product = await async_mpt_vendor.catalog.products.review(async_created_product.id)
+    assert product.status == "Pending"

-    await async_mpt_ops.catalog.products.publish(async_created_product.id)  # act
+    result = await async_mpt_ops.catalog.products.publish(async_created_product.id)
+
+    assert result.status == "Published"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/catalog/product/test_async_product.py` around lines 39 - 43, The
test_product_review_and_publish test calls review() and then awaits
async_mpt_ops.catalog.products.publish(async_created_product.id) but doesn't
assert the publish result; capture the result of publish (e.g., result = await
async_mpt_ops.catalog.products.publish(async_created_product.id)) and add an
assertion that verifies the operation succeeded—either by asserting a returned
status field equals the expected value (for example "published") or by fetching
the product after publish and asserting its state is published; reference the
test function test_product_review_and_publish, the methods review() and
publish(), and the async_created_product.id when locating where to add the
capture-and-assert.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/e2e/catalog/product/test_async_product.py`:
- Around line 39-43: The test_product_review_and_publish test calls review() and
then awaits async_mpt_ops.catalog.products.publish(async_created_product.id) but
doesn't assert the publish result; capture the result of publish (e.g., result =
await async_mpt_ops.catalog.products.publish(async_created_product.id)) and add
an assertion that verifies the operation succeeded—either by asserting a
returned status field equals the expected value (for example "published") or by
fetching the product after publish and asserting its state is published;
reference the test function test_product_review_and_publish, the methods
review() and publish(), and the async_created_product.id when locating where to
add the capture-and-assert.

In `@tests/e2e/catalog/product/test_sync_product.py`:
- Around line 35-38: The test_product_review_and_publish test calls
mpt_vendor.catalog.products.review(created_product.id) and then
mpt_ops.catalog.products.publish(created_product.id) but doesn't assert the
publish outcome; modify the test to capture the publish return (e.g., assign the
result of mpt_ops.catalog.products.publish(created_product.id) to a variable)
and add an assertion that result.status == "Published" (or the appropriate
success status) and optionally assert the returned object's id matches
created_product.id to ensure the publish actually succeeded.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f392ff0c-efa4-49c5-8846-ad5701ea3a91

📥 Commits

Reviewing files that changed from the base of the PR and between af7862f and 5a5c58c.

📒 Files selected for processing (8)
  • tests/e2e/catalog/items/test_async_item.py
  • tests/e2e/catalog/items/test_sync_item.py
  • tests/e2e/catalog/product/documents/test_async_document.py
  • tests/e2e/catalog/product/documents/test_sync_document.py
  • tests/e2e/catalog/product/test_async_product.py
  • tests/e2e/catalog/product/test_sync_product.py
  • tests/e2e/catalog/units_of_measure/test_async_units_of_measure.py
  • tests/e2e/catalog/units_of_measure/test_sync_units_of_measure.py
💤 Files with no reviewable changes (2)
  • tests/e2e/catalog/units_of_measure/test_async_units_of_measure.py
  • tests/e2e/catalog/units_of_measure/test_sync_units_of_measure.py

@robcsegal robcsegal merged commit 29f9caf into main Apr 2, 2026
4 checks passed
@robcsegal robcsegal deleted the MPT-19878-enable-skipped-catalog-tests branch April 2, 2026 14:20
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