def __init__(self, **kwargs): MarionetteTestRunner.__init__(self, **kwargs) width = 80 if not (self.testvars.get('acknowledged_risks') is True or os.environ.get('GAIATEST_ACKNOWLEDGED_RISKS')): url = 'https://developer.mozilla.org/en-US/docs/Gaia_Test_Runner#Risks' heading = 'Acknowledge risks' message = 'These tests are destructive and will remove data from the target Firefox OS instance as well ' \ 'as using services that may incur costs! Before you can run these tests you must follow the ' \ 'steps to indicate you have acknowledged the risks detailed at the following address:' print '\n' + '*' * 5 + ' %s ' % heading.upper() + '*' * (width - len(heading) - 7) print '\n'.join(textwrap.wrap(message, width)) print url print '*' * width + '\n' sys.exit(1) if not (self.testvars.get('skip_warning') is True or os.environ.get('GAIATEST_SKIP_WARNING')): delay = 30 heading = 'Warning' message = 'You are about to run destructive tests against a Firefox OS instance. These tests ' \ 'will restore the target to a clean state, meaning any personal data such as contacts, ' \ 'messages, photos, videos, music, etc. will be removed. This may include data on the ' \ 'microSD card. The tests may also attempt to initiate outgoing calls, or connect to ' \ 'services such as cellular data, wifi, gps, bluetooth, etc.' try: print '\n' + '*' * 5 + ' %s ' % heading.upper() + '*' * (width - len(heading) - 7) print '\n'.join(textwrap.wrap(message, width)) print '*' * width + '\n' print 'To abort the test run hit Ctrl+C on your keyboard.' print 'The test run will continue in %d seconds.' % delay time.sleep(delay) except KeyboardInterrupt: print '\nTest run aborted by user.' sys.exit(1) print 'Continuing with test run...\n'
def run_tests(self, tests): MarionetteTestRunner.run_tests(self, tests) if self.html_output: # change default encoding to avoid encoding problem for page source reload(sys) sys.setdefaultencoding("utf-8") html_dir = os.path.dirname(os.path.abspath(self.html_output)) if not os.path.exists(html_dir): os.makedirs(html_dir) with open(self.html_output, "w") as f: f.write(self.generate_html(self.results))
def run_tests(self, tests): MarionetteTestRunner.run_tests(self, tests) if self.html_output: # change default encoding to avoid encoding problem for page source reload(sys) sys.setdefaultencoding('utf-8') html_dir = os.path.dirname(os.path.abspath(self.html_output)) if not os.path.exists(html_dir): os.makedirs(html_dir) with open(self.html_output, 'w') as f: f.write(self.generate_html(self.results))
def __init__(self, html_output=None, **kwargs): MarionetteTestRunner.__init__(self, **kwargs) width = 80 if not (self.testvars.get("acknowledged_risks") is True or os.environ.get("GAIATEST_ACKNOWLEDGED_RISKS")): url = "https://developer.mozilla.org/en-US/docs/Gaia_Test_Runner#Risks" heading = "Acknowledge risks" message = ( "These tests are destructive and will remove data from the target Firefox OS instance as well " "as using services that may incur costs! Before you can run these tests you must follow the " "steps to indicate you have acknowledged the risks detailed at the following address:" ) print "\n" + "*" * 5 + " %s " % heading.upper() + "*" * (width - len(heading) - 7) print "\n".join(textwrap.wrap(message, width)) print url print "*" * width + "\n" sys.exit(1) if not (self.testvars.get("skip_warning") is True or os.environ.get("GAIATEST_SKIP_WARNING")): delay = 30 heading = "Warning" message = ( "You are about to run destructive tests against a Firefox OS instance. These tests " "will restore the target to a clean state, meaning any personal data such as contacts, " "messages, photos, videos, music, etc. will be removed. This will include data on the " "microSD card. The tests may also attempt to initiate outgoing calls, or connect to " "services such as cellular data, wifi, gps, bluetooth, etc." ) try: print "\n" + "*" * 5 + " %s " % heading.upper() + "*" * (width - len(heading) - 7) print "\n".join(textwrap.wrap(message, width)) print "*" * width + "\n" print "To abort the test run hit Ctrl+C on your keyboard." print "The test run will continue in %d seconds." % delay time.sleep(delay) except KeyboardInterrupt: print "\nTest run aborted by user." sys.exit(1) print "Continuing with test run...\n" # for HTML output self.html_output = html_output self.testvars["html_output"] = self.html_output self.results = []
def __init__(self, html_output=None, **kwargs): MarionetteTestRunner.__init__(self, **kwargs) width = 80 if not (self.testvars.get('acknowledged_risks') is True or os.environ.get('GAIATEST_ACKNOWLEDGED_RISKS')): url = 'https://developer.mozilla.org/en-US/docs/Gaia_Test_Runner#Risks' heading = 'Acknowledge risks' message = 'These tests are destructive and will remove data from the target Firefox OS instance as well ' \ 'as using services that may incur costs! Before you can run these tests you must follow the ' \ 'steps to indicate you have acknowledged the risks detailed at the following address:' print '\n' + '*' * 5 + ' %s ' % heading.upper() + '*' * ( width - len(heading) - 7) print '\n'.join(textwrap.wrap(message, width)) print url print '*' * width + '\n' sys.exit(1) if not (self.testvars.get('skip_warning') is True or os.environ.get('GAIATEST_SKIP_WARNING')): delay = 30 heading = 'Warning' message = 'You are about to run destructive tests against a Firefox OS instance. These tests ' \ 'will restore the target to a clean state, meaning any personal data such as contacts, ' \ 'messages, photos, videos, music, etc. will be removed. This may include data on the ' \ 'microSD card. The tests may also attempt to initiate outgoing calls, or connect to ' \ 'services such as cellular data, wifi, gps, bluetooth, etc.' try: print '\n' + '*' * 5 + ' %s ' % heading.upper() + '*' * ( width - len(heading) - 7) print '\n'.join(textwrap.wrap(message, width)) print '*' * width + '\n' print 'To abort the test run hit Ctrl+C on your keyboard.' print 'The test run will continue in %d seconds.' % delay time.sleep(delay) except KeyboardInterrupt: print '\nTest run aborted by user.' sys.exit(1) print 'Continuing with test run...\n' # for HTML output self.html_output = html_output self.testvars['html_output'] = self.html_output self.results = []