|
17 | 17 |
|
18 | 18 | logger = logging.getLogger(__name__) |
19 | 19 |
|
| 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 | + |
20 | 24 | def print_xml(root): |
21 | 25 | print('\n', etree.tostring(root, pretty_print=True).decode(), sep='') |
22 | 26 |
|
@@ -459,6 +463,8 @@ def test_ingest(client, investigation, samples, schemadir, case): |
459 | 463 | }) |
460 | 464 | ds = client.assertedSearch(query)[0] |
461 | 465 | for query, res in case.checks[name]: |
| 466 | + if skip_single_boolean and isinstance(res, bool): |
| 467 | + continue |
462 | 468 | assert client.assertedSearch(query % ds.id)[0] == res |
463 | 469 |
|
464 | 470 | io_metadata = NamedBytesIO("""<?xml version='1.0' encoding='UTF-8'?> |
@@ -520,6 +526,8 @@ def test_ingest_fileobj(client, investigation, samples, schemadir, case): |
520 | 526 | }) |
521 | 527 | ds = client.assertedSearch(query)[0] |
522 | 528 | for query, res in case.checks[name]: |
| 529 | + if skip_single_boolean and isinstance(res, bool): |
| 530 | + continue |
523 | 531 | assert client.assertedSearch(query % ds.id)[0] == res |
524 | 532 |
|
525 | 533 |
|
@@ -746,6 +754,7 @@ def test_ingest_error_searcherr(client, investigation, schemadir, case): |
746 | 754 | @pytest.mark.parametrize("case", [ |
747 | 755 | pytest.param(c, id=c.metadata.name, marks=c.marks) for c in classattr_cases |
748 | 756 | ]) |
| 757 | +@pytest.mark.skipif(skip_single_boolean, reason="Bug in icat.server") |
749 | 758 | def test_ingest_classattr(monkeypatch, client, investigation, schemadir, case): |
750 | 759 | """Test overriding prescribed values set in IngestReader class attributes. |
751 | 760 | """ |
@@ -842,6 +851,8 @@ def test_custom_ingest(client, investigation, samples, schemadir, case): |
842 | 851 | }) |
843 | 852 | ds = client.assertedSearch(query)[0] |
844 | 853 | for query, res in case.checks[name]: |
| 854 | + if skip_single_boolean and isinstance(res, bool): |
| 855 | + continue |
845 | 856 | assert client.assertedSearch(query % ds.id)[0] == res |
846 | 857 |
|
847 | 858 |
|
|
0 commit comments