Repository: OpenAssetIO/OpenAssetIO (language: python)

Issue:
Relationship compliancetest uses malformed reference as its skipped parameter
## What
Found this when updating the python manager template. The compliance suite tests for a malformed reference in `Test_getWithRelationship_All` uses the existence of a malformed entity reference fixture as the deciding factor as to whether it should be skipped. I propose it should be including whether the `a_relationship_trait_set` fixture exists either instead or in addition to this.

https://github.com/OpenAssetIO/OpenAssetIO/blob/3323a23ff57e086f48fb81d5e21ab593344b20db/src/openassetio-python/package/openassetio/test/manager/apiComplianceSuite.py#L686
## Why
The `a_malformed_reference` fixture is common to other non-optional flows, and is likely to be defined as a globally shared fixture, (which is what BAL does, really the only other example available, and bound to be copy-pasted,) This may give the wrong impression the the relationship functions must be implemented to a new implementer, and could bounce the tentative explorer.

## Acceptance Criteria

- Tests skipped based on relationship specific fixtures where possible.

## Notes

- Changes to BAL out of scope
Relationship compliancetest uses malformed reference as its skipped parameter
## What
Found this when updating the python manager template. The compliance suite tests for a malformed reference in `Test_getWithRelationship_All` uses the existence of a malformed entity reference fixture as the deciding factor as to whether it should be skipped. I propose it should be including whether the `a_relationship_trait_set` fixture exists either instead or in addition to this.

https://github.com/OpenAssetIO/OpenAssetIO/blob/3323a23ff57e086f48fb81d5e21ab593344b20db/src/openassetio-python/package/openassetio/test/manager/apiComplianceSuite.py#L686
## Why
The `a_malformed_reference` fixture is common to other non-optional flows, and is likely to be defined as a globally shared fixture, (which is what BAL does, really the only other example available, and bound to be copy-pasted,) This may give the wrong impression the the relationship functions must be implemented to a new implementer, and could bounce the tentative explorer.

## Acceptance Criteria

- Tests skipped based on relationship specific fixtures where possible.

## Notes

- Changes to BAL out of scope


Discussion / hints:

Fix patch:
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index c1c466dba..b91a23631 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -53,6 +53,10 @@ v1.0.0-alpha.x
 - Added some aliases to the Doxygen API documentation. In
   particular, `Ptr` and `ConstPtr` aliases are now cross-referencable.
 
