From 68afeba76f69e1028c9157e31a19472500fded1d Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Fri, 17 Feb 2023 12:43:01 +0100
Subject: [PATCH] MAINT: Moved test function to more appropriate file.

---
 tests/test_parents.py           | 20 --------------------
 tests/test_recursive_parents.py | 22 ++++++++++++++++++++--
 2 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/tests/test_parents.py b/tests/test_parents.py
index abae900..d038350 100644
--- a/tests/test_parents.py
+++ b/tests/test_parents.py
@@ -41,23 +41,3 @@ def test_parent_name_id_mismatch():
     with raises(db.TransactionError):
         rt2.insert()
         print(rt2)
-
-
-def test_get_parents_recursively():
-    """Test for https://gitlab.com/caosdb/caosdb-pylib/-/issues/90
-
-> Entity.get_parents_recursively() does not work unless the full ancestry has been retrieved from
-> the server.
-"""
-    # Setup
-    rt_A = db.RecordType(name="TestA")
-    rt_B = db.RecordType(name="TestB").add_parent(rt_A)
-    rt_C = db.RecordType(name="TestC").add_parent(rt_B)
-    db.Container().extend([rt_A, rt_B, rt_C]).insert()
-
-    # Retrieve only C
-    retrieved_C = db.RecordType(name="TestC").retrieve()
-    parents = retrieved_C.get_parents_recursively(retrieve=True)
-    assert len(parents) == 2
-    assert "TestB" in [p.name for p in parents]
-    assert "TestA" in [p.name for p in parents]
diff --git a/tests/test_recursive_parents.py b/tests/test_recursive_parents.py
index fff5f64..c262e7c 100644
--- a/tests/test_recursive_parents.py
+++ b/tests/test_recursive_parents.py
@@ -48,7 +48,26 @@ def teardown_function(function):
     setup_module()
 
 
-# @pytest.mark.xfail(reason="To be fixed in server and/or pylib")
+def test_get_parents_recursively():
+    """Test for https://gitlab.com/caosdb/caosdb-pylib/-/issues/90
+
+> Entity.get_parents_recursively() does not work unless the full ancestry has been retrieved from
+> the server.
+"""
+    # Setup
+    rt_A = db.RecordType(name="TestA")
+    rt_B = db.RecordType(name="TestB").add_parent(rt_A)
+    rt_C = db.RecordType(name="TestC").add_parent(rt_B)
+    db.Container().extend([rt_A, rt_B, rt_C]).insert()
+
+    # Retrieve only C
+    retrieved_C = db.RecordType(name="TestC").retrieve()
+    parents = retrieved_C.get_parents_recursively(retrieve=True)
+    assert len(parents) == 2
+    assert "TestB" in [p.name for p in parents]
+    assert "TestA" in [p.name for p in parents]
+
+
 def test_recursive_parents():
     # inheritance structure:
     #    A
@@ -91,7 +110,6 @@ def test_recursive_parents():
     assert (C.id, C.name) in parent_identifiers
 
 
-# @pytest.mark.xfail(reason="To be fixed in server and/or pylib")
 def test_entity_has_parent():
     # inheritance structure:
     #    A
-- 
GitLab