def setUp(self): self.my_test_folder = join(PathsManager.TEST_SETTINGS_PATH, "Web2boardLink") self.original_working_dir = os.getcwd() PathsManager.MAIN_PATH = self.my_test_folder restore_test_resources("Web2boardLink")
def setUp(self): self.res_path = os.path.join(pm.TEST_SETTINGS_PATH, "Updater") self.updater = BitbloqLibsUpdater() self.updater.destination_path = os.path.join(self.res_path, "newLibrariesPath") restore_test_resources("Updater") pm.CONFIG_PATH = self.res_path + os.sep + "config.json" pm.VERSION_PATH = self.res_path + os.sep + "web2board.version"
def setUp(self): self.my_test_folder = os.path.join(PathsManager.TEST_SETTINGS_PATH, "testUtils") self.copy_tree_old = os.path.join(self.my_test_folder, "copytree_old") self.copy_tree_new = os.path.join(self.my_test_folder, "copytree_new") self.zip_path = os.path.join(self.my_test_folder, "zip.zip") self.zip_folder = os.path.join(self.my_test_folder, "zip") self.original_list_ports_comports = serial.tools.list_ports.comports restore_test_resources()
def setUp(self): relative_data_path = os.path.join("Updater", "Web2boardUpdater") self.test_data_path = os.path.join(pm.TEST_SETTINGS_PATH, relative_data_path) self.main_path = os.path.join(self.test_data_path, "main") self.updater = Web2BoardUpdater() self.os_mock = flexmock(os, popen=lambda x: None) self.exit_mock = flexmock(sys, exit=lambda x: None) restore_test_resources(relative_data_path) pm.get_dst_path_for_update = classmethod(lambda cls, v: self.main_path + os.sep + "_" + v) pm.PROGRAM_PATH = os.path.join(self.test_data_path, 'programPath')
def setUp(self): relative_data_path = os.path.join("Updater", "Web2boardUpdater") self.test_data_path = os.path.join(pm.TEST_SETTINGS_PATH, relative_data_path) self.main_path = os.path.join(self.test_data_path, "main") self.updater = Web2BoardUpdater() self.os_mock = flexmock(os, popen=lambda x: None) self.exit_mock = flexmock(sys, exit=lambda x: None) restore_test_resources(relative_data_path) pm.get_dst_path_for_update = classmethod( lambda cls, v: self.main_path + os.sep + "_" + v) pm.PROGRAM_PATH = os.path.join(self.test_data_path, 'programPath')
def setUp(self): self.platformio_path = pm.PLATFORMIO_WORKSPACE_SKELETON self.hex_file_path = os.path.join(pm.TEST_SETTINGS_PATH, "CompilerUploader", "hex.hex") self.src_copy_path = os.path.join(pm.TEST_SETTINGS_PATH, "CompilerUploader", "srcCopy") self.working_cpp_path = os.path.join(self.src_copy_path, "working.ino") self.working_pre_compiler_cpp_path = os.path.join(self.src_copy_path, "precompiller.ino") self.not_working_cpp_path = os.path.join(self.src_copy_path, "notWorking.ino") self.with_libraries_cpp_path = os.path.join(self.src_copy_path, "withLibraries.ino") self.connected_board = self.platform_to_use self.compiler = CompilerUploader.construct(self.__get_platform_to_use()) restore_test_resources()
def setUp(self): HubsInspector.inspect_implemented_hubs(force_reconstruction=True) Version.read_version_values() self.versionsHandlerHub = HubsInspector.get_hub_instance(VersionsHandlerHub) """ :type : VersionsHandlerHub""" self.libUpdater = self.versionsHandlerHub.lib_updater self.updater = self.versionsHandlerHub.w2b_updater self.sender = create_sender_mock() self.compileUploaderMock, self.CompileUploaderConstructorMock = create_compiler_uploader_mock() self.testLibVersion = "1.1.1" restore_test_resources()
def setUp(self): self.updater = Updater() self.updater.currentVersionInfoPath = os.path.join(pm.TEST_SETTINGS_PATH, "Updater", "currentVersion.version") self.updater.onlineVersionUrl = "onlineVersionUrl" self.updater.destination_path = os.path.join(pm.TEST_SETTINGS_PATH, "Updater", "destinationPath") def download(*args): f = Future() f.set_result(None) return f self.updater.downloader = flexmock(Downloader(), download=download) restore_test_resources() self.zipToClearPath = None
def setUp(self): self.platformio_path = pm.PLATFORMIO_WORKSPACE_SKELETON self.hex_file_path = os.path.join(pm.TEST_SETTINGS_PATH, "CompilerUploader", "hex.hex") self.src_copy_path = os.path.join(pm.TEST_SETTINGS_PATH, "CompilerUploader", "srcCopy") self.working_cpp_path = os.path.join(self.src_copy_path, "working.ino") self.working_pre_compiler_cpp_path = os.path.join( self.src_copy_path, "precompiller.ino") self.not_working_cpp_path = os.path.join(self.src_copy_path, "notWorking.ino") self.with_libraries_cpp_path = os.path.join(self.src_copy_path, "withLibraries.ino") self.connected_board = self.platform_to_use self.compiler = CompilerUploader.construct( self.__get_platform_to_use()) restore_test_resources()
def setUp(self): self.updater = Updater() self.updater.currentVersionInfoPath = os.path.join( pm.TEST_SETTINGS_PATH, "Updater", "currentVersion.version") self.updater.onlineVersionUrl = "onlineVersionUrl" self.updater.destination_path = os.path.join(pm.TEST_SETTINGS_PATH, "Updater", "destinationPath") def download(*args): f = Future() f.set_result(None) return f self.updater.downloader = flexmock(Downloader(), download=download) restore_test_resources() self.zipToClearPath = None
def setUp(self): logging.basicConfig() logging.getLogger().setLevel(logging.DEBUG) self.relative_data_path = 'Downloader' self.data_path = os.path.join(PathsManager.TEST_SETTINGS_PATH, self.relative_data_path) self.downloader = Downloader(refresh_time=0.01) self.metaMock = flexmock(getheaders=lambda x: [1000]) self.read_sleep = 0 def read_mock(bytes=-1): if self.read_sleep is not None: time.sleep(self.read_sleep) self.read_sleep = None return "testing" return '' self.site_mock = flexmock(info=lambda: self.metaMock, read=read_mock) self.urllib2_mock = flexmock(urllib2) self.urlopen_mock = self.urllib2_mock.should_receive("urlopen").and_return(self.site_mock) restore_test_resources(self.relative_data_path)
def setUp(self): logging.basicConfig() logging.getLogger().setLevel(logging.DEBUG) self.relative_data_path = 'Downloader' self.data_path = os.path.join(PathsManager.TEST_SETTINGS_PATH, self.relative_data_path) self.downloader = Downloader(refresh_time=0.01) self.metaMock = flexmock(getheaders=lambda x: [1000]) self.read_sleep = 0 def read_mock(bytes=-1): if self.read_sleep is not None: time.sleep(self.read_sleep) self.read_sleep = None return "testing" return '' self.site_mock = flexmock(info=lambda: self.metaMock, read=read_mock) self.urllib2_mock = flexmock(urllib2) self.urlopen_mock = self.urllib2_mock.should_receive( "urlopen").and_return(self.site_mock) restore_test_resources(self.relative_data_path)
def setUp(self): self.myTestFolder = os.path.join(PathsManager.TEST_SETTINGS_PATH, "Config") self.originalConfigDict = Config.get_config_values() restore_test_resources()