diff --git a/examples/my_test_suite.py b/examples/my_test_suite.py index a5b93b6d..be5e6df4 100755 --- a/examples/my_test_suite.py +++ b/examples/my_test_suite.py @@ -14,7 +14,7 @@ class MyTestSuite(BaseCase): def test_2(self): # This test should FAIL - print "\n(This test fails on purpose)" + print("\n(This test fails on purpose)") self.open("http://xkcd.com/1675/") raise Exception("FAKE EXCEPTION: This test fails on purpose.") @@ -26,6 +26,6 @@ class MyTestSuite(BaseCase): def test_4(self): # This test should FAIL - print "\n(This test fails on purpose)" + print("\n(This test fails on purpose)") self.open("http://xkcd.com/1670/") self.find_element("FakeElement.DoesNotExist", timeout=0.5) diff --git a/examples/rate_limiting_test.py b/examples/rate_limiting_test.py index 123e6dd0..ded41fb6 100755 --- a/examples/rate_limiting_test.py +++ b/examples/rate_limiting_test.py @@ -6,9 +6,9 @@ class MyTestClass(BaseCase): @decorators.rate_limited(3.5) # The arg is max calls per second def print_item(self, item): - print item + print(item) def test_rate_limited_printing(self): - print "\nRunning rate-limited print test:" + print("\nRunning rate-limited print test:") for item in xrange(1, 11): self.print_item(item) diff --git a/seleniumbase/core/report_helper.py b/seleniumbase/core/report_helper.py index 52157588..f87e807e 100755 --- a/seleniumbase/core/report_helper.py +++ b/seleniumbase/core/report_helper.py @@ -212,16 +212,17 @@ def build_report(report_log_path, page_results_list, results_file = add_results_page(report_html) archived_results_file = report_log_path + '/' + HTML_REPORT shutil.copyfile(results_file, archived_results_file) - print "\n* The latest html report page is located at:\n" + results_file - print "\n* Files saved for this report are located at:\n" + report_log_path - print "" + print("\n* The latest html report page is located at:\n" + results_file) + print( + "\n* Files saved for this report are located at:\n" + report_log_path) + print("") if not hide_report: if browser_type == 'chrome': browser = webdriver.Chrome() else: browser = webdriver.Firefox() browser.get("file://%s" % archived_results_file) - print "\n*** Close the html report window to continue. ***" + print("\n*** Close the html report window to continue. ***") while len(browser.window_handles): time.sleep(0.1) browser.quit() diff --git a/seleniumbase/core/selenium_launcher.py b/seleniumbase/core/selenium_launcher.py index 2049fab6..b23f3073 100755 --- a/seleniumbase/core/selenium_launcher.py +++ b/seleniumbase/core/selenium_launcher.py @@ -19,11 +19,11 @@ def download_selenium(): try: local_file = open(JAR_FILE, 'wb') remote_file = urllib.urlopen(SELENIUM_JAR) - print 'Downloading Selenium Server JAR File...\n' + print('Downloading Selenium Server JAR File...\n') local_file.write(remote_file.read()) local_file.close() remote_file.close() - print 'Download Complete!\n' + print('Download Complete!\n') except Exception, details: raise Exception("Error while downloading Selenium Server. Details: %s" % details) @@ -91,4 +91,4 @@ def execute_selenium(host, port, file_path): try: return start_selenium_server(JAR_FILE, port, file_path) except StartSeleniumException: - print "Selenium Server might already be running. Continuing... " + print("Selenium Server might already be running. Continuing... ") diff --git a/seleniumbase/fixtures/base_case.py b/seleniumbase/fixtures/base_case.py index 67c9709d..9c8d14c6 100755 --- a/seleniumbase/fixtures/base_case.py +++ b/seleniumbase/fixtures/base_case.py @@ -974,7 +974,7 @@ class BaseCase(unittest.TestCase): uploaded_files.append(logfile_name) s3_bucket.save_uploaded_file_names(uploaded_files) index_file = s3_bucket.upload_index_file(test_id, guid) - print "\n\n*** Log files uploaded: ***\n%s\n" % index_file + print("\n\n*** Log files uploaded: ***\n%s\n" % index_file) logging.error( "\n\n*** Log files uploaded: ***\n%s\n" % index_file) if self.with_db_reporting: diff --git a/seleniumbase/plugins/base_plugin.py b/seleniumbase/plugins/base_plugin.py index c123bfaf..cc8803ff 100755 --- a/seleniumbase/plugins/base_plugin.py +++ b/seleniumbase/plugins/base_plugin.py @@ -132,8 +132,8 @@ class Base(Plugin): def add_fails_or_errors(self, test): if self.report_on: if test.id() == 'nose.failure.Failure.runTest': - print ">>> ERROR: Could not locate tests to run!" - print ">>> The Test Report WILL NOT be generated!" + print(">>> ERROR: Could not locate tests to run!") + print(">>> The Test Report WILL NOT be generated!") self.import_error = True return self.failures.append(test.id()) @@ -154,9 +154,9 @@ class Base(Plugin): if (err[0] == errors.BlockedTest or err[0] == errors.SkipTest or err[0] == errors.DeprecatedTest): - print err[1].__str__().split('''-------------------- >> ''' + print(err[1].__str__().split('''-------------------- >> ''' '''begin captured logging''' - ''' << --------------------''', 1)[0] + ''' << --------------------''', 1)[0]) else: self.__log_all_options_if_none_specified(test) self.add_fails_or_errors(test) diff --git a/seleniumbase/plugins/s3_logging_plugin.py b/seleniumbase/plugins/s3_logging_plugin.py index 29058e1a..881a4a72 100755 --- a/seleniumbase/plugins/s3_logging_plugin.py +++ b/seleniumbase/plugins/s3_logging_plugin.py @@ -36,7 +36,7 @@ class S3Logging(Plugin): uploaded_files.append(logfile_name) s3_bucket.save_uploaded_file_names(uploaded_files) index_file = s3_bucket.upload_index_file(test.id(), guid) - print "\n\n*** Log files uploaded: ***\n%s\n" % index_file + print("\n\n*** Log files uploaded: ***\n%s\n" % index_file) logging.error("\n\n*** Log files uploaded: ***\n%s\n" % index_file) # If the database plugin is running, attach a link diff --git a/seleniumbase/plugins/selenium_plugin.py b/seleniumbase/plugins/selenium_plugin.py index a0eee703..92ca6f6c 100755 --- a/seleniumbase/plugins/selenium_plugin.py +++ b/seleniumbase/plugins/selenium_plugin.py @@ -121,8 +121,8 @@ class SeleniumBrowser(Plugin): test.test.demo_mode = self.options.demo_mode test.test.demo_sleep = self.options.demo_sleep except Exception as err: - print "Error starting/connecting to Selenium:" - print err + print("Error starting/connecting to Selenium:") + print(err) os.kill(os.getpid(), 9) else: connected = False @@ -139,21 +139,21 @@ class SeleniumBrowser(Plugin): connected = True break except Exception as err: - print "Attempt #%s to connect to Selenium failed" % i + print("Attempt #%s to connect to Selenium failed" % i) if i < 3: - print "Retrying in 3 seconds..." + print("Retrying in 3 seconds...") time.sleep(3) if not connected: - print "Error starting/connecting to Selenium:" - print err - print "\n\n" + print("Error starting/connecting to Selenium:") + print(err) + print("\n\n") os.kill(os.getpid(), 9) def afterTest(self, test): try: self.driver.quit() except: - print "No driver to quit." + print("No driver to quit.") if self.options.headless: if self.headless_active: self.display.stop()