Skip to content

Conversation

@jentyk
Copy link
Contributor

@jentyk jentyk commented Nov 28, 2025

Summary by CodeRabbit

  • Tests
    • Added comprehensive end-to-end sync and async tests for notification category management: create, retrieve, update, list, filter, publish/unpublish, and delete flows.
    • Added fixtures supplying sample category data and a static invalid identifier for negative cases.
    • Includes teardown cleanup with error handling, explicit not-found/error assertions, and several tests marked flaky or skipped for performance.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Nov 28, 2025

Walkthrough

Adds two pytest fixtures and two new end-to-end test modules (async and sync) for notification categories, covering create, get, update, list/filter, publish/unpublish, delete, and not-found scenarios with teardown cleanup and error handling.

Changes

Cohort / File(s) Summary
Category Test Fixtures
tests/e2e/notifications/categories/conftest.py
Adds two pytest fixtures: category_data(short_uuid) returning a dict with name, description, and externalId; and invalid_category_id() returning the static string "NCT-000-000-000" for negative tests.
Async Category E2E Tests
tests/e2e/notifications/categories/test_async_categories.py
Adds an async test module with async_created_category fixture that creates a category via the async operations client and attempts deletion in teardown (logs on failure). Includes tests for create, get-by-id, update, list, RQLQuery filtering, publish/unpublish, not-found retrieval, delete, and delete-not-found behaviours.
Sync Category E2E Tests
tests/e2e/notifications/categories/test_sync_categories.py
Adds a sync test module with created_category fixture (create + teardown) and tests for create, get, update, list, RQLQuery filtering, publish/unpublish, not-found cases, delete, and delete-not-found.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Verify fixture payload fields and short_uuid usage in tests/e2e/notifications/categories/conftest.py.
  • Inspect teardown deletion and MPTAPIError handling in test_async_categories.py and test_sync_categories.py.
  • Check RQLQuery construction, list/filter assertions, and publish/unpublish payloads and response ID validations.

Suggested reviewers

  • d3rky
  • svazquezco
  • alephsur
  • ruben-sebrango
  • robcsegal

Poem

🐰 I nibble at tests in a quiet den,
New categories hop out and back again.
Async hops and sync skips on the floor,
Teardown sweeps crumbs so the suite can soar.
I twitch my nose and ready one test more.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding synchronous and asynchronous end-to-end tests for notification categories, which is accurately reflected in the raw summary showing new test files and fixtures.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/MPT-14932

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

@github-actions
Copy link

github-actions bot commented Nov 28, 2025

Warnings
⚠️

This PR contains 2 commits.

Please squash them into a single commit to keep the git history clean and easy to follow.

Multiple commits are acceptable only in the following cases:

  1. One commit is a technical refactoring, and another introduces business logic changes.
  2. You are doing a complex multi-step refactoring (although in this case we still recommend splitting it into separate PRs).

✅ Found Jira issue key in the title: MPT-14932

Generated by 🚫 dangerJS against 6769a91

@jentyk jentyk force-pushed the feat/MPT-14932 branch 4 times, most recently from 51879f0 to 71a42f9 Compare December 1, 2025 09:23
@jentyk jentyk marked this pull request as ready for review December 1, 2025 09:23
Copy link

@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.

Actionable comments posted: 3

🧹 Nitpick comments (3)
tests/e2e/notifications/categories/test_async_categories.py (2)

9-18: Drop obsolete # noqa: WPS421 to satisfy Ruff

Ruff reports RUF100 here because WPS421 is unknown in the current lint configuration. Since the print in tests is acceptable, you can just remove the outdated noqa directive.

-    except MPTAPIError as error:
-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+    except MPTAPIError as error:
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")

88-92: Reuse invalid_category_id fixture for consistency

Here you hard-code the invalid ID instead of using the invalid_category_id fixture defined in tests/e2e/notifications/categories/conftest.py, which you already use in test_delete_category_not_found. Reusing the fixture keeps the value consistent across tests.

