Skip to content
Snippets Groups Projects

Release 0.3

65 files
+ 4622
1476
Compare changes
  • Side-by-side
  • Inline

Files

@@ -33,6 +33,7 @@ import argparse
import sys
from argparse import RawTextHelpFormatter
from caoscrawler import Crawler, SecurityMode
from caoscrawler.identifiable import Identifiable
import caosdb as db
from caoscrawler.identifiable_adapters import CaosDBIdentifiableAdapter
import pytest
@@ -106,6 +107,15 @@ def crawler_extended(ident):
return cr
def test_ambigious_lookup(clear_database, usemodel, crawler, ident):
ins, ups = crawler.synchronize()
proj = db.execute_query("FIND Project WITH identifier='SpeedOfLight'", unique=True)
with pytest.raises(RuntimeError, match=".*unambigiously.*"):
print(crawler.identifiableAdapter.retrieve_identified_record_for_identifiable(
Identifiable(properties={'project': proj.id})))
def test_single_insertion(clear_database, usemodel, crawler, ident):
ins, ups = crawler.synchronize()
@@ -114,14 +124,15 @@ def test_single_insertion(clear_database, usemodel, crawler, ident):
for i in reversed(range(len(res))):
if res[i].parents[0].name == "PyTestInfo":
del res[i]
filename = rfp("..", "..", "unittests", "records.xml")
with open(filename, "w") as f:
xml = res.to_xml()
# Remove noscript and transaction benchmark:
for tag in ("noscript", "TransactionBenchmark"):
if xml.find(tag) is not None:
xml.remove(xml.find(tag))
f.write(db.common.utils.xml2str(xml))
# uncomment this to recreate the `records.xml` file
# filename = rfp("..", "..", "unittests", "records.xml")
# with open(filename, "w") as f:
# xml = res.to_xml()
# # Remove noscript and transaction benchmark:
# for tag in ("noscript", "TransactionBenchmark"):
# if xml.find(tag) is not None:
# xml.remove(xml.find(tag))
# f.write(db.common.utils.xml2str(xml))
assert len(ins) == 18
assert len(ups) == 0
Loading