Skip to content

Commit

Permalink
There seem to be a bug in older icat.server versions when searching
Browse files Browse the repository at this point in the history
for a single boolean attribute in a query.  Skip some checks / tests
in test_06_ingest.py in these cases.
  • Loading branch information
RKrahl committed Oct 11, 2024
1 parent a529364 commit 34bc93f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_06_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

logger = logging.getLogger(__name__)

# There seem to be a bug in older icat.server versions when searching
# for a single boolean attribute in a query.
skip_single_boolean = icat_version < "4.11.0"

def print_xml(root):
print('\n', etree.tostring(root, pretty_print=True).decode(), sep='')

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

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


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


Expand Down

0 comments on commit 34bc93f

Please sign in to comment.