diff --git a/devlib/instrument/acmecape.py b/devlib/instrument/acmecape.py index f0bb11f..e60dda2 100644 --- a/devlib/instrument/acmecape.py +++ b/devlib/instrument/acmecape.py @@ -159,3 +159,7 @@ class AcmeCapeInstrument(Instrument): def get_raw(self): return [self.raw_data_file] + + def teardown(self): + if os.path.isfile(self.raw_data_file): + os.remove(self.raw_data_file) diff --git a/devlib/instrument/arm_energy_probe.py b/devlib/instrument/arm_energy_probe.py index 4db97d8..093999b 100644 --- a/devlib/instrument/arm_energy_probe.py +++ b/devlib/instrument/arm_energy_probe.py @@ -142,3 +142,7 @@ class ArmEnergyProbeInstrument(Instrument): def get_raw(self): return [self.output_file_raw] + + def teardown(self): + if os.path.isfile(self.output_file_raw): + os.remove(self.output_file_raw) diff --git a/devlib/instrument/daq.py b/devlib/instrument/daq.py index 399e2c4..68cad46 100644 --- a/devlib/instrument/daq.py +++ b/devlib/instrument/daq.py @@ -14,6 +14,7 @@ # import os +import shutil import tempfile from itertools import chain @@ -154,6 +155,8 @@ class DaqInstrument(Instrument): def teardown(self): self.execute('close') + if os.path.isdir(tempdir): + shutil.rmtree(tempdir) def execute(self, command, **kwargs): return execute_command(self.server_config, command, **kwargs) diff --git a/devlib/instrument/energy_probe.py b/devlib/instrument/energy_probe.py index 4175a5d..63b0ec6 100644 --- a/devlib/instrument/energy_probe.py +++ b/devlib/instrument/energy_probe.py @@ -126,3 +126,7 @@ class EnergyProbeInstrument(Instrument): def get_raw(self): return [self.raw_data_file] + + def teardown(self): + if os.path.isfile(self.raw_data_file): + os.remove(self.raw_data_file) diff --git a/devlib/instrument/frames.py b/devlib/instrument/frames.py index d634724..62fcc75 100644 --- a/devlib/instrument/frames.py +++ b/devlib/instrument/frames.py @@ -70,6 +70,11 @@ class FramesInstrument(Instrument): def _init_channels(self): raise NotImplementedError() + def teardown(self): + if not self.keep_raw: + if os.path.isfile(self._raw_file): + os.remove(self._raw_file) + class GfxInfoFramesInstrument(FramesInstrument):