Skip to content

Commit 34bc93f

Browse files
committed
There seem to be a bug in older icat.server versions when searching
for a single boolean attribute in a query. Skip some checks / tests in test_06_ingest.py in these cases.
1 parent a529364 commit 34bc93f

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/test_06_ingest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
logger = logging.getLogger(__name__)
1919

20+
# There seem to be a bug in older icat.server versions when searching
21+
# for a single boolean attribute in a query.
22+
skip_single_boolean = icat_version < "4.11.0"
23+
2024
def print_xml(root):
2125
print('\n', etree.tostring(root, pretty_print=True).decode(), sep='')
2226

@@ -459,6 +463,8 @@ def test_ingest(client, investigation, samples, schemadir, case):
459463
})
460464
ds = client.assertedSearch(query)[0]
461465
for query, res in case.checks[name]:
466+
if skip_single_boolean and isinstance(res, bool):
467+
continue
462468
assert client.assertedSearch(query % ds.id)[0] == res
463469

464470
io_metadata = NamedBytesIO("""<?xml version='1.0' encoding='UTF-8'?>
@@ -520,6 +526,8 @@ def test_ingest_fileobj(client, investigation, samples, schemadir, case):
520526
})
521527
ds = client.assertedSearch(query)[0]
522528
for query, res in case.checks[name]:
529+
if skip_single_boolean and isinstance(res, bool):
530+
continue
523531
assert client.assertedSearch(query % ds.id)[0] == res
524532

525533

@@ -746,6 +754,7 @@ def test_ingest_error_searcherr(client, investigation, schemadir, case):
746754
@pytest.mark.parametrize("case", [
747755
pytest.param(c, id=c.metadata.name, marks=c.marks) for c in classattr_cases
748756
])
757+
@pytest.mark.skipif(skip_single_boolean, reason="Bug in icat.server")
749758
def test_ingest_classattr(monkeypatch, client, investigation, schemadir, case):
750759
"""Test overriding prescribed values set in IngestReader class attributes.
751760
"""
@@ -842,6 +851,8 @@ def test_custom_ingest(client, investigation, samples, schemadir, case):
842851
})
843852
ds = client.assertedSearch(query)[0]
844853
for query, res in case.checks[name]:
854+
if skip_single_boolean and isinstance(res, bool):
855+
continue
845856
assert client.assertedSearch(query % ds.id)[0] == res
846857

847858

0 commit comments

Comments
 (0)