-async def test_category_not_found(async_mpt_vendor):
+async def test_category_not_found(async_mpt_vendor, invalid_category_id):
@@
-    with pytest.raises(MPTAPIError):
-        await service.get("NCT-000-000-000")
+    with pytest.raises(MPTAPIError):
+        await service.get(invalid_category_id)
tests/e2e/notifications/categories/test_sync_categories.py (1)

9-17: Remove outdated # noqa: WPS421 on teardown print

As in the async tests, Ruff flags WPS421 as an unknown/unused noqa code. Since the print in test teardown is acceptable, you can drop the directive.

-    except MPTAPIError as error:
-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+    except MPTAPIError as error:
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 416dec4 and 71a42f9.

📒 Files selected for processing (3)
  • tests/e2e/notifications/categories/conftest.py (1 hunks)
  • tests/e2e/notifications/categories/test_async_categories.py (1 hunks)
  • tests/e2e/notifications/categories/test_sync_categories.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
tests/e2e/notifications/categories/conftest.py (1)
tests/e2e/conftest.py (1)
  • short_uuid (101-102)
tests/e2e/notifications/categories/test_sync_categories.py (4)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/conftest.py (2)
  • mpt_ops (31-32)
  • mpt_client (43-44)
tests/e2e/notifications/categories/conftest.py (1)
  • category_data (5-10)
tests/e2e/notifications/categories/test_async_categories.py (5)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/conftest.py (2)
  • async_mpt_ops (36-39)
  • async_mpt_vendor (24-27)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
🪛 GitHub Actions: PR build and merge
tests/e2e/notifications/categories/test_async_categories.py

[error] 20-20: RUF029 Function test_create_category is declared async, but doesn't await or use async features. Command failed: docker compose run --service-ports app_test

🪛 Ruff (0.14.6)
tests/e2e/notifications/categories/test_sync_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)

tests/e2e/notifications/categories/test_async_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)

🔇 Additional comments (1)
tests/e2e/notifications/categories/conftest.py (1)

4-15: Category fixtures are clear and reusable

The category_data and invalid_category_id fixtures are well-scoped and give you unique, easily identifiable test data without leaking implementation details into individual tests. No changes needed.

Copy link

@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.

Actionable comments posted: 3

♻️ Duplicate comments (3)
tests/e2e/notifications/categories/test_async_categories.py (2)

20-23: Fix incorrect await and remove async from test function.

Line 21 incorrectly awaits async_created_category.name. The fixture yields the created category object (not a coroutine), so accessing .name is synchronous. Additionally, as flagged in past reviews, this test contains no await statements and triggers RUF029.

Based on learnings, async fixtures are automatically resolved by pytest-asyncio, so the test receives the yielded value directly.

Apply this diff:

-async def test_create_category(async_created_category, category_data):
-    assert await async_created_category.name == category_data["name"]
+def test_create_category(async_created_category, category_data):
+    assert async_created_category.name == category_data["name"]
     assert async_created_category.description == category_data["description"]

95-101: Assert not-found after delete to validate behavior.

After deleting the category, calling get must assert that MPTAPIError is raised, consistent with test_category_not_found and test_delete_category_not_found. As written, the test passes regardless of whether get succeeds or fails, leaving the delete behavior unverified.

 async def test_delete_category(async_mpt_ops, async_created_category):
     service = async_mpt_ops.notifications.categories
 
     await service.delete(async_created_category.id)
 
-    await service.get(async_created_category.id)
+    with pytest.raises(MPTAPIError):
+        await service.get(async_created_category.id)
tests/e2e/notifications/categories/test_sync_categories.py (1)

92-98: Add assertion to verify deleted category raises error on get.

