Skip to content
Snippets Groups Projects
Commit d87a9eed authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

FIX: check for empty database contained a bug

parent 8dde5819
Branches
Tags
1 merge request!53Release 0.1
......@@ -36,6 +36,7 @@ import caosdb as db
from newcrawler.identifiable_adapters import CaosDBIdentifiableAdapter
import pytest
from caosadvancedtools.models.parser import parse_model_from_yaml
import yaml
import os
......@@ -60,10 +61,21 @@ def not_test_record(r: db.Record):
return True
def register_test():
info = str(db.Info())
if "without" not in info:
info = db.Info()
for info_element in info.messages:
if info_element.startswith("<Counts>"):
counts = yaml.load(info_element[8:-9], Loader=yaml.SafeLoader)
for count_element in ['records',
'properties',
'recordTypes',
'files',
'fssize']:
if counts[count_element] > 0:
raise RuntimeError("This instance of CaosDB contains entities already."
"It must be empty in order to gegister a new test.")
break
else:
raise RuntimeError("Response from server for Info could not be interpreted.")
answer = input("This method will register your current test with key {} with the currently"
" running instance of CaosDB. Do you want to continue (y/N)?".format(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment