diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-09 14:05:09 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-11 10:34:30 +0100 |
commit | 3795f4d6a69dc4ba5208f1d05b89e65bc11d8a10 (patch) | |
tree | 363978673f3e06a03bc2f4a3cb629dd5011cf40a /bitbake/lib/toaster | |
parent | a9d90f74050e2129171da09ca3427720887f67ee (diff) | |
download | poky-3795f4d6a69dc4ba5208f1d05b89e65bc11d8a10.tar.gz |
bitbake: bin, toaster: Fix print and exception syntax
This updates the print "" syntax to print() and fixes some exception
handling syntax such that its compatible with python v2 and v3.
(Bitbake rev: 58304fcce9727fd89564436771356c033ecd22a3)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
10 files changed, 114 insertions, 114 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py index 5e70437b24..6b1da1b103 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | |||
@@ -70,11 +70,11 @@ class Command(NoArgsCommand): | |||
70 | return True | 70 | return True |
71 | 71 | ||
72 | if len(be.sourcedir) == 0: | 72 | if len(be.sourcedir) == 0: |
73 | print "\n -- Validation: The layers checkout directory must be set." | 73 | print("\n -- Validation: The layers checkout directory must be set.") |
74 | is_changed = _update_sourcedir() | 74 | is_changed = _update_sourcedir() |
75 | 75 | ||
76 | if not be.sourcedir.startswith("/"): | 76 | if not be.sourcedir.startswith("/"): |
77 | print "\n -- Validation: The layers checkout directory must be set to an absolute path." | 77 | print("\n -- Validation: The layers checkout directory must be set to an absolute path.") |
78 | is_changed = _update_sourcedir() | 78 | is_changed = _update_sourcedir() |
79 | 79 | ||
80 | if is_changed: | 80 | if is_changed: |
@@ -87,16 +87,16 @@ class Command(NoArgsCommand): | |||
87 | return True | 87 | return True |
88 | 88 | ||
89 | if len(be.builddir) == 0: | 89 | if len(be.builddir) == 0: |
90 | print "\n -- Validation: The build directory must be set." | 90 | print("\n -- Validation: The build directory must be set.") |
91 | is_changed = _update_builddir() | 91 | is_changed = _update_builddir() |
92 | 92 | ||
93 | if not be.builddir.startswith("/"): | 93 | if not be.builddir.startswith("/"): |
94 | print "\n -- Validation: The build directory must to be set to an absolute path." | 94 | print("\n -- Validation: The build directory must to be set to an absolute path.") |
95 | is_changed = _update_builddir() | 95 | is_changed = _update_builddir() |
96 | 96 | ||
97 | 97 | ||
98 | if is_changed: | 98 | if is_changed: |
99 | print "\nBuild configuration saved" | 99 | print("\nBuild configuration saved") |
100 | be.save() | 100 | be.save() |
101 | return True | 101 | return True |
102 | 102 | ||
@@ -104,20 +104,20 @@ class Command(NoArgsCommand): | |||
104 | if be.needs_import: | 104 | if be.needs_import: |
105 | try: | 105 | try: |
106 | config_file = os.environ.get('TOASTER_CONF') | 106 | config_file = os.environ.get('TOASTER_CONF') |
107 | print "\nImporting file: %s" % config_file | 107 | print("\nImporting file: %s" % config_file) |
108 | from loadconf import Command as LoadConfigCommand | 108 | from loadconf import Command as LoadConfigCommand |
109 | 109 | ||
110 | LoadConfigCommand()._import_layer_config(config_file) | 110 | LoadConfigCommand()._import_layer_config(config_file) |
111 | # we run lsupdates after config update | 111 | # we run lsupdates after config update |
112 | print "\nLayer configuration imported. Updating information from the layer sources, please wait.\nYou can re-update any time later by running bitbake/lib/toaster/manage.py lsupdates" | 112 | print("\nLayer configuration imported. Updating information from the layer sources, please wait.\nYou can re-update any time later by running bitbake/lib/toaster/manage.py lsupdates") |
113 | from django.core.management import call_command | 113 | from django.core.management import call_command |
114 | call_command("lsupdates") | 114 | call_command("lsupdates") |
115 | 115 | ||
116 | # we don't look for any other config files | 116 | # we don't look for any other config files |
117 | return is_changed | 117 | return is_changed |
118 | except Exception as e: | 118 | except Exception as e: |
119 | print "Failure while trying to import the toaster config file %s: %s" %\ | 119 | print("Failure while trying to import the toaster config file %s: %s" %\ |
120 | (config_file, e) | 120 | (config_file, e)) |
121 | traceback.print_exc(e) | 121 | traceback.print_exc(e) |
122 | 122 | ||
123 | return is_changed | 123 | return is_changed |
diff --git a/bitbake/lib/toaster/bldcontrol/tests.py b/bitbake/lib/toaster/bldcontrol/tests.py index f20cc7d4b1..32985c3280 100644 --- a/bitbake/lib/toaster/bldcontrol/tests.py +++ b/bitbake/lib/toaster/bldcontrol/tests.py | |||
@@ -53,7 +53,7 @@ class BEControllerTests(object): | |||
53 | # setting layers, skip any layer info | 53 | # setting layers, skip any layer info |
54 | bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) | 54 | bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) |
55 | except NotImplementedError: | 55 | except NotImplementedError: |
56 | print "Test skipped due to command not implemented yet" | 56 | print("Test skipped due to command not implemented yet") |
57 | return True | 57 | return True |
58 | # We are ok with the exception as we're handling the git already exists | 58 | # We are ok with the exception as we're handling the git already exists |
59 | except BuildSetupException: | 59 | except BuildSetupException: |
@@ -79,7 +79,7 @@ class BEControllerTests(object): | |||
79 | # setting layers, skip any layer info | 79 | # setting layers, skip any layer info |
80 | layerSet = bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) | 80 | layerSet = bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) |
81 | except NotImplementedError: | 81 | except NotImplementedError: |
82 | print "Test skipped due to command not implemented yet" | 82 | print("Test skipped due to command not implemented yet") |
83 | return True | 83 | return True |
84 | # We are ok with the exception as we're handling the git already exists | 84 | # We are ok with the exception as we're handling the git already exists |
85 | except BuildSetupException: | 85 | except BuildSetupException: |
diff --git a/bitbake/lib/toaster/contrib/tts/toasteruitest/run_toastertests.py b/bitbake/lib/toaster/contrib/tts/toasteruitest/run_toastertests.py index 754636f0fa..8ca45a8136 100755 --- a/bitbake/lib/toaster/contrib/tts/toasteruitest/run_toastertests.py +++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/run_toastertests.py | |||
@@ -74,7 +74,7 @@ def get_tests_from_cfg(suite=None): | |||
74 | try: | 74 | try: |
75 | tests_from_cfg = eval(config.get('toaster_test_' + target_suite, 'test_cases')) | 75 | tests_from_cfg = eval(config.get('toaster_test_' + target_suite, 'test_cases')) |
76 | except: | 76 | except: |
77 | print 'Failed to get test cases from cfg file. Make sure the format is correct.' | 77 | print('Failed to get test cases from cfg file. Make sure the format is correct.') |
78 | return None | 78 | return None |
79 | 79 | ||
80 | prefix = 'toaster_automation_test.toaster_cases.test_' | 80 | prefix = 'toaster_automation_test.toaster_cases.test_' |
@@ -100,7 +100,7 @@ def main(): | |||
100 | testslist = get_tests_from_cfg() | 100 | testslist = get_tests_from_cfg() |
101 | 101 | ||
102 | if not testslist: | 102 | if not testslist: |
103 | print 'Failed to get test cases.' | 103 | print('Failed to get test cases.') |
104 | exit(1) | 104 | exit(1) |
105 | 105 | ||
106 | suite = unittest.TestSuite() | 106 | suite = unittest.TestSuite() |
diff --git a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py index d8f838aeaf..1a786fa021 100755 --- a/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py +++ b/bitbake/lib/toaster/contrib/tts/toasteruitest/toaster_automation_test.py | |||
@@ -61,7 +61,7 @@ def get_log_root_dir(): | |||
61 | break | 61 | break |
62 | 62 | ||
63 | if number == (max_depth - 1): | 63 | if number == (max_depth - 1): |
64 | print 'No log dir found. Please check' | 64 | print('No log dir found. Please check') |
65 | raise Exception | 65 | raise Exception |
66 | 66 | ||
67 | return log_root_dir | 67 | return log_root_dir |
@@ -152,7 +152,7 @@ def is_list_sequenced(testlist): | |||
152 | return (sorted(list_number) == list_number) | 152 | return (sorted(list_number) == list_number) |
153 | 153 | ||
154 | else: | 154 | else: |
155 | print 'Unrecognized list type, please check' | 155 | print('Unrecognized list type, please check') |
156 | return False | 156 | return False |
157 | 157 | ||
158 | 158 | ||
@@ -201,7 +201,7 @@ def is_list_inverted(testlist): | |||
201 | return (sorted(list_number, reverse = True) == list_number) | 201 | return (sorted(list_number, reverse = True) == list_number) |
202 | 202 | ||
203 | else: | 203 | else: |
204 | print 'Unrecognized list type, please check' | 204 | print('Unrecognized list type, please check') |
205 | return False | 205 | return False |
206 | 206 | ||
207 | def replace_file_content(filename, item, option): | 207 | def replace_file_content(filename, item, option): |
@@ -361,7 +361,7 @@ class toaster_cases_base(unittest.TestCase): | |||
361 | 361 | ||
362 | def setup_browser(self, *browser_path): | 362 | def setup_browser(self, *browser_path): |
363 | self.browser = eval(self.parser.get('toaster_test_' + self.target_suite, 'test_browser')) | 363 | self.browser = eval(self.parser.get('toaster_test_' + self.target_suite, 'test_browser')) |
364 | print self.browser | 364 | print(self.browser) |
365 | if self.browser == "firefox": | 365 | if self.browser == "firefox": |
366 | driver = webdriver.Firefox() | 366 | driver = webdriver.Firefox() |
367 | elif self.browser == "chrome": | 367 | elif self.browser == "chrome": |
@@ -370,7 +370,7 @@ class toaster_cases_base(unittest.TestCase): | |||
370 | driver = webdriver.Ie() | 370 | driver = webdriver.Ie() |
371 | else: | 371 | else: |
372 | driver = None | 372 | driver = None |
373 | print "unrecognized browser type, please check" | 373 | print("unrecognized browser type, please check") |
374 | self.driver = driver | 374 | self.driver = driver |
375 | self.driver.implicitly_wait(30) | 375 | self.driver.implicitly_wait(30) |
376 | return self.driver | 376 | return self.driver |
@@ -440,8 +440,8 @@ class toaster_cases_base(unittest.TestCase): | |||
440 | try: | 440 | try: |
441 | table_element = self.get_table_element(table_id) | 441 | table_element = self.get_table_element(table_id) |
442 | element = table_element.find_element_by_xpath("//*[text()='" + text_string + "']") | 442 | element = table_element.find_element_by_xpath("//*[text()='" + text_string + "']") |
443 | except NoSuchElementException, e: | 443 | except NoSuchElementException as e: |
444 | print 'no element found' | 444 | print('no element found') |
445 | raise | 445 | raise |
446 | return element | 446 | return element |
447 | 447 | ||
@@ -454,8 +454,8 @@ class toaster_cases_base(unittest.TestCase): | |||
454 | try: | 454 | try: |
455 | table_element = self.get_table_element(table_id) | 455 | table_element = self.get_table_element(table_id) |
456 | element = table_element.find_element_by_link_text(link_text) | 456 | element = table_element.find_element_by_link_text(link_text) |
457 | except NoSuchElementException, e: | 457 | except NoSuchElementException as e: |
458 | print 'no element found' | 458 | print('no element found') |
459 | raise | 459 | raise |
460 | return element | 460 | return element |
461 | 461 | ||
@@ -467,8 +467,8 @@ class toaster_cases_base(unittest.TestCase): | |||
467 | try: | 467 | try: |
468 | table_element = self.get_table_element(table_id) | 468 | table_element = self.get_table_element(table_id) |
469 | element_list = table_element.find_elements_by_link_text(link_text) | 469 | element_list = table_element.find_elements_by_link_text(link_text) |
470 | except NoSuchElementException, e: | 470 | except NoSuchElementException as e: |
471 | print 'no element found' | 471 | print('no element found') |
472 | raise | 472 | raise |
473 | return element_list | 473 | return element_list |
474 | 474 | ||
@@ -481,8 +481,8 @@ class toaster_cases_base(unittest.TestCase): | |||
481 | table_element = self.get_table_element(table_id) | 481 | table_element = self.get_table_element(table_id) |
482 | element = table_element.find_element_by_partial_link_text(link_text) | 482 | element = table_element.find_element_by_partial_link_text(link_text) |
483 | return element | 483 | return element |
484 | except NoSuchElementException, e: | 484 | except NoSuchElementException as e: |
485 | print 'no element found' | 485 | print('no element found') |
486 | raise | 486 | raise |
487 | 487 | ||
488 | 488 | ||
@@ -494,8 +494,8 @@ class toaster_cases_base(unittest.TestCase): | |||
494 | table_element = self.get_table_element(table_id) | 494 | table_element = self.get_table_element(table_id) |
495 | element_list = table_element.find_elements_by_partial_link_text(link_text) | 495 | element_list = table_element.find_elements_by_partial_link_text(link_text) |
496 | return element_list | 496 | return element_list |
497 | except NoSuchElementException, e: | 497 | except NoSuchElementException as e: |
498 | print 'no element found' | 498 | print('no element found') |
499 | raise | 499 | raise |
500 | 500 | ||
501 | 501 | ||
@@ -506,8 +506,8 @@ class toaster_cases_base(unittest.TestCase): | |||
506 | try: | 506 | try: |
507 | table_element = self.get_table_element(table_id) | 507 | table_element = self.get_table_element(table_id) |
508 | element = table_element.find_element_by_xpath(xpath) | 508 | element = table_element.find_element_by_xpath(xpath) |
509 | except NoSuchElementException, e: | 509 | except NoSuchElementException as e: |
510 | print 'no element found' | 510 | print('no element found') |
511 | raise | 511 | raise |
512 | return element | 512 | return element |
513 | 513 | ||
@@ -519,8 +519,8 @@ class toaster_cases_base(unittest.TestCase): | |||
519 | try: | 519 | try: |
520 | table_element = self.get_table_element(table_id) | 520 | table_element = self.get_table_element(table_id) |
521 | element_list = table_element.find_elements_by_xpath(xpath) | 521 | element_list = table_element.find_elements_by_xpath(xpath) |
522 | except NoSuchElementException, e: | 522 | except NoSuchElementException as e: |
523 | print 'no elements found' | 523 | print('no elements found') |
524 | raise | 524 | raise |
525 | return element_list | 525 | return element_list |
526 | 526 | ||
@@ -570,7 +570,7 @@ class toaster_cases_base(unittest.TestCase): | |||
570 | element_xpath = "//*[@id='" + table_id + "']" | 570 | element_xpath = "//*[@id='" + table_id + "']" |
571 | try: | 571 | try: |
572 | element = self.driver.find_element_by_xpath(element_xpath) | 572 | element = self.driver.find_element_by_xpath(element_xpath) |
573 | except NoSuchElementException, e: | 573 | except NoSuchElementException as e: |
574 | raise | 574 | raise |
575 | return element | 575 | return element |
576 | row = coordinate[0] | 576 | row = coordinate[0] |
@@ -580,7 +580,7 @@ class toaster_cases_base(unittest.TestCase): | |||
580 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]" | 580 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]" |
581 | try: | 581 | try: |
582 | element = self.driver.find_element_by_xpath(element_xpath) | 582 | element = self.driver.find_element_by_xpath(element_xpath) |
583 | except NoSuchElementException, e: | 583 | except NoSuchElementException as e: |
584 | return False | 584 | return False |
585 | return element | 585 | return element |
586 | #now we are looking for an element with specified X and Y | 586 | #now we are looking for an element with specified X and Y |
@@ -589,7 +589,7 @@ class toaster_cases_base(unittest.TestCase): | |||
589 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]/td[" + str(column) + "]" | 589 | element_xpath = "//*[@id='" + table_id + "']/tbody/tr[" + str(row) + "]/td[" + str(column) + "]" |
590 | try: | 590 | try: |
591 | element = self.driver.find_element_by_xpath(element_xpath) | 591 | element = self.driver.find_element_by_xpath(element_xpath) |
592 | except NoSuchElementException, e: | 592 | except NoSuchElementException as e: |
593 | return False | 593 | return False |
594 | return element | 594 | return element |
595 | 595 | ||
@@ -607,7 +607,7 @@ class toaster_cases_base(unittest.TestCase): | |||
607 | column = column + 1 | 607 | column = column + 1 |
608 | print("row_content=",row_content) | 608 | print("row_content=",row_content) |
609 | Lists.extend(row_content) | 609 | Lists.extend(row_content) |
610 | print Lists[row-1][0] | 610 | print(Lists[row-1][0]) |
611 | row = row + 1 | 611 | row = row + 1 |
612 | return Lists | 612 | return Lists |
613 | 613 | ||
@@ -617,7 +617,7 @@ class toaster_cases_base(unittest.TestCase): | |||
617 | def is_text_present (self, patterns): | 617 | def is_text_present (self, patterns): |
618 | for pattern in patterns: | 618 | for pattern in patterns: |
619 | if str(pattern) not in self.driver.page_source: | 619 | if str(pattern) not in self.driver.page_source: |
620 | print 'Text "'+pattern+'" is missing' | 620 | print('Text "'+pattern+'" is missing') |
621 | return False | 621 | return False |
622 | return True | 622 | return True |
623 | 623 | ||
@@ -625,15 +625,15 @@ class toaster_cases_base(unittest.TestCase): | |||
625 | def is_element_present(self, how, what): | 625 | def is_element_present(self, how, what): |
626 | try: | 626 | try: |
627 | self.driver.find_element(how, what) | 627 | self.driver.find_element(how, what) |
628 | except NoSuchElementException, e: | 628 | except NoSuchElementException as e: |
629 | print 'Could not find element '+str(what)+' by ' + str(how) | 629 | print('Could not find element '+str(what)+' by ' + str(how)) |
630 | return False | 630 | return False |
631 | return True | 631 | return True |
632 | 632 | ||
633 | 633 | ||
634 | def is_alert_present(self): | 634 | def is_alert_present(self): |
635 | try: self.driver.switch_to_alert() | 635 | try: self.driver.switch_to_alert() |
636 | except NoAlertPresentException, e: return False | 636 | except NoAlertPresentException as e: return False |
637 | return True | 637 | return True |
638 | 638 | ||
639 | 639 | ||
@@ -658,7 +658,7 @@ class toaster_cases_base(unittest.TestCase): | |||
658 | try: | 658 | try: |
659 | caseno = int(caseno_str) | 659 | caseno = int(caseno_str) |
660 | except ValueError: | 660 | except ValueError: |
661 | print "get case number error! please check if func name is test_xxx" | 661 | print("get case number error! please check if func name is test_xxx") |
662 | return False | 662 | return False |
663 | return caseno | 663 | return caseno |
664 | 664 | ||
@@ -706,7 +706,7 @@ class toaster_cases(toaster_cases_base): | |||
706 | for key in table_head_dict: | 706 | for key in table_head_dict: |
707 | try: | 707 | try: |
708 | self.driver.find_element_by_link_text(key).click() | 708 | self.driver.find_element_by_link_text(key).click() |
709 | except Exception, e: | 709 | except Exception as e: |
710 | self.log.error("%s cannot be found on page" % key) | 710 | self.log.error("%s cannot be found on page" % key) |
711 | raise | 711 | raise |
712 | column_list = self.get_table_column_text("class", table_head_dict[key]) | 712 | column_list = self.get_table_column_text("class", table_head_dict[key]) |
@@ -736,7 +736,7 @@ class toaster_cases(toaster_cases_base): | |||
736 | patterns = ["minimal", "sato"] | 736 | patterns = ["minimal", "sato"] |
737 | for pattern in patterns: | 737 | for pattern in patterns: |
738 | ori_target_column_texts = self.get_table_column_text("class", "target") | 738 | ori_target_column_texts = self.get_table_column_text("class", "target") |
739 | print ori_target_column_texts | 739 | print(ori_target_column_texts) |
740 | self.driver.find_element_by_id("search").clear() | 740 | self.driver.find_element_by_id("search").clear() |
741 | self.driver.find_element_by_id("search").send_keys(pattern) | 741 | self.driver.find_element_by_id("search").send_keys(pattern) |
742 | self.driver.find_element_by_id("search-button").click() | 742 | self.driver.find_element_by_id("search-button").click() |
@@ -771,7 +771,7 @@ class toaster_cases(toaster_cases_base): | |||
771 | temp_element = self.find_element_by_text_in_table('otable', item) | 771 | temp_element = self.find_element_by_text_in_table('otable', item) |
772 | # this is how we find "filter icon" in the same level as temp_element(where "a" means clickable, "i" means icon) | 772 | # this is how we find "filter icon" in the same level as temp_element(where "a" means clickable, "i" means icon) |
773 | self.assertTrue(temp_element.find_element_by_xpath("..//*/a/i[@class='icon-filter filtered']")) | 773 | self.assertTrue(temp_element.find_element_by_xpath("..//*/a/i[@class='icon-filter filtered']")) |
774 | except Exception,e: | 774 | except Exception as e: |
775 | self.assertFalse(True, msg=(" %s cannot be found! %s" % (item, e))) | 775 | self.assertFalse(True, msg=(" %s cannot be found! %s" % (item, e))) |
776 | raise | 776 | raise |
777 | # step 5-6 | 777 | # step 5-6 |
@@ -812,7 +812,7 @@ class toaster_cases(toaster_cases_base): | |||
812 | self.table_name = 'otable' | 812 | self.table_name = 'otable' |
813 | # This is how we find the "default" rows-number! | 813 | # This is how we find the "default" rows-number! |
814 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) | 814 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) |
815 | print rows_displayed | 815 | print(rows_displayed) |
816 | self.assertTrue(self.get_table_element(self.table_name, rows_displayed), msg=("not enough rows displayed")) | 816 | self.assertTrue(self.get_table_element(self.table_name, rows_displayed), msg=("not enough rows displayed")) |
817 | self.assertFalse(self.get_table_element(self.table_name, rows_displayed + 1), \ | 817 | self.assertFalse(self.get_table_element(self.table_name, rows_displayed + 1), \ |
818 | msg=("more rows displayed than expected")) | 818 | msg=("more rows displayed than expected")) |
@@ -888,7 +888,7 @@ class toaster_cases(toaster_cases_base): | |||
888 | temp_element.find_element_by_xpath("..//*[@class='icon-filter filtered']").click() | 888 | temp_element.find_element_by_xpath("..//*[@class='icon-filter filtered']").click() |
889 | avail_options = self.driver.find_elements_by_xpath("//*[@id='" + filter_dict[key] + "']//*[@name='filter'][not(@disabled)]") | 889 | avail_options = self.driver.find_elements_by_xpath("//*[@id='" + filter_dict[key] + "']//*[@name='filter'][not(@disabled)]") |
890 | except: | 890 | except: |
891 | print "in exception" | 891 | print("in exception") |
892 | self.find_element_by_text("Show all tasks").click() | 892 | self.find_element_by_text("Show all tasks").click() |
893 | # self.driver.find_element_by_xpath("//*[@id='searchform']/button[2]").click() | 893 | # self.driver.find_element_by_xpath("//*[@id='searchform']/button[2]").click() |
894 | temp_element = self.find_element_by_link_text_in_table(self.table_name, key) | 894 | temp_element = self.find_element_by_link_text_in_table(self.table_name, key) |
@@ -899,9 +899,9 @@ class toaster_cases(toaster_cases_base): | |||
899 | for item in ['order', 'task_name', 'executed', 'outcome', 'recipe_name', 'recipe_version']: | 899 | for item in ['order', 'task_name', 'executed', 'outcome', 'recipe_name', 'recipe_version']: |
900 | try: | 900 | try: |
901 | self.find_element_by_xpath_in_table(self.table_name, "./tbody/tr[1]/*[@class='" + item + "']/a").click() | 901 | self.find_element_by_xpath_in_table(self.table_name, "./tbody/tr[1]/*[@class='" + item + "']/a").click() |
902 | except NoSuchElementException, e: | 902 | except NoSuchElementException as e: |
903 | # let it go... | 903 | # let it go... |
904 | print 'no item in the colum' + item | 904 | print('no item in the colum' + item) |
905 | # insert screen shot here | 905 | # insert screen shot here |
906 | self.save_screenshot(screenshot_type='selenium', append_name='step11') | 906 | self.save_screenshot(screenshot_type='selenium', append_name='step11') |
907 | self.driver.back() | 907 | self.driver.back() |
@@ -992,13 +992,13 @@ class toaster_cases(toaster_cases_base): | |||
992 | self.table_name = 'otable' | 992 | self.table_name = 'otable' |
993 | # This is how we find the "default" rows-number! | 993 | # This is how we find the "default" rows-number! |
994 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) | 994 | rows_displayed = int(Select(self.driver.find_element_by_css_selector("select.pagesize")).first_selected_option.text) |
995 | print rows_displayed | 995 | print(rows_displayed) |
996 | self.assertTrue(self.get_table_element(self.table_name, rows_displayed)) | 996 | self.assertTrue(self.get_table_element(self.table_name, rows_displayed)) |
997 | self.assertFalse(self.get_table_element(self.table_name, rows_displayed + 1)) | 997 | self.assertFalse(self.get_table_element(self.table_name, rows_displayed + 1)) |
998 | 998 | ||
999 | # Check the default table is sorted by Recipe | 999 | # Check the default table is sorted by Recipe |
1000 | tasks_column_count = len(self.driver.find_elements_by_xpath("/html/body/div[2]/div/div[2]/div[2]/table/tbody/tr/td[1]")) | 1000 | tasks_column_count = len(self.driver.find_elements_by_xpath("/html/body/div[2]/div/div[2]/div[2]/table/tbody/tr/td[1]")) |
1001 | print tasks_column_count | 1001 | print(tasks_column_count) |
1002 | default_column_list = self.get_table_column_text_by_column_number(self.table_name, 1) | 1002 | default_column_list = self.get_table_column_text_by_column_number(self.table_name, 1) |
1003 | #print default_column_list | 1003 | #print default_column_list |
1004 | 1004 | ||
@@ -1095,7 +1095,7 @@ class toaster_cases(toaster_cases_base): | |||
1095 | 1095 | ||
1096 | # Bug 5919 | 1096 | # Bug 5919 |
1097 | for key in table_head_dict: | 1097 | for key in table_head_dict: |
1098 | print key | 1098 | print(key) |
1099 | self.find_element_by_link_text_in_table(self.table_name, key).click() | 1099 | self.find_element_by_link_text_in_table(self.table_name, key).click() |
1100 | self.driver.find_element_by_id("edit-columns-button").click() | 1100 | self.driver.find_element_by_id("edit-columns-button").click() |
1101 | self.driver.find_element_by_id(table_head_dict[key]).click() | 1101 | self.driver.find_element_by_id(table_head_dict[key]).click() |
@@ -1167,7 +1167,7 @@ class toaster_cases(toaster_cases_base): | |||
1167 | check_list = ['Dependencies', 'Layer branch', 'Layer commit', 'Reverse dependencies'] | 1167 | check_list = ['Dependencies', 'Layer branch', 'Layer commit', 'Reverse dependencies'] |
1168 | head_list = self.get_table_head_text('otable') | 1168 | head_list = self.get_table_head_text('otable') |
1169 | time.sleep(2) | 1169 | time.sleep(2) |
1170 | print head_list | 1170 | print(head_list) |
1171 | for item in check_list: | 1171 | for item in check_list: |
1172 | self.assertTrue(item in head_list, msg=("item %s not in head row" % item)) | 1172 | self.assertTrue(item in head_list, msg=("item %s not in head row" % item)) |
1173 | # un-check 'em all | 1173 | # un-check 'em all |
@@ -1226,8 +1226,8 @@ class toaster_cases(toaster_cases_base): | |||
1226 | 1226 | ||
1227 | tasks_row_count = len(driver.find_elements_by_xpath("//*[@id='"+self.table_name+"']/table/tbody/tr/td[1]")) | 1227 | tasks_row_count = len(driver.find_elements_by_xpath("//*[@id='"+self.table_name+"']/table/tbody/tr/td[1]")) |
1228 | tasks_column_count = len(driver.find_elements_by_xpath("//*[@id='"+self.table_name+"']/table/tbody/tr[1]/td")) | 1228 | tasks_column_count = len(driver.find_elements_by_xpath("//*[@id='"+self.table_name+"']/table/tbody/tr[1]/td")) |
1229 | print 'rows: '+str(tasks_row_count) | 1229 | print('rows: '+str(tasks_row_count)) |
1230 | print 'columns: '+str(tasks_column_count) | 1230 | print('columns: '+str(tasks_column_count)) |
1231 | 1231 | ||
1232 | Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2) | 1232 | Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2) |
1233 | print ("Tasks_column=", Tasks_column) | 1233 | print ("Tasks_column=", Tasks_column) |
@@ -1253,9 +1253,9 @@ class toaster_cases(toaster_cases_base): | |||
1253 | 1253 | ||
1254 | driver.find_element_by_partial_link_text("Packages (").click() | 1254 | driver.find_element_by_partial_link_text("Packages (").click() |
1255 | packages_name = driver.find_element_by_partial_link_text("Packages (").text | 1255 | packages_name = driver.find_element_by_partial_link_text("Packages (").text |
1256 | print packages_name | 1256 | print(packages_name) |
1257 | packages_num = int(filter(str.isdigit, repr(packages_name))) | 1257 | packages_num = int(filter(str.isdigit, repr(packages_name))) |
1258 | print packages_num | 1258 | print(packages_num) |
1259 | 1259 | ||
1260 | #switch the table to show more than 10 rows at a time | 1260 | #switch the table to show more than 10 rows at a time |
1261 | self.driver.find_element_by_xpath("//*[@id='packages-built']/div[1]/div/select").click() | 1261 | self.driver.find_element_by_xpath("//*[@id='packages-built']/div[1]/div/select").click() |
@@ -1263,7 +1263,7 @@ class toaster_cases(toaster_cases_base): | |||
1263 | self.driver.find_element_by_xpath("//*[@id='packages-built']/div[1]/div/select").send_keys(Keys.ENTER) | 1263 | self.driver.find_element_by_xpath("//*[@id='packages-built']/div[1]/div/select").send_keys(Keys.ENTER) |
1264 | 1264 | ||
1265 | packages_row_count = len(driver.find_elements_by_xpath("//*[@id='otable']/tbody/tr/td[1]")) | 1265 | packages_row_count = len(driver.find_elements_by_xpath("//*[@id='otable']/tbody/tr/td[1]")) |
1266 | print packages_row_count | 1266 | print(packages_row_count) |
1267 | 1267 | ||
1268 | if packages_num != packages_row_count: | 1268 | if packages_num != packages_row_count: |
1269 | print ("Error! The packages number is not correct") | 1269 | print ("Error! The packages number is not correct") |
@@ -1272,20 +1272,20 @@ class toaster_cases(toaster_cases_base): | |||
1272 | 1272 | ||
1273 | driver.find_element_by_partial_link_text("Build dependencies (").click() | 1273 | driver.find_element_by_partial_link_text("Build dependencies (").click() |
1274 | depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text | 1274 | depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text |
1275 | print depends_name | 1275 | print(depends_name) |
1276 | depends_num = int(filter(str.isdigit, repr(depends_name))) | 1276 | depends_num = int(list(filter(str.isdigit, repr(depends_name)))) |
1277 | print depends_num | 1277 | print(depends_num) |
1278 | 1278 | ||
1279 | if depends_num == 0: | 1279 | if depends_num == 0: |
1280 | depends_message = repr(driver.find_element_by_css_selector("div.alert.alert-info").text) | 1280 | depends_message = repr(driver.find_element_by_css_selector("div.alert.alert-info").text) |
1281 | print depends_message | 1281 | print(depends_message) |
1282 | if depends_message.find("has no build dependencies.") < 0: | 1282 | if depends_message.find("has no build dependencies.") < 0: |
1283 | print ("Error! The message isn't expected.") | 1283 | print ("Error! The message isn't expected.") |
1284 | else: | 1284 | else: |
1285 | print ("The message is expected") | 1285 | print ("The message is expected") |
1286 | else: | 1286 | else: |
1287 | depends_row_count = len(driver.find_elements_by_xpath("//*[@id='dependencies']/table/tbody/tr/td[1]")) | 1287 | depends_row_count = len(driver.find_elements_by_xpath("//*[@id='dependencies']/table/tbody/tr/td[1]")) |
1288 | print depends_row_count | 1288 | print(depends_row_count) |
1289 | if depends_num != depends_row_count: | 1289 | if depends_num != depends_row_count: |
1290 | print ("Error! The dependent packages number is not correct") | 1290 | print ("Error! The dependent packages number is not correct") |
1291 | else: | 1291 | else: |
@@ -1293,13 +1293,13 @@ class toaster_cases(toaster_cases_base): | |||
1293 | 1293 | ||
1294 | driver.find_element_by_partial_link_text("Reverse build dependencies (").click() | 1294 | driver.find_element_by_partial_link_text("Reverse build dependencies (").click() |
1295 | rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text | 1295 | rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text |
1296 | print rdepends_name | 1296 | print(rdepends_name) |
1297 | rdepends_num = int(filter(str.isdigit, repr(rdepends_name))) | 1297 | rdepends_num = int(filter(str.isdigit, repr(rdepends_name))) |
1298 | print rdepends_num | 1298 | print(rdepends_num) |
1299 | 1299 | ||
1300 | if rdepends_num == 0: | 1300 | if rdepends_num == 0: |
1301 | rdepends_message = repr(driver.find_element_by_css_selector("#brought-in-by > div.alert.alert-info").text) | 1301 | rdepends_message = repr(driver.find_element_by_css_selector("#brought-in-by > div.alert.alert-info").text) |
1302 | print rdepends_message | 1302 | print(rdepends_message) |
1303 | if rdepends_message.find("has no reverse build dependencies.") < 0: | 1303 | if rdepends_message.find("has no reverse build dependencies.") < 0: |
1304 | print ("Error! The message isn't expected.") | 1304 | print ("Error! The message isn't expected.") |
1305 | else: | 1305 | else: |
@@ -1319,8 +1319,8 @@ class toaster_cases(toaster_cases_base): | |||
1319 | 1319 | ||
1320 | native_tasks_row_count = len(driver.find_elements_by_xpath("//*[@id='information']/table/tbody/tr/td[1]")) | 1320 | native_tasks_row_count = len(driver.find_elements_by_xpath("//*[@id='information']/table/tbody/tr/td[1]")) |
1321 | native_tasks_column_count = len(driver.find_elements_by_xpath("//*[@id='information']/table/tbody/tr[1]/td")) | 1321 | native_tasks_column_count = len(driver.find_elements_by_xpath("//*[@id='information']/table/tbody/tr[1]/td")) |
1322 | print native_tasks_row_count | 1322 | print(native_tasks_row_count) |
1323 | print native_tasks_column_count | 1323 | print(native_tasks_column_count) |
1324 | 1324 | ||
1325 | Native_Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2) | 1325 | Native_Tasks_column = self.get_table_column_text_by_column_number(self.table_name, 2) |
1326 | print ("Native_Tasks_column=", Native_Tasks_column) | 1326 | print ("Native_Tasks_column=", Native_Tasks_column) |
@@ -1346,15 +1346,15 @@ class toaster_cases(toaster_cases_base): | |||
1346 | 1346 | ||
1347 | driver.find_element_by_partial_link_text("Packages (").click() | 1347 | driver.find_element_by_partial_link_text("Packages (").click() |
1348 | native_packages_name = driver.find_element_by_partial_link_text("Packages (").text | 1348 | native_packages_name = driver.find_element_by_partial_link_text("Packages (").text |
1349 | print native_packages_name | 1349 | print(native_packages_name) |
1350 | native_packages_num = int(filter(str.isdigit, repr(native_packages_name))) | 1350 | native_packages_num = int(filter(str.isdigit, repr(native_packages_name))) |
1351 | print native_packages_num | 1351 | print(native_packages_num) |
1352 | 1352 | ||
1353 | if native_packages_num != 0: | 1353 | if native_packages_num != 0: |
1354 | print ("Error! Native task shouldn't have any packages.") | 1354 | print ("Error! Native task shouldn't have any packages.") |
1355 | else: | 1355 | else: |
1356 | native_package_message = repr(driver.find_element_by_css_selector("#packages-built > div.alert.alert-info").text) | 1356 | native_package_message = repr(driver.find_element_by_css_selector("#packages-built > div.alert.alert-info").text) |
1357 | print native_package_message | 1357 | print(native_package_message) |
1358 | if native_package_message.find("does not build any packages.") < 0: | 1358 | if native_package_message.find("does not build any packages.") < 0: |
1359 | print ("Error! The message for native task isn't expected.") | 1359 | print ("Error! The message for native task isn't expected.") |
1360 | else: | 1360 | else: |
@@ -1362,12 +1362,12 @@ class toaster_cases(toaster_cases_base): | |||
1362 | 1362 | ||
1363 | driver.find_element_by_partial_link_text("Build dependencies (").click() | 1363 | driver.find_element_by_partial_link_text("Build dependencies (").click() |
1364 | native_depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text | 1364 | native_depends_name = driver.find_element_by_partial_link_text("Build dependencies (").text |
1365 | print native_depends_name | 1365 | print(native_depends_name) |
1366 | native_depends_num = int(filter(str.isdigit, repr(native_depends_name))) | 1366 | native_depends_num = int(filter(str.isdigit, repr(native_depends_name))) |
1367 | print native_depends_num | 1367 | print(native_depends_num) |
1368 | 1368 | ||
1369 | native_depends_row_count = len(driver.find_elements_by_xpath("//*[@id='dependencies']/table/tbody/tr/td[1]")) | 1369 | native_depends_row_count = len(driver.find_elements_by_xpath("//*[@id='dependencies']/table/tbody/tr/td[1]")) |
1370 | print native_depends_row_count | 1370 | print(native_depends_row_count) |
1371 | 1371 | ||
1372 | if native_depends_num != native_depends_row_count: | 1372 | if native_depends_num != native_depends_row_count: |
1373 | print ("Error! The dependent packages number is not correct") | 1373 | print ("Error! The dependent packages number is not correct") |
@@ -1376,12 +1376,12 @@ class toaster_cases(toaster_cases_base): | |||
1376 | 1376 | ||
1377 | driver.find_element_by_partial_link_text("Reverse build dependencies (").click() | 1377 | driver.find_element_by_partial_link_text("Reverse build dependencies (").click() |
1378 | native_rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text | 1378 | native_rdepends_name = driver.find_element_by_partial_link_text("Reverse build dependencies (").text |
1379 | print native_rdepends_name | 1379 | print(native_rdepends_name) |
1380 | native_rdepends_num = int(filter(str.isdigit, repr(native_rdepends_name))) | 1380 | native_rdepends_num = int(filter(str.isdigit, repr(native_rdepends_name))) |
1381 | print native_rdepends_num | 1381 | print(native_rdepends_num) |
1382 | 1382 | ||
1383 | native_rdepends_row_count = len(driver.find_elements_by_xpath("//*[@id='brought-in-by']/table/tbody/tr/td[1]")) | 1383 | native_rdepends_row_count = len(driver.find_elements_by_xpath("//*[@id='brought-in-by']/table/tbody/tr/td[1]")) |
1384 | print native_rdepends_row_count | 1384 | print(native_rdepends_row_count) |
1385 | 1385 | ||
1386 | if native_rdepends_num != native_rdepends_row_count: | 1386 | if native_rdepends_num != native_rdepends_row_count: |
1387 | print ("Error! The reverse dependent packages number is not correct") | 1387 | print ("Error! The reverse dependent packages number is not correct") |
@@ -1413,8 +1413,8 @@ class toaster_cases(toaster_cases_base): | |||
1413 | # step 5 | 1413 | # step 5 |
1414 | self.driver.find_element_by_css_selector("i.icon-remove").click() | 1414 | self.driver.find_element_by_css_selector("i.icon-remove").click() |
1415 | head_list = self.get_table_head_text('otable') | 1415 | head_list = self.get_table_head_text('otable') |
1416 | print head_list | 1416 | print(head_list) |
1417 | print len(head_list) | 1417 | print(len(head_list)) |
1418 | self.assertTrue(head_list == ['Variable', 'Value', 'Set in file', 'Description'], \ | 1418 | self.assertTrue(head_list == ['Variable', 'Value', 'Set in file', 'Description'], \ |
1419 | msg=("head row contents wrong")) | 1419 | msg=("head row contents wrong")) |
1420 | # step 8 | 1420 | # step 8 |
@@ -1830,7 +1830,7 @@ class toaster_cases(toaster_cases_base): | |||
1830 | try: | 1830 | try: |
1831 | self.driver.find_element_by_partial_link_text("Packages included") | 1831 | self.driver.find_element_by_partial_link_text("Packages included") |
1832 | self.driver.find_element_by_partial_link_text("Directory structure") | 1832 | self.driver.find_element_by_partial_link_text("Directory structure") |
1833 | except Exception,e: | 1833 | except Exception as e: |
1834 | self.log.error(e) | 1834 | self.log.error(e) |
1835 | self.assertFalse(True) | 1835 | self.assertFalse(True) |
1836 | # step 4 | 1836 | # step 4 |
@@ -2014,13 +2014,13 @@ class toaster_cases(toaster_cases_base): | |||
2014 | for i in range(0,4): | 2014 | for i in range(0,4): |
2015 | data[i] = data[i][0] | 2015 | data[i] = data[i][0] |
2016 | data.sort() | 2016 | data.sort() |
2017 | print data | 2017 | print(data) |
2018 | json_parse = json.loads(open('toasterconf.json').read()) | 2018 | json_parse = json.loads(open('toasterconf.json').read()) |
2019 | json_data = [] | 2019 | json_data = [] |
2020 | for i in range (0,4): | 2020 | for i in range (0,4): |
2021 | json_data.append(json_parse['releases'][i]['name']) | 2021 | json_data.append(json_parse['releases'][i]['name']) |
2022 | json_data.sort() | 2022 | json_data.sort() |
2023 | print json_data | 2023 | print(json_data) |
2024 | self.failUnless(data == json_data) | 2024 | self.failUnless(data == json_data) |
2025 | 2025 | ||
2026 | ############## | 2026 | ############## |
@@ -2036,11 +2036,11 @@ class toaster_cases(toaster_cases_base): | |||
2036 | data = cursor.fetchall() | 2036 | data = cursor.fetchall() |
2037 | for i in range(0,6): | 2037 | for i in range(0,6): |
2038 | data[i] = data[i][0] | 2038 | data[i] = data[i][0] |
2039 | print data | 2039 | print(data) |
2040 | json_parse = json.loads(open('toasterconf.json').read()) | 2040 | json_parse = json.loads(open('toasterconf.json').read()) |
2041 | json_data=json_parse['config'] | 2041 | json_data=json_parse['config'] |
2042 | json_data = json_data.values() | 2042 | json_data = json_data.values() |
2043 | print json_data | 2043 | print(json_data) |
2044 | self.failUnless(data == json_data) | 2044 | self.failUnless(data == json_data) |
2045 | 2045 | ||
2046 | 2046 | ||
@@ -2057,12 +2057,12 @@ class toaster_cases(toaster_cases_base): | |||
2057 | data = cursor.fetchall() | 2057 | data = cursor.fetchall() |
2058 | for i in range(0,3): | 2058 | for i in range(0,3): |
2059 | data[i] = data[i][0] | 2059 | data[i] = data[i][0] |
2060 | print data | 2060 | print(data) |
2061 | json_parse = json.loads(open('toasterconf.json').read()) | 2061 | json_parse = json.loads(open('toasterconf.json').read()) |
2062 | json_data = [] | 2062 | json_data = [] |
2063 | for i in range(0,3): | 2063 | for i in range(0,3): |
2064 | json_data.append(json_parse['layersources'][i]['name']) | 2064 | json_data.append(json_parse['layersources'][i]['name']) |
2065 | print json_data | 2065 | print(json_data) |
2066 | self.failUnless(set(data) == set(json_data)) | 2066 | self.failUnless(set(data) == set(json_data)) |
2067 | 2067 | ||
2068 | ############## | 2068 | ############## |
@@ -2077,10 +2077,10 @@ class toaster_cases(toaster_cases_base): | |||
2077 | cursor.execute(query) | 2077 | cursor.execute(query) |
2078 | data = cursor.fetchall() | 2078 | data = cursor.fetchall() |
2079 | data = data[0][0] | 2079 | data = data[0][0] |
2080 | print data | 2080 | print(data) |
2081 | json_parse = json.loads(open('toasterconf.json').read()) | 2081 | json_parse = json.loads(open('toasterconf.json').read()) |
2082 | json_data = json_parse['defaultrelease'] | 2082 | json_data = json_parse['defaultrelease'] |
2083 | print json_data | 2083 | print(json_data) |
2084 | self.failUnless(set(data) == set(json_data)) | 2084 | self.failUnless(set(data) == set(json_data)) |
2085 | 2085 | ||
2086 | ############## | 2086 | ############## |
@@ -2090,7 +2090,7 @@ class toaster_cases(toaster_cases_base): | |||
2090 | self.case_no = self.get_case_number() | 2090 | self.case_no = self.get_case_number() |
2091 | self.log.info(' CASE %s log: ' % str(self.case_no)) | 2091 | self.log.info(' CASE %s log: ' % str(self.case_no)) |
2092 | 2092 | ||
2093 | print 'Checking branches for "Local Yocto Project"' | 2093 | print('Checking branches for "Local Yocto Project"') |
2094 | con=sqlite.connect('toaster.sqlite') | 2094 | con=sqlite.connect('toaster.sqlite') |
2095 | cursor = con.cursor() | 2095 | cursor = con.cursor() |
2096 | query = "select name from orm_branch where layer_source_id=1;" | 2096 | query = "select name from orm_branch where layer_source_id=1;" |
@@ -2102,15 +2102,15 @@ class toaster_cases(toaster_cases_base): | |||
2102 | data[i] = data[i][0] | 2102 | data[i] = data[i][0] |
2103 | except: | 2103 | except: |
2104 | pass | 2104 | pass |
2105 | print data | 2105 | print(data) |
2106 | json_parse = json.loads(open('toasterconf.json').read()) | 2106 | json_parse = json.loads(open('toasterconf.json').read()) |
2107 | json_location = json_parse['layersources'][0]['name'] | 2107 | json_location = json_parse['layersources'][0]['name'] |
2108 | print json_location | 2108 | print(json_location) |
2109 | json_data = json_parse['layersources'][0]['branches'] | 2109 | json_data = json_parse['layersources'][0]['branches'] |
2110 | print json_data | 2110 | print(json_data) |
2111 | self.failUnless(set(data) == set(json_data)) | 2111 | self.failUnless(set(data) == set(json_data)) |
2112 | 2112 | ||
2113 | print 'Checking branches for "OpenEmbedded"' | 2113 | print('Checking branches for "OpenEmbedded"') |
2114 | con=sqlite.connect('toaster.sqlite') | 2114 | con=sqlite.connect('toaster.sqlite') |
2115 | cursor = con.cursor() | 2115 | cursor = con.cursor() |
2116 | query = "select name from orm_branch where layer_source_id=3;" | 2116 | query = "select name from orm_branch where layer_source_id=3;" |
@@ -2119,15 +2119,15 @@ class toaster_cases(toaster_cases_base): | |||
2119 | lenght = len(data) | 2119 | lenght = len(data) |
2120 | for i in range(0,lenght): | 2120 | for i in range(0,lenght): |
2121 | data[i] = data[i][0] | 2121 | data[i] = data[i][0] |
2122 | print data | 2122 | print(data) |
2123 | json_parse = json.loads(open('toasterconf.json').read()) | 2123 | json_parse = json.loads(open('toasterconf.json').read()) |
2124 | json_location = json_parse['layersources'][1]['name'] | 2124 | json_location = json_parse['layersources'][1]['name'] |
2125 | print json_location | 2125 | print(json_location) |
2126 | json_data = json_parse['layersources'][1]['branches'] | 2126 | json_data = json_parse['layersources'][1]['branches'] |
2127 | print json_data | 2127 | print(json_data) |
2128 | self.failUnless(set(data) == set(json_data)) | 2128 | self.failUnless(set(data) == set(json_data)) |
2129 | 2129 | ||
2130 | print 'Checking branches for "Imported layers"' | 2130 | print('Checking branches for "Imported layers"') |
2131 | con=sqlite.connect('toaster.sqlite') | 2131 | con=sqlite.connect('toaster.sqlite') |
2132 | cursor = con.cursor() | 2132 | cursor = con.cursor() |
2133 | query = "select name from orm_branch where layer_source_id=2;" | 2133 | query = "select name from orm_branch where layer_source_id=2;" |
@@ -2136,12 +2136,12 @@ class toaster_cases(toaster_cases_base): | |||
2136 | lenght = len(data) | 2136 | lenght = len(data) |
2137 | for i in range(0,lenght): | 2137 | for i in range(0,lenght): |
2138 | data[i] = data[i][0] | 2138 | data[i] = data[i][0] |
2139 | print data | 2139 | print(data) |
2140 | json_parse = json.loads(open('toasterconf.json').read()) | 2140 | json_parse = json.loads(open('toasterconf.json').read()) |
2141 | json_location = json_parse['layersources'][2]['name'] | 2141 | json_location = json_parse['layersources'][2]['name'] |
2142 | print json_location | 2142 | print(json_location) |
2143 | json_data = json_parse['layersources'][2]['branches'] | 2143 | json_data = json_parse['layersources'][2]['branches'] |
2144 | print json_data | 2144 | print(json_data) |
2145 | self.failUnless(set(data) == set(json_data)) | 2145 | self.failUnless(set(data) == set(json_data)) |
2146 | 2146 | ||
2147 | 2147 | ||
@@ -2158,12 +2158,12 @@ class toaster_cases(toaster_cases_base): | |||
2158 | data = cursor.fetchall() | 2158 | data = cursor.fetchall() |
2159 | for i in range(0,4): | 2159 | for i in range(0,4): |
2160 | data[i] = data[i][0] | 2160 | data[i] = data[i][0] |
2161 | print data | 2161 | print(data) |
2162 | json_parse = json.loads(open('toasterconf.json').read()) | 2162 | json_parse = json.loads(open('toasterconf.json').read()) |
2163 | json_data = [] | 2163 | json_data = [] |
2164 | for i in range(0,4): | 2164 | for i in range(0,4): |
2165 | json_data.append(json_parse['bitbake'][i]['name']) | 2165 | json_data.append(json_parse['bitbake'][i]['name']) |
2166 | print json_data | 2166 | print(json_data) |
2167 | self.failUnless(set(data) == set(json_data)) | 2167 | self.failUnless(set(data) == set(json_data)) |
2168 | 2168 | ||
2169 | ############## | 2169 | ############## |
@@ -2182,7 +2182,7 @@ class toaster_cases(toaster_cases_base): | |||
2182 | query = "select count(name) from orm_project where name = 'new-test-project';" | 2182 | query = "select count(name) from orm_project where name = 'new-test-project';" |
2183 | cursor.execute(query) | 2183 | cursor.execute(query) |
2184 | data = cursor.fetchone() | 2184 | data = cursor.fetchone() |
2185 | print 'data: %s' % data | 2185 | print('data: %s' % data) |
2186 | self.failUnless(data >= 1) | 2186 | self.failUnless(data >= 1) |
2187 | 2187 | ||
2188 | ############## | 2188 | ############## |
@@ -2275,7 +2275,7 @@ class toaster_cases(toaster_cases_base): | |||
2275 | data = data[0][0] | 2275 | data = data[0][0] |
2276 | except: | 2276 | except: |
2277 | pass | 2277 | pass |
2278 | print data | 2278 | print(data) |
2279 | self.failUnless(data == 'toaster_admin') | 2279 | self.failUnless(data == 'toaster_admin') |
2280 | 2280 | ||
2281 | ############## | 2281 | ############## |
@@ -2324,7 +2324,7 @@ class toaster_cases(toaster_cases_base): | |||
2324 | query = "select a.name, a.value from orm_projectvariable a, orm_project b where a.project_id = b.id and b.name = 'new-default-project';" | 2324 | query = "select a.name, a.value from orm_projectvariable a, orm_project b where a.project_id = b.id and b.name = 'new-default-project';" |
2325 | cursor.execute(query) | 2325 | cursor.execute(query) |
2326 | data = dict(cursor.fetchall()) | 2326 | data = dict(cursor.fetchall()) |
2327 | print data | 2327 | print(data) |
2328 | default_values = {u'IMAGE_INSTALL_append': u'', u'PACKAGE_CLASSES': u'package_rpm', u'MACHINE': u'qemux86', u'SDKMACHINE': u'x86_64', u'DISTRO': u'poky', u'IMAGE_FSTYPES': u'ext3 jffs2 tar.bz2'} | 2328 | default_values = {u'IMAGE_INSTALL_append': u'', u'PACKAGE_CLASSES': u'package_rpm', u'MACHINE': u'qemux86', u'SDKMACHINE': u'x86_64', u'DISTRO': u'poky', u'IMAGE_FSTYPES': u'ext3 jffs2 tar.bz2'} |
2329 | self.failUnless(data == default_values) | 2329 | self.failUnless(data == default_values) |
2330 | 2330 | ||
@@ -2341,7 +2341,7 @@ class toaster_cases(toaster_cases_base): | |||
2341 | query = "select layercommit_id from orm_projectlayer a, orm_project b where a.project_id=b.id and b.name='new-default-project';" | 2341 | query = "select layercommit_id from orm_projectlayer a, orm_project b where a.project_id=b.id and b.name='new-default-project';" |
2342 | cursor.execute(query) | 2342 | cursor.execute(query) |
2343 | data_initial = cursor.fetchall() | 2343 | data_initial = cursor.fetchall() |
2344 | print data_initial | 2344 | print(data_initial) |
2345 | 2345 | ||
2346 | self.driver.maximize_window() | 2346 | self.driver.maximize_window() |
2347 | self.driver.get('localhost:8000')#self.base_url) | 2347 | self.driver.get('localhost:8000')#self.base_url) |
@@ -2362,7 +2362,7 @@ class toaster_cases(toaster_cases_base): | |||
2362 | query = "select layercommit_id from orm_projectlayer a, orm_project b where a.project_id=b.id and b.name='new-default-project';" | 2362 | query = "select layercommit_id from orm_projectlayer a, orm_project b where a.project_id=b.id and b.name='new-default-project';" |
2363 | cursor.execute(query) | 2363 | cursor.execute(query) |
2364 | data_changed = cursor.fetchall() | 2364 | data_changed = cursor.fetchall() |
2365 | print data_changed | 2365 | print(data_changed) |
2366 | 2366 | ||
2367 | #resetting release to default | 2367 | #resetting release to default |
2368 | self.driver.find_element_by_id('release-change-toggle').click() | 2368 | self.driver.find_element_by_id('release-change-toggle').click() |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index bd5bf63341..b7c674a076 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -910,7 +910,7 @@ def _get_dir_entries(build_id, target_id, start): | |||
910 | response.append(entry) | 910 | response.append(entry) |
911 | 911 | ||
912 | except Exception as e: | 912 | except Exception as e: |
913 | print "Exception ", e | 913 | print("Exception ", e) |
914 | traceback.print_exc(e) | 914 | traceback.print_exc(e) |
915 | 915 | ||
916 | # sort by directories first, then by name | 916 | # sort by directories first, then by name |
diff --git a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py index ff93e549df..0bef8d4103 100644 --- a/bitbake/lib/toaster/toastermain/management/commands/builddelete.py +++ b/bitbake/lib/toaster/toastermain/management/commands/builddelete.py | |||
@@ -15,7 +15,7 @@ class Command(BaseCommand): | |||
15 | try: | 15 | try: |
16 | b = Build.objects.get(pk = bid) | 16 | b = Build.objects.get(pk = bid) |
17 | except ObjectDoesNotExist: | 17 | except ObjectDoesNotExist: |
18 | print 'build %s does not exist, skipping...' %(bid) | 18 | print('build %s does not exist, skipping...' %(bid)) |
19 | continue | 19 | continue |
20 | # theoretically, just b.delete() would suffice | 20 | # theoretically, just b.delete() would suffice |
21 | # however SQLite runs into problems when you try to | 21 | # however SQLite runs into problems when you try to |
diff --git a/bitbake/lib/toaster/toastermain/management/commands/buildslist.py b/bitbake/lib/toaster/toastermain/management/commands/buildslist.py index cad987fd93..8dfef0aa00 100644 --- a/bitbake/lib/toaster/toastermain/management/commands/buildslist.py +++ b/bitbake/lib/toaster/toastermain/management/commands/buildslist.py | |||
@@ -10,4 +10,4 @@ class Command(NoArgsCommand): | |||
10 | 10 | ||
11 | def handle_noargs(self,**options): | 11 | def handle_noargs(self,**options): |
12 | for b in Build.objects.all(): | 12 | for b in Build.objects.all(): |
13 | print "%d: %s %s %s" % (b.pk, b.machine, b.distro, ",".join([x.target for x in b.target_set.all()])) | 13 | print("%d: %s %s %s" % (b.pk, b.machine, b.distro, ",".join([x.target for x in b.target_set.all()]))) |
diff --git a/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py b/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py index 22b3eb79ed..911296f714 100644 --- a/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py +++ b/bitbake/lib/toaster/toastermain/management/commands/get-dburl.py | |||
@@ -6,4 +6,4 @@ class Command(NoArgsCommand): | |||
6 | help = "get database url" | 6 | help = "get database url" |
7 | 7 | ||
8 | def handle_noargs(self,**options): | 8 | def handle_noargs(self,**options): |
9 | print getDATABASE_URL() | 9 | print(getDATABASE_URL()) |
diff --git a/bitbake/lib/toaster/toastermain/management/commands/perf.py b/bitbake/lib/toaster/toastermain/management/commands/perf.py index 71a48e95d8..6b450bbdfc 100644 --- a/bitbake/lib/toaster/toastermain/management/commands/perf.py +++ b/bitbake/lib/toaster/toastermain/management/commands/perf.py | |||
@@ -25,7 +25,7 @@ class Command(BaseCommand): | |||
25 | info = self.url_info(full_url) | 25 | info = self.url_info(full_url) |
26 | status_code = info[0] | 26 | status_code = info[0] |
27 | load_time = info[1] | 27 | load_time = info[1] |
28 | print 'Trying \'' + full_url + '\', ' + str(status_code) + ', ' + str(load_time) | 28 | print('Trying \'' + full_url + '\', ' + str(status_code) + ', ' + str(load_time)) |
29 | 29 | ||
30 | def get_full_url(self, url_patt, url_root_res): | 30 | def get_full_url(self, url_patt, url_root_res): |
31 | full_url = str(url_patt).split('^')[1].replace('$>', '').replace('(?P<file_path>(?:/[', '/bin/busybox').replace('.*', '') | 31 | full_url = str(url_patt).split('^')[1].replace('$>', '').replace('(?P<file_path>(?:/[', '/bin/busybox').replace('.*', '') |
@@ -54,5 +54,5 @@ class Command(BaseCommand): | |||
54 | 54 | ||
55 | def error(self, *args): | 55 | def error(self, *args): |
56 | for arg in args: | 56 | for arg in args: |
57 | print >>sys.stderr, arg, | 57 | print(arg, end=' ', file=sys.stderr) |
58 | print >>sys.stderr | 58 | print(file=sys.stderr) |
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 74ab60462b..8662f393a9 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -138,7 +138,7 @@ else: | |||
138 | try: | 138 | try: |
139 | if pytz.timezone(zonename) is not None: | 139 | if pytz.timezone(zonename) is not None: |
140 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | 140 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename |
141 | except UnknownTimeZoneError, ValueError: | 141 | except UnknownTimeZoneError as ValueError: |
142 | # we expect timezone failures here, just move over | 142 | # we expect timezone failures here, just move over |
143 | pass | 143 | pass |
144 | except ImportError: | 144 | except ImportError: |