The test calls service.get(created_category.id) after service.delete() without asserting the expected MPTAPIError. This causes a correct 404 response to fail the test with an unhandled exception, while a hypothetical successful get (indicating delete didn't work) would pass silently. This also addresses the AAA01 pipeline failure.

 def test_delete_category(mpt_ops, created_category):
     service = mpt_ops.notifications.categories
 
     service.delete(created_category.id)
 
-    service.get(created_category.id)
+    with pytest.raises(MPTAPIError):
+        service.get(created_category.id)
🧹 Nitpick comments (2)
tests/e2e/notifications/categories/test_async_categories.py (1)

17-17: Remove or update the noqa directive.

The # noqa: WPS421 directive is unused because Ruff doesn't recognize wemake-python-styleguide codes. Either remove it entirely or suppress the equivalent Ruff rule if needed.

Apply this diff:

-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")
tests/e2e/notifications/categories/test_sync_categories.py (1)

17-17: Remove or update the noqa directive.

The # noqa: WPS421 directive is unused because Ruff doesn't recognize wemake-python-styleguide codes. Either remove it entirely or suppress the equivalent Ruff rule if needed.

Apply this diff:

-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71a42f9 and a21a332.

📒 Files selected for processing (3)
  • tests/e2e/notifications/categories/conftest.py (1 hunks)
  • tests/e2e/notifications/categories/test_async_categories.py (1 hunks)
  • tests/e2e/notifications/categories/test_sync_categories.py (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:54.691Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.

Applied to files:

  • tests/e2e/notifications/categories/test_async_categories.py
🧬 Code graph analysis (3)
tests/e2e/notifications/categories/conftest.py (1)
tests/e2e/conftest.py (1)
  • short_uuid (101-102)
tests/e2e/notifications/categories/test_sync_categories.py (5)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/conftest.py (2)
  • mpt_ops (31-32)
  • mpt_client (43-44)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
tests/e2e/notifications/categories/test_async_categories.py (2)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
mpt_api_client/models/model.py (1)
  • id (119-121)
🪛 GitHub Actions: PR build and merge
tests/e2e/notifications/categories/test_sync_categories.py

[error] 20-20: wemake-python-styleguide: AAA01 no Act block found in test


[error] 66-66: wemake-python-styleguide: AAA05 blank line in block


[error] 69-69: wemake-python-styleguide: AAA05 blank line in block


[error] 71-71: wemake-python-styleguide: AAA03 expected 1 blank line before Act block, found none


[error] 78-78: wemake-python-styleguide: AAA05 blank line in block


[error] 80-80: wemake-python-styleguide: AAA03 expected 1 blank line before Act block, found none


[error] 92-92: wemake-python-styleguide: AAA01 no Act block found in test

🪛 Ruff (0.14.6)
tests/e2e/notifications/categories/test_sync_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)

tests/e2e/notifications/categories/test_async_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)

🔇 Additional comments (1)
tests/e2e/notifications/categories/conftest.py (1)

4-15: LGTM!

The fixtures are well-structured and provide clean test data for the E2E test suite.

@jentyk jentyk force-pushed the feat/MPT-14932 branch 2 times, most recently from a3b32fc to 76c4e2b Compare December 1, 2025 09:46
Copy link

@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.

Actionable comments posted: 1

♻️ Duplicate comments (6)
tests/e2e/notifications/categories/test_async_categories.py (3)

88-93: Use the invalid_category_id fixture for consistency.

The test hardcodes "NCT-000-000-000" instead of using the invalid_category_id fixture defined in conftest.py. Using the fixture improves maintainability and consistency with test_delete_category_not_found.

Apply this diff:

-async def test_category_not_found(async_mpt_vendor):
+async def test_category_not_found(async_mpt_vendor, invalid_category_id):
     service = async_mpt_vendor.notifications.categories
 
     with pytest.raises(MPTAPIError):
-        await service.get("NCT-000-000-000")
+        await service.get(invalid_category_id)

20-22: Remove async keyword and clean up unnecessary noqa directive.

The function is declared async but contains no await statements, triggering a pipeline error. Additionally, the # noqa: RUF029 directive is unnecessary since RUF029 is not enabled in the current configuration.

Based on learnings, async fixtures are automatically resolved by pytest-asyncio, so this test can be synchronous.

