Skip to content

Commit

Permalink
Log (expected) exceptions test_06_ingest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
RKrahl committed Mar 20, 2024
1 parent bb57b48 commit 0f2ee5e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/test_06_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from collections import namedtuple
import datetime
import io
import logging
import pytest
pytest.importorskip("lxml")
from lxml import etree
Expand All @@ -14,6 +15,7 @@
from conftest import (getConfig, gettestdata, icat_version,
get_icatdata_schema, testdatadir)

logger = logging.getLogger(__name__)

def get_test_investigation(client):
query = Query(client, "Investigation", conditions={
Expand Down Expand Up @@ -560,9 +562,10 @@ def test_ingest_error_invalid(client, investigation, schemadir, case):
datasets = []
for name in case.data:
datasets.append(client.new("Dataset", name=name))
with pytest.raises(icat.InvalidIngestFileError):
with pytest.raises(icat.InvalidIngestFileError) as exc:
reader = IngestReader(client, case.metadata, investigation)
reader.ingest(datasets, dry_run=True, update_ds=True)
logger.info("Raised %s: %s", exc.type.__name__, exc.value)

searcherr_attr_metadata = NamedBytesIO("""<?xml version='1.0' encoding='UTF-8'?>
<icatingest version="1.0">
Expand Down Expand Up @@ -621,9 +624,10 @@ def test_ingest_error_searcherr(client, investigation, schemadir, case):
datasets = []
for name in case.data:
datasets.append(client.new("Dataset", name=name))
with pytest.raises(icat.SearchResultError):
with pytest.raises(icat.SearchResultError) as exc:
reader = IngestReader(client, case.metadata, investigation)
reader.ingest(datasets, dry_run=True, update_ds=True)
logger.info("Raised %s: %s", exc.type.__name__, exc.value)


customcases = [
Expand Down

0 comments on commit 0f2ee5e

Please sign in to comment.