def test_solve_suite_names_file_is_not_changed_when_invalid_cli_opts(self): pabotsuitenames = self._psuitenames( datasource_hash, "97d170e1550eee4afc0af065b78cda302a97674c", "no-suites-from-option", file_hash, "--suite Fixtures.Suite Special", "--suite Fixtures.Suite Second", "--suite Fixtures.Suite One", ) with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) self._options["loglevel"] = "INVALID123" try: pabot.solve_suite_names( outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args, ) self.fail("Should have thrown DataError") except DataError: pass with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(pabotsuitenames, actual)
def test_solve_suite_names_leaves_suites_and_tests(self): all_suites = [s for s in self._all_suites if 'Suite With Valueset Tags' not in s] all_tests = [t for t in self._all_tests if 'Suite With Valueset Tags' in t] all_with_suites = [s for s in self._all_with_suites if 'Suite With Valueset Tags' not in s] all_with_tests = [t for t in self._all_with_tests if 'Suite With Valueset Tags' in t] all_with = all_with_suites + all_with_tests all_names = all_suites + all_tests pabotsuitenames = self._psuitenames( 'ab91eabfa9603fdcb718d17b5ea7069d4cc9d05a', '65f95c924ba97541f47949701c4e3c51192a5b43', 'no-suites-from-option', 'fe3cf7cfdcf616a9ea86c3d2eb2e274048ba5eed', *all_with) with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["testlevelsplit"] = False test_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([all_names], test_names) expected = self._psuitenames( 'ab91eabfa9603fdcb718d17b5ea7069d4cc9d05a', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '5fe181d28b45d1024e33748b3be8e7046fd8d5e7', *all_with) with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_with_corrupted_pabotsuitenames_file(self): pabotsuitenames_corrupted = self._psuitenames( 'd8ce00e244006f271e86b62cc14702b45caf6c8b', '98e9291c98411e6583248f87168b79afdf76d064', 'no-suites-from-optiosn', '4f2fc7af25040e0f3b9e2681b84594ccb0cdf9e', 'Fixtures.Suite&(Specia|)Chars', 'NoneExisting', 'Fixtures.Suite Second') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames_corrupted) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self.assertEqual([[ 'Fixtures.Suite&(Specia|)Chars', 'Fixtures.Suite Second', 'Fixtures.Suite One', ]], suite_names) expected = self._psuitenames( '7d48f683f47bbd7092a6bde4e1cbefaa79653d1c', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c65865c6eac504bddb6bd3f8ddeb18bd49b53c37', 'Fixtures.Suite&(Specia|)Chars', 'Fixtures.Suite Second', 'Fixtures.Suite One') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_leaves_suites_and_tests(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '65f95c924ba97541f47949701c4e3c51192a5b43', 'no-suites-from-option', 'd7dadae070e772c8075e2126b62fbf91545dd839', *(self._all_with_suites[:-1]+self._all_with_tests[-4:])) with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["testlevelsplit"] = False test_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([self._all_suites[:-1]+self._all_tests[-4:]], test_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'd057709bd430bda6e9489fddb76a7f2284ae7d84', *(self._all_with_suites[:-1]+self._all_with_tests[-4:])) with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_when_suitesfrom_file_added(self): pabotsuitenames = self._psuitenames( 'ab91eabfa9603fdcb718d17b5ea7069d4cc9d05a', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c06f2afdfa35791e82e71618bf60415e927c41ae', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite Special') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([['Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite Special']], suite_names) expected = self._psuitenames( 'ab91eabfa9603fdcb718d17b5ea7069d4cc9d05a', '97d170e1550eee4afc0af065b78cda302a97674c', 'f57c1949d5137773e0b9f6ca34c439a27a22bcb0', 'f1c13fd663ea3be9efe00b343f42aadd283afbe8', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Special') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names(self): suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self.assertEqual(['Fixtures.Suite One', 'Fixtures.Suite Second'], suite_names)
def test_solve_suite_names_with_corrupted_pabotsuitenames_file(self): pabotsuitenames_corrupted = self._psuitenames( 'd8ce00e244006f271e86b62cc14702b45caf6c8b', '98e9291c98411e6583248f87168b79afdf76d064', 'no-suites-from-optiosn', '4f2fc7af25040e0f3b9e2681b84594ccb0cdf9e', '--suite Fixtures.Suite&(Specia|)Chars', '--suite NoneExisting', '--suite Fixtures.Suite Second') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames_corrupted) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self.assertEqual([[ 'Fixtures.Suite&(Specia|)Chars', 'Fixtures.Suite Second', 'Fixtures.Suite One', ]], suite_names) expected = self._psuitenames( '38958c4ff3b75985be2e1a16e2e851742c44cea5', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '7a3a18da48c46e2eac7a1262882536816e248750', '--suite Fixtures.Suite&(Specia|)Chars', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_transforms_old_suite_names_to_new_format(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c65865c6eac504bddb6bd3f8ddeb18bd49b53c37', 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags' ]], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_pabotsuitenames_file_with_wait_command(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', '--suite Fixtures.Suite Special', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate pabot._regenerate = lambda *args: 1/0 try: suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) finally: pabot._regenerate = original self._assert_equal_names([ ['Fixtures.Suite Special'], ['Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags']], suite_names)
def test_solve_suite_names_works_when_suitesfrom_file_added_and_directory(self): pabotsuitenames = self._psuitenames( 'oldhashcode', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c06f2afdfa35791e82e71618bf60415e927c41ae', 'Fixtures.Suite One', 'Fixtures.Suite Second', 'Fixtures.Suite&(Specia|)Chars') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self.assertEqual([['Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite&(Specia|)Chars']], suite_names) expected = self._psuitenames( '7d48f683f47bbd7092a6bde4e1cbefaa79653d1c', '97d170e1550eee4afc0af065b78cda302a97674c', 'b8368a7a5e1574965abcbb975b7b3521b2b4496b', '3e26c7613d32d6e4774e0600946ff1c4880dc2e2', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite&(Specia|)Chars') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_pabotsuitenames_file_with_wait_command(self): pabotsuitenames = self._psuitenames( '7d48f683f47bbd7092a6bde4e1cbefaa79653d1c', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c65865c6eac504bddb6bd3f8ddeb18bd49b53c37', 'Fixtures.Suite&(Specia|)Chars', '#WAIT', 'Fixtures.Suite Second', 'Fixtures.Suite One') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate pabot._regenerate = lambda *args: 1/0 try: suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) finally: pabot._regenerate = original self.assertEqual([ ['Fixtures.Suite&(Specia|)Chars'], ['Fixtures.Suite Second', 'Fixtures.Suite One']], suite_names)
def test_solve_suite_names_works_when_suitesfrom_file_added_and_directory(self): pabotsuitenames = self._psuitenames( 'oldhashcode', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c06f2afdfa35791e82e71618bf60415e927c41ae', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([['Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite Special', 'Fixtures.Suite With Valueset Tags']], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'f57c1949d5137773e0b9f6ca34c439a27a22bcb0', '58a5f2a70e045d5a31ed0cc8515feeb6a3128a7f', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_with_corrupted_pabotsuitenames_file(self): pabotsuitenames_corrupted = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '4f2fc7af25040e0f3b9e2681b84594ccb0cdf9e', '--suite Fixtures.Suite Special', '--suite NoneExisting', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames_corrupted) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite With Valueset Tags', 'Fixtures.Suite One', ]], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite With Valueset Tags', '--suite Fixtures.Suite One') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_after_suitesfrom_file_removed(self): pabotsuitenames = self._psuitenames( '38958c4ff3b75985be2e1a16e2e851742c44cea5', '97d170e1550eee4afc0af065b78cda302a97674c', 'b8368a7a5e1574965abcbb975b7b3521b2b4496b', '50d0c83b3c6b35ddc81c3289f5591d6574412c17', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite&(Specia|)Chars') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" os.rename("tests/output.xml", "tests/output.xml.tmp") try: suite_names = pabot.solve_suite_names( outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) finally: os.rename("tests/output.xml.tmp", "tests/output.xml") self.assertEqual([[ 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite&(Specia|)Chars' ]], suite_names) expected = self._psuitenames( '38958c4ff3b75985be2e1a16e2e851742c44cea5', '97d170e1550eee4afc0af065b78cda302a97674c', 'da39a3ee5e6b4b0d3255bfef95601890afd80709', '976d4ba846fdbbe4ef8bc3c31560e0bf25266be1', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite&(Specia|)Chars') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_with_testlevelsplit_option_added(self): pabotsuitenames = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'd16c45532ef9a1b7ddfdc1498df20c66fa19d10f', *self._all_with_suites) with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["testlevelsplit"] = True test_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([self._all_tests], test_names) expected = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '65f95c924ba97541f47949701c4e3c51192a5b43', 'no-suites-from-option', '65a9d53314cba3caf6df9056585b2673c9f42e4b', *self._all_with_tests) with pabot._open_pabotsuitenames('r') as f: actual = f.readlines() if PY2: actual = [l.decode("utf-8") for l in actual] self.assertEqual(expected, actual)
def test_solve_suite_names_works_when_suitesfrom_file_added(self): pabotsuitenames = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c06f2afdfa35791e82e71618bf60415e927c41ae', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite Special') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite Special' ]], suite_names) expected = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'f57c1949d5137773e0b9f6ca34c439a27a22bcb0', '0b5af23446640dadae0fa4bd454046f488a9210a', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Special') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_when_suitesfrom_file_added_and_directory( self): pabotsuitenames = self._psuitenames( 'oldhashcode', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c06f2afdfa35791e82e71618bf60415e927c41ae', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite Special', 'Fixtures.Suite With Valueset Tags' ]], suite_names) expected = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'f57c1949d5137773e0b9f6ca34c439a27a22bcb0', '929737ee1b67639a7509ab38d221b273387f1e3f', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_when_suitesfrom_file_added_and_directory( self): pabotsuitenames = self._psuitenames( 'oldhashcode', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c06f2afdfa35791e82e71618bf60415e927c41ae', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite&(Specia|)Chars') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self.assertEqual([[ 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite&(Specia|)Chars' ]], suite_names) expected = self._psuitenames( '38958c4ff3b75985be2e1a16e2e851742c44cea5', '97d170e1550eee4afc0af065b78cda302a97674c', 'b8368a7a5e1574965abcbb975b7b3521b2b4496b', 'ee7527294997f640ef595eb3445045c39f2dc621', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite&(Specia|)Chars') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_transforms_old_suite_names_to_new_format(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c65865c6eac504bddb6bd3f8ddeb18bd49b53c37', 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags' ]], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_when_suitesfrom_file_added(self): pabotsuitenames = self._psuitenames( datasource_hash, '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c06f2afdfa35791e82e71618bf60415e927c41ae', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite Special') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite Special' ]], suite_names) expected = self._psuitenames( datasource_hash, '97d170e1550eee4afc0af065b78cda302a97674c', 'f57c1949d5137773e0b9f6ca34c439a27a22bcb0', 'a0998a6bbc82f98052f573873101dd9fb345b4df', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Special') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_pabotsuitenames_file_with_wait_command( self): pabotsuitenames = self._psuitenames( datasource_hash, '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', file_hash, '--suite Fixtures.Suite Special', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags', '--suite Fixtures.Test Copy Artifacts.Suite 1', '--suite Fixtures.Test Copy Artifacts.Suite 2') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate pabot._regenerate = lambda *args: 1 / 0 try: suite_names = pabot.solve_suite_names( outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) finally: pabot._regenerate = original self._assert_equal_names( [['Fixtures.Suite Special'], [ 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags', 'Fixtures.Test Copy Artifacts.Suite 1', 'Fixtures.Test Copy Artifacts.Suite 2' ]], suite_names)
def test_solve_suite_names_with_testlevelsplit_option_added(self): pabotsuitenames = self._psuitenames( 'ab91eabfa9603fdcb718d17b5ea7069d4cc9d05a', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'dfbbcc2e769bbaba4f27715359689d07bdff987f', *self._all_with_suites) with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["testlevelsplit"] = True test_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([self._all_tests], test_names) expected = self._psuitenames( 'ab91eabfa9603fdcb718d17b5ea7069d4cc9d05a', '65f95c924ba97541f47949701c4e3c51192a5b43', 'no-suites-from-option', '6125d7102d8e7fa4da754be3875716f43cd9dd5c', *self._all_with_tests ) with pabot._open_pabotsuitenames('r') as f: actual = f.readlines() if PY2: actual = [l.decode("utf-8") for l in actual] self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_pabotsuitenames_file_with_wait_command_when_cli_change( self): pabotsuitenames = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', 'old-command-line-options', 'no-suites-from-option', 'd16c45532ef9a1b7ddfdc1498df20c66fa19d10f', '--suite Fixtures.Suite Special', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names( [['Fixtures.Suite Special'], [ 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags' ]], suite_names) expected = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'd16c45532ef9a1b7ddfdc1498df20c66fa19d10f', '--suite Fixtures.Suite Special', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_suitesfrom_option(self): if os.path.isfile(".pabotsuitenames"): os.remove(".pabotsuitenames") pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names( outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args, ) self._assert_equal_names( [[ "Fixtures.Suite Second", "Fixtures.Suite One", "Fixtures.Suite Special" ]], suite_names, ) expected = self._psuitenames( datasource_hash, "97d170e1550eee4afc0af065b78cda302a97674c", "f57c1949d5137773e0b9f6ca34c439a27a22bcb0", "a0998a6bbc82f98052f573873101dd9fb345b4df", "--suite Fixtures.Suite Second", "--suite Fixtures.Suite One", "--suite Fixtures.Suite Special", ) with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_transforms_old_suite_names_to_new_format(self): pabotsuitenames = self._psuitenames( '38958c4ff3b75985be2e1a16e2e851742c44cea5', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c65865c6eac504bddb6bd3f8ddeb18bd49b53c37', 'Fixtures.Suite&(Specia|)Chars', 'Fixtures.Suite Second', 'Fixtures.Suite One') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self.assertEqual([[ 'Fixtures.Suite&(Specia|)Chars', 'Fixtures.Suite Second', 'Fixtures.Suite One', ]], suite_names) expected = self._psuitenames( '38958c4ff3b75985be2e1a16e2e851742c44cea5', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '7a3a18da48c46e2eac7a1262882536816e248750', '--suite Fixtures.Suite&(Specia|)Chars', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_directory_suite(self): pabotsuitenames = self._psuitenames( datasource_hash, "some-wrong-stuff", "no-suites-from-option", "this-is-wrong", "--suite Fixtures", ) with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) suite_names = pabot.solve_suite_names( outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args, ) self._assert_equal_names([["Fixtures"]], suite_names) expected = self._psuitenames( datasource_hash, "97d170e1550eee4afc0af065b78cda302a97674c", "no-suites-from-option", "92b04ad0ad478de47bab54833e707447290817c4", "--suite Fixtures", ) with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_with_corrupted_pabotsuitenames_file(self): pabotsuitenames_corrupted = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '4f2fc7af25040e0f3b9e2681b84594ccb0cdf9e', '--suite Fixtures.Suite Special', '--suite NoneExisting', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames_corrupted) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite With Valueset Tags', 'Fixtures.Suite One', ]], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite With Valueset Tags', '--suite Fixtures.Suite One') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_pabotsuitenames_file_with_wait_command(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', '--suite Fixtures.Suite Special', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate pabot._regenerate = lambda *args: 1/0 try: suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) finally: pabot._regenerate = original self._assert_equal_names([ ['Fixtures.Suite Special'], ['Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags']], suite_names)
def test_solve_suite_names_transforms_old_suite_names_to_new_format(self): pabotsuitenames = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c65865c6eac504bddb6bd3f8ddeb18bd49b53c37', 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags' ]], suite_names) expected = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'd16c45532ef9a1b7ddfdc1498df20c66fa19d10f', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_pabotsuitenames_file(self): pabotsuitenames = self._psuitenames( '38958c4ff3b75985be2e1a16e2e851742c44cea5', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '7a3a18da48c46e2eac7a1262882536816e248750', '--suite Fixtures.Suite&(Specia|)Chars', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate pabot._regenerate = lambda *args: 1 / 0 try: suite_names = pabot.solve_suite_names( outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) finally: pabot._regenerate = original self.assertEqual([[ 'Fixtures.Suite&(Specia|)Chars', 'Fixtures.Suite Second', 'Fixtures.Suite One', ]], suite_names)
def test_solve_suite_names_works_with_pabotsuitenames_file_with_wait_command( self): pabotsuitenames = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'd16c45532ef9a1b7ddfdc1498df20c66fa19d10f', '--suite Fixtures.Suite Special', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate pabot._regenerate = lambda *args: 1 / 0 try: suite_names = pabot.solve_suite_names( outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) finally: pabot._regenerate = original self._assert_equal_names( [['Fixtures.Suite Special'], [ 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags' ]], suite_names)
def test_solve_suite_names_with_testlevelsplit_option_added(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', *self._all_with_suites) with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["testlevelsplit"] = True test_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([self._all_tests], test_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '65f95c924ba97541f47949701c4e3c51192a5b43', 'no-suites-from-option', 'bd508554b025a8a2402849484c04bb169d7d4866', *self._all_with_tests ) with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_with_corrupted_pabotsuitenames_file(self): pabotsuitenames_corrupted = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '4f2fc7af25040e0f3b9e2681b84594ccb0cdf9e', '--suite Fixtures.Suite Special', '--suite NoneExisting', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames_corrupted) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite With Valueset Tags', 'Fixtures.Suite One', ]], suite_names) expected = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'd16c45532ef9a1b7ddfdc1498df20c66fa19d10f', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite With Valueset Tags', '--suite Fixtures.Suite One') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_pabotsuitenames_file(self): pabotsuitenames = self._psuitenames( 'ab91eabfa9603fdcb718d17b5ea7069d4cc9d05a', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'dfbbcc2e769bbaba4f27715359689d07bdff987f', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags', '--suite Fixtures.Test Copy Artifacts.Suite 1', '--suite Fixtures.Test Copy Artifacts.Suite 2' ) with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate pabot._regenerate = lambda *args: 1/0 try: suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) finally: pabot._regenerate = original self._assert_equal_names([[ 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags', 'Fixtures.Test Copy Artifacts.Suite 1', 'Fixtures.Test Copy Artifacts.Suite 2' ]], suite_names)
def test_solve_suite_names_transforms_old_suite_names_to_new_format(self): pabotsuitenames = self._psuitenames( datasource_hash, '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c65865c6eac504bddb6bd3f8ddeb18bd49b53c37', 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags', 'Fixtures.Test Copy Artifacts.Suite 1', 'Fixtures.Test Copy Artifacts.Suite 2') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([[ 'Fixtures.Suite Special', 'Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags', 'Fixtures.Test Copy Artifacts.Suite 1', 'Fixtures.Test Copy Artifacts.Suite 2' ]], suite_names) expected = self._psuitenames( datasource_hash, '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', file_hash, '--suite Fixtures.Suite Special', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags', '--suite Fixtures.Test Copy Artifacts.Suite 1', '--suite Fixtures.Test Copy Artifacts.Suite 2') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_when_suitesfrom_file_added(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', 'c06f2afdfa35791e82e71618bf60415e927c41ae', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite Special') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([['Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite Special']], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'f57c1949d5137773e0b9f6ca34c439a27a22bcb0', 'd100d667803ab7e9a3ce39aade2a9a2179bbab5d', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Special') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_pabotsuitenames_file_with_wait_command_when_cli_change( self): pabotsuitenames = self._psuitenames( '38958c4ff3b75985be2e1a16e2e851742c44cea5', 'old-command-line-options', 'no-suites-from-option', '7a3a18da48c46e2eac7a1262882536816e248750', '--suite Fixtures.Suite&(Specia|)Chars', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self.assertEqual([['Fixtures.Suite&(Specia|)Chars'], ['Fixtures.Suite Second', 'Fixtures.Suite One']], suite_names) expected = self._psuitenames( '38958c4ff3b75985be2e1a16e2e851742c44cea5', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '7a3a18da48c46e2eac7a1262882536816e248750', '--suite Fixtures.Suite&(Specia|)Chars', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_leaves_suites_and_tests(self): pabotsuitenames = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '65f95c924ba97541f47949701c4e3c51192a5b43', 'no-suites-from-option', 'aae0c8e2c3eca62fd7b26e03a6475e118a10ef70', *(self._all_with_suites[:-1] + self._all_with_tests[-4:])) with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["testlevelsplit"] = False test_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names( [self._all_suites[:-1] + self._all_tests[-4:]], test_names) expected = self._psuitenames( '195524bdb66da94d08decc859867c5fb0b6cf95b', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '1ac0e4ebf55ba472c813b5ac9f8d870dfbd97756', *(self._all_with_suites[:-1] + self._all_with_tests[-4:])) with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_with_ioerror_pabotsuitenames(self): if os.path.isfile(".pabotsuitenames"): os.remove(".pabotsuitenames") os.mkdir(".pabotsuitenames") try: suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([self._all_suites], suite_names) finally: os.rmdir(".pabotsuitenames")
def test_solve_suite_names_works_without_pabotsuitenames_file(self): if os.path.isfile(".pabotsuitenames"): os.remove(".pabotsuitenames") suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([self._all_suites], suite_names) self.assertTrue(os.path.isfile(".pabotsuitenames")) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', *self._all_with_suites) with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_with_testlevelsplit_option(self): if os.path.isfile(".pabotsuitenames"): os.remove(".pabotsuitenames") pabot_args = dict(self._pabot_args) pabot_args["testlevelsplit"] = True test_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([self._all_tests], test_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '65f95c924ba97541f47949701c4e3c51192a5b43', 'no-suites-from-option', 'bd508554b025a8a2402849484c04bb169d7d4866', *self._all_with_tests ) with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_file_is_not_changed_when_invalid_cli_opts(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) self._options["loglevel"] = "INVALID123" original = pabot._regenerate suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self.assertEqual([[]], suite_names) with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(pabotsuitenames, actual)
def test_solve_suite_names_works_after_suitesfrom_file_removed(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'f57c1949d5137773e0b9f6ca34c439a27a22bcb0', '50d0c83b3c6b35ddc81c3289f5591d6574412c17', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" os.rename("tests/output.xml", "tests/output.xml.tmp") try: suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) finally: os.rename("tests/output.xml.tmp", "tests/output.xml") self._assert_equal_names([['Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite Special', 'Fixtures.Suite With Valueset Tags']], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'da39a3ee5e6b4b0d3255bfef95601890afd80709', '92c46b3609886b9fa7df57b3f903aa6664d549f1', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Special', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_directory_suite(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', 'some-wrong-stuff', 'no-suites-from-option', 'this-is-wrong', '--suite Fixtures') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([['Fixtures']], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '842b411d6e8a04bdd497c97b92a6c577dca7879a', '--suite Fixtures') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_suitesfrom_option(self): if os.path.isfile(".pabotsuitenames"): os.remove(".pabotsuitenames") pabot_args = dict(self._pabot_args) pabot_args["suitesfrom"] = "tests/output.xml" suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=pabot_args) self._assert_equal_names([['Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite Special']], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'f57c1949d5137773e0b9f6ca34c439a27a22bcb0', 'd100d667803ab7e9a3ce39aade2a9a2179bbab5d', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite Special') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)
def test_solve_suite_names_works_with_pabotsuitenames_file_with_wait_command_when_cli_change(self): pabotsuitenames = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', 'old-command-line-options', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', '--suite Fixtures.Suite Special', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "w") as f: f.writelines(pabotsuitenames) original = pabot._regenerate suite_names = pabot.solve_suite_names(outs_dir=self._outs_dir, datasources=self._datasources, options=self._options, pabot_args=self._pabot_args) self._assert_equal_names([ ['Fixtures.Suite Special'], ['Fixtures.Suite Second', 'Fixtures.Suite One', 'Fixtures.Suite With Valueset Tags']], suite_names) expected = self._psuitenames( '4a1e9103a8b3239b18b63ebb8775b1ab2225f4b6', '97d170e1550eee4afc0af065b78cda302a97674c', 'no-suites-from-option', '075734d97edbd5237f241dfd3f18177d2c80b3be', '--suite Fixtures.Suite Special', '#WAIT', '--suite Fixtures.Suite Second', '--suite Fixtures.Suite One', '--suite Fixtures.Suite With Valueset Tags') with open(".pabotsuitenames", "r") as f: actual = f.readlines() self.assertEqual(expected, actual)