+- Altered the fixture that causes a skip in relationship based API
+  compliance tests, to be the more specific relationship traitset.
+  [#1022](https://github.com/OpenAssetIO/OpenAssetIO/issues/1022)
+
 v1.0.0-alpha.13
 ---------------
 


Test patch:
diff --git a/src/openassetio-python/package/openassetio/test/manager/apiComplianceSuite.py b/src/openassetio-python/package/openassetio/test/manager/apiComplianceSuite.py
index ee93ae219..1e66d36bc 100644
--- a/src/openassetio-python/package/openassetio/test/manager/apiComplianceSuite.py
+++ b/src/openassetio-python/package/openassetio/test/manager/apiComplianceSuite.py
@@ -603,8 +603,8 @@ def test_when_relation_unknown_then_no_pages_returned(self):
             self.__assert_pager_is_at_end(pager)
 
     def test_when_batched_then_same_number_of_returned_relationships(self):
-        a_ref = self.requireEntityReferenceFixture("a_reference", skipTestIfMissing=True)
-        a_rel = TraitsData(self.requireFixture("a_relationship_trait_set"))
+        a_rel = TraitsData(self.requireFixture("a_relationship_trait_set", skipTestIfMissing=True))
+        a_ref = self.requireEntityReferenceFixture("a_reference")
 
         with self.subTest("getWithRelationship"):
             results = self.__test_getWithRelationship_success([a_ref] * 5, a_rel)
@@ -623,8 +623,8 @@ def test_when_batched_then_same_number_of_returned_relationships(self):
             self.assertEqual(len(pagers), 5)
 
     def test_when_relationship_trait_set_known_then_all_with_trait_set_returned(self):
-        a_ref = self.requireEntityReferenceFixture("a_reference", skipTestIfMissing=True)
-        a_rel = TraitsData(self.requireFixture("a_relationship_trait_set"))
+        a_rel = TraitsData(self.requireFixture("a_relationship_trait_set", skipTestIfMissing=True))
+        a_ref = self.requireEntityReferenceFixture("a_reference")
         expected = self.requireEntityReferencesFixture("expected_related_entity_references")
 
         with self.subTest("getWithRelationship"):
@@ -646,8 +646,10 @@ def test_when_relationship_trait_set_known_then_all_with_trait_set_returned(self
             self.assertListEqual(actual, expected)
 
     def test_when_relationship_trait_set_known_and_props_set_then_filtered_refs_returned(self):
-        a_ref = self.requireEntityReferenceFixture("a_reference", skipTestIfMissing=True)
-        a_rel = self.requireFixture("a_relationship_traits_data_with_props")
+        a_rel = self.requireFixture(
+            "a_relationship_traits_data_with_props", skipTestIfMissing=True
+        )
+        a_ref = self.requireEntityReferenceFixture("a_reference")
         expected = self.requireEntityReferencesFixture("expected_related_entity_references")
 
         with self.subTest("getWithRelationship"):
@@ -669,8 +671,8 @@ def test_when_relationship_trait_set_known_and_props_set_then_filtered_refs_retu
             self.assertListEqual(actual, expected)
 
     def test_when_result_trait_set_supplied_then_filtered_refs_returned(self):
-        a_ref = self.requireEntityReferenceFixture("a_reference", skipTestIfMissing=True)
-        a_rel = TraitsData(self.requireFixture("a_relationship_trait_set"))
+        a_rel = TraitsData(self.requireFixture("a_relationship_trait_set", skipTestIfMissing=True))
+        a_ref = self.requireEntityReferenceFixture("a_reference")
         result_trait_set = self.requireFixture("an_entity_trait_set_to_filter_by")
         expected = self.requireEntityReferencesFixture("expected_related_entity_references")
 
@@ -701,10 +703,10 @@ def test_when_result_trait_set_supplied_then_filtered_refs_returned(self):
             self.assertListEqual(actual, expected)
 
     def test_when_querying_missing_reference_then_resolution_error_is_returned(self):
-        entity_reference = self.requireEntityReferenceFixture(
-            "a_reference_to_a_missing_entity", skipTestIfMissing=True
+        relationship_trait_set = self.requireFixture(
+            "a_relationship_trait_set", skipTestIfMissing=True
         )
-        relationship_trait_set = self.requireFixture("a_relationship_trait_set")
+        entity_reference = self.requireEntityReferenceFixture("a_reference_to_a_missing_entity")
         expected_error_code = BatchElementError.ErrorCode.kEntityResolutionError
         expected_error_message = self.requireFixture("expected_error_message")
 
@@ -741,10 +743,10 @@ def test_when_querying_missing_reference_then_resolution_error_is_returned(self)
             )
 
     def test_when_querying_malformed_reference_then_malformed_reference_error_is_returned(self):
-        entity_reference = self.requireEntityReferenceFixture(
-            "a_malformed_reference", skipTestIfMissing=True
+        relationship_trait_set = self.requireFixture(
+            "a_relationship_trait_set", skipTestIfMissing=True
         )
-        relationship_trait_set = self.requireFixture("a_relationship_trait_set")
+        entity_reference = self.requireEntityReferenceFixture("a_malformed_reference")
         expected_error_code = BatchElementError.ErrorCode.kMalformedEntityReference
         expected_error_message = self.requireFixture("expected_error_message")
 
@@ -781,8 +783,8 @@ def test_when_querying_malformed_reference_then_malformed_reference_error_is_ret
             )
 
     def test_when_related_entities_span_multiple_pages_then_pager_has_multiple_pages(self):
-        a_ref = self.requireEntityReferenceFixture("a_reference", skipTestIfMissing=True)
-        a_rel = TraitsData(self.requireFixture("a_relationship_trait_set"))
+        a_rel = TraitsData(self.requireFixture("a_relationship_trait_set", skipTestIfMissing=True))
+        a_ref = self.requireEntityReferenceFixture("a_reference")
         expected_related_refs = self.requireEntityReferencesFixture(
             "expected_related_entity_references"
         )
@@ -852,10 +854,12 @@ def test_when_pager_constructed_then_no_references_to_original_args_are_retained
         # Wrap pager construction in a function, so that input args can
         # fall out of scope.
         def get_pager_and_weakref_args(get_pagers):
-            ref = self.requireEntityReferenceFixture("a_reference", skipTestIfMissing=True)
-            refs = self.weaklist([ref])
-            relationship = TraitsData(self.requireFixture("a_relationship_trait_set"))
+            relationship = TraitsData(
+                self.requireFixture("a_relationship_trait_set", skipTestIfMissing=True)
+            )
             relationships = self.weaklist([relationship])
+            ref = self.requireEntityReferenceFixture("a_reference")
+            refs = self.weaklist([ref])
             context = self.createTestContext(access=Context.Access.kRead)
             context.locale = TraitsData(context.locale)  # Force a copy.
             result_trait_set = copy.copy(self.requireFixture("an_entity_trait_set_to_filter_by"))