当前位置: 首页>>代码示例>>Python>>正文


Python MarionetteTestCase.tearDown方法代码示例

本文整理汇总了Python中marionette_harness.MarionetteTestCase.tearDown方法的典型用法代码示例。如果您正苦于以下问题:Python MarionetteTestCase.tearDown方法的具体用法?Python MarionetteTestCase.tearDown怎么用?Python MarionetteTestCase.tearDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在marionette_harness.MarionetteTestCase的用法示例。


在下文中一共展示了MarionetteTestCase.tearDown方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
    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)
开发者ID:kinetiknz,项目名称:gecko-dev,代码行数:35,代码来源:test_refresh_firefox.py

示例2: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
    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!")
开发者ID:luke-chang,项目名称:gecko-1,代码行数:28,代码来源:test_memory_usage.py

示例3: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
    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)
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:10,代码来源:test_quit_restart.py

示例4: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
 def tearDown(self):
     self.marionette.delete_all_cookies()
     MarionetteTestCase.tearDown(self)
开发者ID:luke-chang,项目名称:gecko-1,代码行数:5,代码来源:test_cookies.py

示例5: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
 def tearDown(self):
     self.assertEqual(self.get_context(), self.marionette.CONTEXT_CHROME)
     MarionetteTestCase.tearDown(self)
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:5,代码来源:test_teardown_context_preserved.py

示例6: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
 def tearDown(self):
     self.marionette.timeout.reset()
     MarionetteTestCase.tearDown(self)
开发者ID:luke-chang,项目名称:gecko-1,代码行数:5,代码来源:test_timeouts.py

示例7: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
 def tearDown(self):
     #ensure that we close the window, regardless of pass/failure
     self.close_all_windows()
     MarionetteTestCase.tearDown(self)
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:6,代码来源:test_window_management.py

示例8: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
 def tearDown(self):
     self.marionette.protocol = self.op
     MarionetteTestCase.tearDown(self)
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:5,代码来源:test_marionette.py

示例9: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
 def tearDown(self):
     BrowserMobProxyTestCaseMixin.tearDown(self)
     MarionetteTestCase.tearDown(self)
开发者ID:luke-chang,项目名称:gecko-1,代码行数:5,代码来源:browsermob.py

示例10: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
 def tearDown(self):
     x, y = self.original_position["x"], self.original_position["y"]
     self.marionette.set_window_position(x, y)
     MarionetteTestCase.tearDown(self)
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:6,代码来源:test_window_rect.py

示例11: tearDown

# 需要导入模块: from marionette_harness import MarionetteTestCase [as 别名]
# 或者: from marionette_harness.MarionetteTestCase import tearDown [as 别名]
 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)
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:7,代码来源:test_screen_orientation.py


注:本文中的marionette_harness.MarionetteTestCase.tearDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。