-async def test_create_category(async_created_category, category_data):  # noqa: RUF029
+def test_create_category(async_created_category, category_data):
     assert async_created_category.name == category_data["name"]
     assert async_created_category.description == category_data["description"]

95-101: Assert not-found after delete to validate behavior.

After deleting the category, calling get must assert that MPTAPIError is raised, consistent with test_category_not_found and test_delete_category_not_found. As written, the test passes regardless of whether get succeeds or fails.

 async def test_delete_category(async_mpt_ops, async_created_category):
     service = async_mpt_ops.notifications.categories
 
     await service.delete(async_created_category.id)
 
-    await service.get(async_created_category.id)
+    with pytest.raises(MPTAPIError):
+        await service.get(async_created_category.id)
tests/e2e/notifications/categories/test_sync_categories.py (3)

64-74: Fix AAA pattern violations flagged by pipeline.

The test has incorrect blank line placement for the Arrange-Act-Assert pattern. Remove blank lines within the Arrange block and add a blank line before the Act block.

Apply this diff:

 def test_publish_category(mpt_ops, created_category):
     service = mpt_ops.notifications.categories
-
     unpublish_note_data = {"note": "Unpublishing category for testing"}
     service.unpublish(created_category.id, unpublish_note_data)
-
+
     note_data = {"note": "Publishing category for testing"}
     result = service.publish(created_category.id, note_data)
 
     assert result.id == created_category.id

76-83: Fix AAA pattern violations flagged by pipeline.

The test has incorrect blank line placement. Remove the blank line within the Arrange block and add one before the Act block.

Apply this diff:

 def test_unpublish_category(mpt_ops, created_category):
     service = mpt_ops.notifications.categories
-
+
     unpublish_note_data = {"note": "Unpublishing category for testing"}
     result = service.unpublish(created_category.id, unpublish_note_data)
 
     assert result.id == created_category.id

92-97: Add assertion to verify deleted category raises error on get.

The test calls service.get(created_category.id) after service.delete() without asserting the expected MPTAPIError. This causes a correct 404 response to fail the test with an unhandled exception.

 def test_delete_category(mpt_ops, created_category):
     service = mpt_ops.notifications.categories
 
     service.delete(created_category.id)
 
-    service.get(created_category.id)
+    with pytest.raises(MPTAPIError):
+        service.get(created_category.id)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a21a332 and 76c4e2b.

📒 Files selected for processing (3)
  • tests/e2e/notifications/categories/conftest.py (1 hunks)
  • tests/e2e/notifications/categories/test_async_categories.py (1 hunks)
  • tests/e2e/notifications/categories/test_sync_categories.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/notifications/categories/conftest.py
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.
📚 Learning: 2025-11-27T00:05:54.691Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.

Applied to files:

  • tests/e2e/notifications/categories/test_async_categories.py
🧬 Code graph analysis (2)
tests/e2e/notifications/categories/test_sync_categories.py (5)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/conftest.py (2)
  • mpt_ops (31-32)
  • mpt_client (43-44)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
tests/e2e/notifications/categories/test_async_categories.py (3)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
🪛 GitHub Actions: PR build and merge
tests/e2e/notifications/categories/test_sync_categories.py

[error] 20-20: wemake-python-styleguide violation: AAA01 no Act block found in test.


[error] 66-66: wemake-python-styleguide violation: AAA05 blank line in block.


[error] 69-69: wemake-python-styleguide violation: AAA05 blank line in block.


[error] 71-71: wemake-python-styleguide violation: AAA03 expected 1 blank line before Act block.


[error] 78-78: wemake-python-styleguide violation: AAA05 blank line in block.


[error] 80-80: wemake-python-styleguide violation: AAA03 expected 1 blank line before Act block.


[error] 92-92: wemake-python-styleguide violation: AAA01 no Act block found in test.

🪛 Ruff (0.14.6)
tests/e2e/notifications/categories/test_sync_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)

tests/e2e/notifications/categories/test_async_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)


