示例#1
0
	def test_sweeps_library(self):
		Libraries.sweepLib.sweepDict = self.sweeps

		ExpSettingsVal.list_config()
		ExpSettingsVal.validate_lib()

		Libraries.sweepLib.write_to_file()
		Libraries.sweepLib.sweepDict = {}
		Libraries.sweepLib.load_from_library()

		# can not test instrumentLib directly here must test enclosed dictionary
		self.validate_library(Libraries.sweepLib.sweepDict, self.sweeps)
示例#2
0
	def test_channels_instruments_library(self):
		# test channels and instruments together as they are coupled

		Libraries.channelLib.channelDict = self.channels
		Libraries.instrumentLib.instrDict = self.instruments

		ExpSettingsVal.list_config()
		ExpSettingsVal.validate_lib()

		Libraries.channelLib.write_to_file()
		Libraries.instrumentLib.write_to_file()

		Libraries.channelLib.channelDict = {}
		Libraries.channelLib.load_from_library()

		Libraries.instrumentLib.instrDict = {}
		Libraries.instrumentLib.load_from_library()

		self.validate_library(Libraries.channelLib.channelDict, self.channels)
		self.validate_library(Libraries.instrumentLib.instrDict, self.instruments)
    def write_libraries(self):
        """Write all the libraries to their files.

        """
        
        if self.validate:
            self.validation_errors = ExpSettingsVal.validate_lib()
            if self.validation_errors != []:
                print "JSON Files did not validate"
                return False
        elif not self.validate:
            print "JSON Files validation disabled"
            
        self.channels.write_to_file()
        self.instruments.write_to_file()
        self.measurements.write_to_file()
        self.sweeps.write_to_file()

        return True