Skip to content

Commit

Permalink
Issue 701b: fix for grouping (#703)
Browse files Browse the repository at this point in the history
* add ScanNamesNoMetadata and ScanNamesNoGrouping variables

* update grouping

* update tests
  • Loading branch information
jkotan authored Jul 19, 2024
1 parent 2449f2f commit f865189
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
5 changes: 2 additions & 3 deletions nxstools/pyeval/scdataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,11 @@ def append_scicat_dataset(macro, status_info=True, reingest=False):
commands.append("__command__ stop")
if not nogrouping:
commands.append("%s:%s" % (scanname2, time.time()))
if not nogrouping and not nometa:
commands.append("__command__ start %s" % scanname2)
sname = "\n".join(commands)

if not nogrouping and not nometa:
sm[fdir] = scanname2
if fdir in sm.keys():
sm.pop(fdir)
macro.setEnv('SciCatMeasurements', sm)
if sname:
append_scicat_record(macro, sname, status_info=True)
Expand Down
26 changes: 14 additions & 12 deletions test/NXSCreatePyEvalH5Cpp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def setEnv(self, name, value):
:param name: variable name
:type name: :obj:`str`
"""
print("ww", name, value)
self.env[name] = value

def output(self, text):
""" mocked output function
Expand Down Expand Up @@ -3407,15 +3409,15 @@ def test_scingestor_append_scicat_dataset_agroup_new(self):
self.assertEqual("mytest_00123", sres[1])
self.assertEqual("__command__ stop", sres[2])
self.assertTrue(sres[3].startswith("mytest:"))
self.assertEqual("__command__ start mytest", sres[4])
# self.assertEqual("__command__ start mytest", sres[4])
sres = macro.log[0].split("\n")
self.assertEqual("Appending '__command__ start mytest", sres[0])
self.assertEqual("mytest_00123", sres[1])
self.assertEqual("__command__ stop", sres[2])
self.assertTrue(sres[3].startswith("mytest:"))
self.assertEqual("__command__ start mytest' to "
"%s/scicat-datasets-00000000.lst"
% cwd, sres[4])
# self.assertEqual("__command__ start mytest' to "
# "%s/scicat-datasets-00000000.lst"
# % cwd, sres[4])
finally:
if os.path.isfile("%s/scicat-datasets-00000000.lst" % (cwd)):
os.remove("%s/scicat-datasets-00000000.lst" % (cwd))
Expand Down Expand Up @@ -3444,17 +3446,17 @@ def test_scingestor_append_scicat_dataset_agroup_old(self):
self.assertEqual("mytest_00123", sres[3])
self.assertEqual("__command__ stop", sres[4])
self.assertTrue(sres[5].startswith("mytest:"))
self.assertEqual("__command__ start mytest", sres[6])
# self.assertEqual("__command__ start mytest", sres[6])
sres = macro.log[0].split("\n")
self.assertEqual("Appending '__command__ stop", sres[0])
self.assertTrue(sres[1].startswith("oldtest:"))
self.assertEqual("__command__ start mytest", sres[2])
self.assertEqual("mytest_00123", sres[3])
self.assertEqual("__command__ stop", sres[4])
self.assertTrue(sres[5].startswith("mytest:"))
self.assertEqual("__command__ start mytest' to "
"%s/scicat-datasets-00000000.lst"
% cwd, sres[6])
# self.assertEqual("__command__ start mytest' to "
# "%s/scicat-datasets-00000000.lst"
# % cwd, sres[6])
finally:
if os.path.isfile("%s/scicat-datasets-00000000.lst" % (cwd)):
os.remove("%s/scicat-datasets-00000000.lst" % (cwd))
Expand All @@ -3480,14 +3482,14 @@ def test_scingestor_append_scicat_dataset_agroup_update(self):
self.assertEqual("mytest_00123", sres[0])
self.assertEqual("__command__ stop", sres[1])
self.assertTrue(sres[2].startswith("mytest:"))
self.assertEqual("__command__ start mytest", sres[3])
# self.assertEqual("__command__ start mytest", sres[3])
sres = macro.log[0].split("\n")
self.assertEqual("Appending 'mytest_00123", sres[0])
self.assertEqual("__command__ stop", sres[1])
self.assertTrue(sres[2].startswith("mytest:"))
self.assertEqual("__command__ start mytest' to "
"%s/scicat-datasets-00000000.lst"
% cwd, sres[3])
# self.assertEqual("__command__ start mytest' to "
# "%s/scicat-datasets-00000000.lst"
# % cwd, sres[3])

finally:
if os.path.isfile("%s/scicat-datasets-00000000.lst" % (cwd)):
Expand Down

0 comments on commit f865189

Please sign in to comment.