20-20: Unused noqa directive (non-enabled: RUF029)

Remove unused noqa directive

(RUF100)

@jentyk jentyk force-pushed the feat/MPT-14932 branch 3 times, most recently from bd34c36 to 4abca55 Compare December 1, 2025 13:14
Copy link

@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.

Actionable comments posted: 0

♻️ Duplicate comments (3)
tests/e2e/notifications/categories/test_async_categories.py (2)

20-23: Remove async from test function.

The test is declared async but contains no await statements. Based on learnings, async fixtures are automatically resolved by pytest-asyncio, so this test can be synchronous. The # noqa: RUF029 directive is ineffective (Ruff reports it as unused because RUF029 is not enabled).

Apply this diff:

-async def test_create_category(async_created_category, category_data):  # noqa: RUF029
+def test_create_category(async_created_category, category_data):
     assert async_created_category.name == category_data["name"]
     assert async_created_category.description == category_data["description"]

Based on learnings, async fixtures are automatically resolved before being passed to test functions.


95-101: Critical: Missing assertion after delete.

The test calls await service.get(async_created_category.id) on Line 100 after deletion without asserting that it raises MPTAPIError. This causes the test to fail with an unhandled exception when delete works correctly (404 response), while paradoxically passing if delete fails (category still retrievable).

Apply this diff:

 async def test_delete_category(async_mpt_ops, async_created_category):
     service = async_mpt_ops.notifications.categories
 
     await service.delete(async_created_category.id)
 
-    await service.get(async_created_category.id)
+    with pytest.raises(MPTAPIError):
+        await service.get(async_created_category.id)
tests/e2e/notifications/categories/test_sync_categories.py (1)

92-98: Critical: Missing assertion after delete.

The test calls service.get(created_category.id) on Line 97 after deletion without asserting that it raises MPTAPIError. This causes the test to fail with an unhandled exception when delete works correctly (404 response), while paradoxically passing if delete fails (category still retrievable).

Apply this diff:

 def test_delete_category(mpt_ops, created_category):
     service = mpt_ops.notifications.categories
 
     service.delete(created_category.id)  # act
 
-    service.get(created_category.id)
+    with pytest.raises(MPTAPIError):
+        service.get(created_category.id)
🧹 Nitpick comments (2)
tests/e2e/notifications/categories/test_sync_categories.py (1)

17-17: Remove unused noqa directive.

Ruff reports the # noqa: WPS421 directive as unused/unknown. If wemake-python-styleguide is not active in your linting pipeline, remove this directive.

Apply this diff:

-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")
tests/e2e/notifications/categories/test_async_categories.py (1)

17-17: Remove unused noqa directive.

Ruff reports the # noqa: WPS421 directive as unused/unknown. If wemake-python-styleguide is not active in your linting pipeline, remove this directive.

Apply this diff:

-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76c4e2b and 4abca55.

📒 Files selected for processing (3)
  • tests/e2e/notifications/categories/conftest.py (1 hunks)
  • tests/e2e/notifications/categories/test_async_categories.py (1 hunks)
  • tests/e2e/notifications/categories/test_sync_categories.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/notifications/categories/conftest.py
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.
📚 Learning: 2025-11-27T00:05:54.691Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.

Applied to files:

  • tests/e2e/notifications/categories/test_async_categories.py
🧬 Code graph analysis (2)
tests/e2e/notifications/categories/test_sync_categories.py (3)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
tests/e2e/notifications/categories/test_async_categories.py (4)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/conftest.py (2)
  • async_mpt_ops (36-39)
  • async_mpt_vendor (24-27)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
🪛 Ruff (0.14.6)
tests/e2e/notifications/categories/test_sync_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)

tests/e2e/notifications/categories/test_async_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)


20-20: Unused noqa directive (non-enabled: RUF029)

Remove unused noqa directive

(RUF100)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Copy link

@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.

Actionable comments posted: 1

♻️ Duplicate comments (1)
tests/e2e/notifications/categories/test_async_categories.py (1)

95-101: Assert not-found after delete to validate behavior.

After deleting the category, calling get must assert that MPTAPIError is raised, consistent with test_category_not_found and test_delete_category_not_found. As written, the test passes regardless of whether get succeeds or fails, leaving the delete behavior unverified.

Apply this diff:

 async def test_delete_category(async_mpt_ops, async_created_category):
     service = async_mpt_ops.notifications.categories
 
     await service.delete(async_created_category.id)
 
-    await service.get(async_created_category.id)
+    with pytest.raises(MPTAPIError):
+        await service.get(async_created_category.id)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4abca55 and 34f41a9.

📒 Files selected for processing (1)
  • tests/e2e/notifications/categories/test_async_categories.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.
📚 Learning: 2025-11-27T00:05:54.691Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.

Applied to files:

  • tests/e2e/notifications/categories/test_async_categories.py
🪛 GitHub Actions: PR build and merge
tests/e2e/notifications/categories/test_async_categories.py

[error] 21-21: B015 Pointless comparison. Did you mean to assign a value? Otherwise, prepend assert or remove it.


[error] 22-22: B015 Pointless comparison at end of function scope. Did you mean to return the expression result?

🪛 Ruff (0.14.6)
tests/e2e/notifications/categories/test_async_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)


21-21: Pointless comparison. Did you mean to assign a value? Otherwise, prepend assert or remove it.

(B015)


22-22: Pointless comparison at end of function scope. Did you mean to return the expression result?

(B015)

🔇 Additional comments (10)
tests/e2e/notifications/categories/test_async_categories.py (10)

1-7: LGTM!

The imports and module-level flaky marker are appropriate for async E2E testing.


25-32: LGTM!

The test correctly verifies category retrieval and validates the returned data.


34-45: LGTM!

The update test correctly validates that category fields are updated as expected.


47-53: LGTM!

The test correctly uses async iteration and validates the created category appears in the listing.


55-65: LGTM!

The filter test correctly demonstrates RQL query usage and validates the filtered results.


67-77: LGTM!

The test correctly validates the publish workflow by first unpublishing and then publishing the category.


79-86: LGTM!

The test correctly validates the unpublish operation.


88-93: LGTM!

The test correctly validates not-found error handling using the shared fixture.


103-107: LGTM!

The test correctly validates error handling when attempting to delete a non-existent category.


9-18: The noqa: WPS421 directive is correct and should be retained.

This project uses wemake-python-styleguide, so the directive suppresses a legitimate linter rule for print statements in teardown code. No changes needed.

Copy link

@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.

Actionable comments posted: 2

🧹 Nitpick comments (2)
tests/e2e/notifications/categories/test_sync_categories.py (1)

17-17: Consider removing unused noqa directive if WPS linter is not in use.

Ruff flags the WPS421 noqa as unused since it doesn't recognize wemake-python-styleguide rules. If your project no longer uses the WPS linter, you can safely remove this directive.

Apply this diff if WPS linter is not configured:

-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")
tests/e2e/notifications/categories/test_async_categories.py (1)

17-17: Consider removing unused noqa directives if WPS/AAA linters are not in use.

Ruff flags WPS421 and AAA01 noqa directives as unused since it doesn't recognize wemake-python-styleguide or AAA rules. If your project no longer uses those linters, you can safely remove these directives.

Apply this diff if WPS/AAA linters are not configured:

-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")
-def test_create_category(async_created_category, category_data):  # noqa: AAA01
+def test_create_category(async_created_category, category_data):

Also applies to: 20-20

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34f41a9 and 7f348a6.

📒 Files selected for processing (3)
  • tests/e2e/notifications/categories/conftest.py (1 hunks)
  • tests/e2e/notifications/categories/test_async_categories.py (1 hunks)
  • tests/e2e/notifications/categories/test_sync_categories.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/notifications/categories/conftest.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-27T00:05:54.691Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.

Applied to files:

  • tests/e2e/notifications/categories/test_async_categories.py
🧬 Code graph analysis (2)
tests/e2e/notifications/categories/test_async_categories.py (4)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
tests/e2e/conftest.py (2)
  • async_mpt_ops (36-39)
  • async_mpt_vendor (24-27)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
tests/e2e/notifications/categories/test_sync_categories.py (5)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/conftest.py (2)
  • mpt_ops (31-32)
  • mpt_client (43-44)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
🪛 Ruff (0.14.6)
tests/e2e/notifications/categories/test_async_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)


20-20: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

tests/e2e/notifications/categories/test_sync_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Copy link

@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.

Actionable comments posted: 0

🧹 Nitpick comments (3)
tests/e2e/notifications/categories/test_sync_categories.py (1)

9-18: Remove unused noqa directive on Line 17.

The noqa: WPS421 directive is flagged as unknown by Ruff. The WPS prefix indicates it's from wemake-python-styleguide, which may not be active in your current linting setup.

Apply this diff:

-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")
tests/e2e/notifications/categories/test_async_categories.py (2)

9-18: Remove unused noqa directive on Line 17.

The noqa: WPS421 directive is flagged as unknown by Ruff. The WPS prefix indicates it's from wemake-python-styleguide, which may not be active in your current linting setup.

Apply this diff:

-        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")  # noqa: WPS421
+        print(f"TEARDOWN - Unable to delete category {category.id}: {error.title}")

20-23: Remove unused noqa directive on Line 20.

The noqa: AAA01 directive is flagged as unused by Ruff. The test now passes AAA validation, so the suppression is no longer needed.

Apply this diff:

-def test_create_category(async_created_category, category_data):  # noqa: AAA01
+def test_create_category(async_created_category, category_data):
     assert async_created_category.name == category_data["name"]
     assert async_created_category.description == category_data["description"]
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f348a6 and a55338c.

📒 Files selected for processing (3)
  • tests/e2e/notifications/categories/conftest.py (1 hunks)
  • tests/e2e/notifications/categories/test_async_categories.py (1 hunks)
  • tests/e2e/notifications/categories/test_sync_categories.py (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.
📚 Learning: 2025-11-27T00:05:54.691Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.

Applied to files:

  • tests/e2e/notifications/categories/test_async_categories.py
🧬 Code graph analysis (3)
tests/e2e/notifications/categories/conftest.py (1)
tests/e2e/conftest.py (1)
  • short_uuid (101-102)
tests/e2e/notifications/categories/test_async_categories.py (6)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/conftest.py (2)
  • async_mpt_ops (36-39)
  • async_mpt_vendor (24-27)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
tests/e2e/notifications/categories/test_sync_categories.py (1)
  • test_create_category (20-23)
tests/e2e/notifications/categories/test_sync_categories.py (5)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/conftest.py (2)
  • mpt_ops (31-32)
  • mpt_client (43-44)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
🪛 Ruff (0.14.6)
tests/e2e/notifications/categories/test_async_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)


20-20: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

tests/e2e/notifications/categories/test_sync_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (21)
tests/e2e/notifications/categories/conftest.py (2)

4-10: LGTM!

The fixture correctly generates unique category test data using the short_uuid fixture dependency.


13-15: LGTM!

The fixture provides a consistent invalid category ID for not-found test scenarios.

tests/e2e/notifications/categories/test_sync_categories.py (10)

1-7: LGTM!

Imports and test markers are appropriate for e2e testing.


20-24: LGTM!

The test correctly verifies that the created category matches the input data. The inline # act comment satisfies the AAA linter for fixture-based tests.


26-33: LGTM!

The test follows proper AAA pattern and correctly verifies category retrieval.


35-46: LGTM!

The test follows proper AAA pattern and correctly verifies category updates.


48-54: LGTM!

The test follows proper AAA pattern and correctly verifies that the created category appears in the list.


56-63: LGTM!

The test follows proper AAA pattern and correctly verifies filtering by ID using RQLQuery.


65-74: LGTM!

The test follows proper AAA pattern with the unpublish setup in the Arrange block and correctly verifies the publish operation.


