def tearDown(self): # Force yet another restart with a clean profile to disconnect from the # profile and environment changes we've made, to leave a more or less # blank slate for the next person. self.marionette.restart(clean=True, in_app=False) self.setUpScriptData() # Super MarionetteTestCase.tearDown(self) # A helper to deal with removing a load of files import mozfile for cleanup in self.cleanups: if cleanup.desktop_backup_path: mozfile.remove(cleanup.desktop_backup_path) if cleanup.reset_profile_path: # Remove ourselves from profiles.ini self.runCode(""" let name = arguments[0]; let profile = global.profSvc.getProfileByName(name); profile.remove(false) global.profSvc.flush(); """, script_args=(cleanup.profile_name_to_remove, )) # Remove the local profile dir if it's not the same as the profile dir: different_path = cleanup.reset_profile_local_path != cleanup.reset_profile_path if cleanup.reset_profile_local_path and different_path: mozfile.remove(cleanup.reset_profile_local_path) # And delete all the files. mozfile.remove(cleanup.reset_profile_path)
def tearDown(self): self.logger.info("tearing down!") MarionetteTestCase.tearDown(self) self.logger.info("tearing down webservers!") self._webservers.stop() self.logger.info("processing data in %s!" % self._resultsDir) perf_blob = process_perf_data.create_perf_data(self._resultsDir) self.logger.info("PERFHERDER_DATA: %s" % json.dumps(perf_blob)) perf_file = os.path.join(self._resultsDir, "perfherder_data.json") with open(perf_file, 'w') as fp: json.dump(perf_blob, fp, indent=2) self.logger.info("Perfherder data written to %s" % perf_file) if self._dmd: self.cleanup_dmd() # copy it to moz upload dir if set if 'MOZ_UPLOAD_DIR' in os.environ: for file in os.listdir(self._resultsDir): file = os.path.join(self._resultsDir, file) if os.path.isfile(file): shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"]) self.logger.info("done tearing down!")
def tearDown(self): # Force yet another restart with a clean profile to disconnect from the # profile and environment changes we've made, to leave a more or less # blank slate for the next person. self.marionette.restart(clean=True, in_app=False) self.setUpScriptData() # Super MarionetteTestCase.tearDown(self) # Some helpers to deal with removing a load of files import errno, stat def handleRemoveReadonly(func, path, exc): excvalue = exc[1] if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES: os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777 func(path) else: raise if self.desktop_backup_path: shutil.rmtree(self.desktop_backup_path, ignore_errors=False, onerror=handleRemoveReadonly) if self.reset_profile_path: # Remove ourselves from profiles.ini self.runCode(""" let name = arguments[0]; let profile = global.profSvc.getProfileByName(name); profile.remove(false) global.profSvc.flush(); """, script_args=(self.profileNameToRemove,)) # And delete all the files. shutil.rmtree(self.reset_profile_path, ignore_errors=False, onerror=handleRemoveReadonly)
def tearDown(self): MarionetteTestCase.tearDown(self) try: self.logger.info("processing data in %s!" % self._resultsDir) perf_blob = process_perf_data.create_perf_data( self._resultsDir, self.perf_suites(), self.perf_checkpoints(), self.perf_extra_opts()) self.logger.info("PERFHERDER_DATA: %s" % json.dumps(perf_blob)) perf_file = os.path.join(self._resultsDir, "perfherder_data.json") with open(perf_file, 'w') as fp: json.dump(perf_blob, fp, indent=2) self.logger.info("Perfherder data written to %s" % perf_file) except Exception: raise finally: # Make sure we cleanup and upload any existing files even if there # were errors processing the perf data. if self._dmd: self.cleanup_dmd() # copy it to moz upload dir if set if 'MOZ_UPLOAD_DIR' in os.environ: for file in os.listdir(self._resultsDir): file = os.path.join(self._resultsDir, file) if os.path.isfile(file): shutil.copy2(file, os.environ["MOZ_UPLOAD_DIR"])
def tearDown(self): # Force yet another restart with a clean profile to disconnect from the # profile and environment changes we've made, to leave a more or less # blank slate for the next person. self.marionette.restart(clean=True, in_app=False) self.setUpScriptData() # Super MarionetteTestCase.tearDown(self) # Some helpers to deal with removing a load of files import errno, stat def handleRemoveReadonly(func, path, exc): excvalue = exc[1] if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES: os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777 func(path) else: raise if self.desktop_backup_path: shutil.rmtree(self.desktop_backup_path, ignore_errors=False, onerror=handleRemoveReadonly) if self.reset_profile_path: # Remove ourselves from profiles.ini profileLeafName = os.path.basename(os.path.normpath(self.reset_profile_path)) self.runCode(""" let [salt, name] = arguments[0].split("."); let profile = global.profSvc.getProfileByName(name); profile.remove(false) global.profSvc.flush(); """, script_args=[profileLeafName]) # And delete all the files. shutil.rmtree(self.reset_profile_path, ignore_errors=False, onerror=handleRemoveReadonly)
def tearDown(self): self.logger.info("finished loading pages") self.marionette.set_context('chrome') time.sleep(10) ping = self.marionette.execute_script(GET_PING_SCRIPT) self.logger.info("retrieved telemetry ping\n") histograms = {} scalars = {} for name, process in HISTOGRAMS: histogramSet = self.findHistograms(ping, process, name) for name, histogram in histogramSet.items(): self.expandHistogram(histogram) histograms[name] = histogram for name, process in SCALARS: scalars[name] = self.findScalar(ping, process, name) try: os.mkdir('run') except: pass with open('run/ping.json', 'w') as out: json.dump(ping, out, sort_keys=True, indent=2) with open('run/histograms.json', 'w') as out: json.dump(histograms, out, sort_keys=True, indent=2) with open('run/scalars.json', 'w') as out: json.dump(scalars, out, sort_keys=True, indent=2) with open('run/histograms.txt', 'w') as out: for name, histogram in sorted(histograms.items()): rendered = self.renderHistogram(name, histogram) print >> out, rendered MarionetteTestCase.tearDown(self)
def tearDown(self): # Force yet another restart with a clean profile to disconnect from the # profile and environment changes we've made, to leave a more or less # blank slate for the next person. self.marionette.restart(clean=True, in_app=False) self.setUpScriptData() # Super MarionetteTestCase.tearDown(self) # Some helpers to deal with removing a load of files import errno import stat def handleRemoveReadonly(func, path, exc): excvalue = exc[1] if func in (os.rmdir, os.remove) and excvalue.errno == errno.EACCES: os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # 0777 func(path) else: raise for cleanup in self.cleanups: if cleanup.desktop_backup_path: shutil.rmtree(cleanup.desktop_backup_path, ignore_errors=False, onerror=handleRemoveReadonly) if cleanup.reset_profile_path: # Remove ourselves from profiles.ini self.runCode(""" let name = arguments[0]; let profile = global.profSvc.getProfileByName(name); profile.remove(false) global.profSvc.flush(); """, script_args=(cleanup.profile_name_to_remove, )) # Remove the local profile dir if it's not the same as the profile dir: different_path = cleanup.reset_profile_local_path != cleanup.reset_profile_path if cleanup.reset_profile_local_path and different_path: shutil.rmtree(cleanup.reset_profile_local_path, ignore_errors=False, onerror=handleRemoveReadonly) # TODO (Bug 1626581) - Move this to mozfile.remove. os = self.marionette.session_capabilities["platformName"] # Prepend the "\\?\" prefix on Windows to avoid file name too long issue. if os == "windows" and not cleanup.reset_profile_path.startswith( '\\\\?\\'): profile_path = r"\\?\%s" % cleanup.reset_profile_path else: profile_path = cleanup.reset_profile_path # And delete all the files. shutil.rmtree(profile_path, ignore_errors=False, onerror=handleRemoveReadonly)
def tearDown(self): # Ensure to restart a session if none exist for clean-up if not self.marionette.session: self.marionette.start_session() self.marionette.clear_pref("browser.startup.page") MarionetteTestCase.tearDown(self)
def tearDown(self): # Ensure to restart a session if none exist for clean-up if self.marionette.session is None: self.marionette.start_session() self.marionette.clear_pref("startup.homepage_welcome_url") MarionetteTestCase.tearDown(self)
def tearDown(self): self.assertEqual(self.get_context(), self.marionette.CONTEXT_CHROME) MarionetteTestCase.tearDown(self)
def tearDown(self): if self.is_mobile: self.marionette.set_orientation(default_orientation) self.assertEqual(self.marionette.orientation, default_orientation, "invalid state") MarionetteTestCase.tearDown(self)
def tearDown(self): self.assertNotEqual(self.win, self.marionette.current_window_handle) self.marionette.execute_script("window.close();") self.marionette.switch_to_window(self.win) MarionetteTestCase.tearDown(self)
def tearDown(self): try: self.marionette.delete_session() except: pass MarionetteTestCase.tearDown(self)
def tearDown(self): #ensure that we close the window, regardless of pass/failure self.close_all_windows() MarionetteTestCase.tearDown(self)
def tearDown(self): x, y = self.original_position["x"], self.original_position["y"] self.marionette.set_window_position(x, y) MarionetteTestCase.tearDown(self)
def tearDown(self): MarionetteTestCase.tearDown(self)
def tearDown(self): self.marionette.delete_all_cookies() MarionetteTestCase.tearDown(self)
def tearDown(self): if self.is_mobile: self.marionette.set_orientation(default_orientation) self.wait_for_orientation(default_orientation) MarionetteTestCase.tearDown(self)
def tearDown(self): BrowserMobProxyTestCaseMixin.tearDown(self) MarionetteTestCase.tearDown(self)
def tearDown(self): self.marionette.protocol = self.op MarionetteTestCase.tearDown(self)
def tearDown(self): self.logger.debug("tearing down!") MarionetteTestCase.tearDown(self) self.logger.debug("done tearing down!")
def tearDown(self): self.marionette.timeout.reset() MarionetteTestCase.tearDown(self)