Skip to content

Commit

Permalink
Fix: add tests for #380
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshnielsen committed Jan 12, 2017
1 parent c179881 commit 70c985a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions qcodes/tests/test_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from qcodes.data.io import DiskIO
from qcodes.data.data_array import DataArray
from qcodes.data.manager import get_data_manager
from qcodes.instrument.mock import ArrayGetter
from qcodes.instrument.parameter import Parameter, ManualParameter
from qcodes.process.helpers import kill_processes
from qcodes.process.qcodes_process import QcodesProcess
Expand Down Expand Up @@ -205,6 +206,16 @@ def test_enqueue(self):
loop.run_temp()
self.assertFalse(hasattr(loop, 'process'))

def test_sync_no_overwrite(self):
# Test fix for 380, this tests that the setpoints are not incorrectly
# overwritten by data_set.sync() for this to happen with the original code
# the delay must be larger than the write period otherwise sync is a no opt.

loop = Loop(self.gates.chan1.sweep(0, 1, 1), delay=0.1).each(ArrayGetter(self.meter.amplitude,
self.gates.chan2[0:1:1], 0.000001))
data = loop.get_data_set(name='testsweep', write_period=0.01)
_ = loop.with_bg_task(data.sync).run()
assert not np.isnan(data.chan2).any()

def sleeper(t):
time.sleep(t)
Expand Down

0 comments on commit 70c985a

Please sign in to comment.