76-83: LGTM!

The test follows proper AAA pattern and correctly verifies the unpublish operation.


85-90: LGTM!

The test correctly verifies that attempting to get a non-existent category raises MPTAPIError.


92-105: LGTM!

Both deletion tests are correct:

  • test_delete_category properly verifies that getting a deleted category raises MPTAPIError
  • test_delete_category_not_found correctly verifies that deleting a non-existent category raises MPTAPIError
tests/e2e/notifications/categories/test_async_categories.py (9)

1-7: LGTM!

Imports and test markers are consistent with the synchronous test module.


25-32: LGTM!

The test follows proper AAA pattern and correctly uses async/await for category retrieval.


34-45: LGTM!

The test follows proper AAA pattern and correctly uses async/await for category updates.


47-53: LGTM!

The test follows proper AAA pattern and correctly uses async iteration to verify the created category appears in the list.


55-65: LGTM!

The test follows proper AAA pattern and correctly uses async iteration with RQLQuery filtering.


67-76: LGTM!

The test follows proper AAA pattern with all setup in a contiguous Arrange block (lines 68-71), followed by a blank line, then the Act block, and finally the Assert block.


78-85: LGTM!

The test follows proper AAA pattern with the Arrange block (lines 79-80), a separating blank line, the Act block, and the Assert block.


87-92: LGTM!

The test correctly uses the invalid_category_id fixture and verifies that attempting to get a non-existent category raises MPTAPIError.


94-107: LGTM!

Both deletion tests are correct:

  • test_delete_category properly verifies that getting a deleted category raises MPTAPIError
  • test_delete_category_not_found correctly verifies that deleting a non-existent category raises MPTAPIError

Both use proper async/await syntax.

Copy link
Contributor

@albertsola albertsola left a comment

Choose a reason for hiding this comment

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

Looks like most tests are skipped.

Approved, but we should remove the skip once the bug is fixed.

Copy link

@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.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab9fd46 and 6769a91.

📒 Files selected for processing (3)
  • tests/e2e/notifications/categories/conftest.py (1 hunks)
  • tests/e2e/notifications/categories/test_async_categories.py (1 hunks)
  • tests/e2e/notifications/categories/test_sync_categories.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/notifications/categories/conftest.py
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.
📚 Learning: 2025-11-27T00:05:54.691Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 131
File: tests/e2e/accounts/accounts_users/test_async_accounts_users.py:0-0
Timestamp: 2025-11-27T00:05:54.691Z
Learning: In pytest-asyncio, async fixtures are automatically resolved before being passed to test functions (both sync and async). Test functions receive the yielded value from async fixtures, not coroutines, so fixture parameters should never be awaited. A sync test function can use async fixtures without any special handling.

Applied to files:

  • tests/e2e/notifications/categories/test_async_categories.py
🧬 Code graph analysis (2)
tests/e2e/notifications/categories/test_sync_categories.py (2)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/notifications/categories/test_async_categories.py (5)
mpt_api_client/exceptions.py (1)
  • MPTAPIError (20-42)
mpt_api_client/rql/query_builder.py (2)
  • RQLQuery (115-524)
  • any (260-270)
tests/e2e/conftest.py (2)
  • async_mpt_ops (36-39)
  • async_mpt_vendor (24-27)
tests/e2e/notifications/categories/conftest.py (2)
  • category_data (5-10)
  • invalid_category_id (14-15)
mpt_api_client/models/model.py (1)
  • id (119-121)
🪛 Ruff (0.14.7)
tests/e2e/notifications/categories/test_sync_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)

tests/e2e/notifications/categories/test_async_categories.py

17-17: Unused noqa directive (unknown: WPS421)

Remove unused noqa directive

(RUF100)


20-20: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 2, 2025

@jentyk jentyk merged commit 1003ee5 into main Dec 2, 2025
5 checks passed
@jentyk jentyk deleted the feat/MPT-14932 branch December 2, 2025 13:25
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.

4 participants