Skip to content

Commit 8b661fa

Browse files
authored
Merge pull request #3730 from migueldiascosta/rename_github_tests
make sure that tests requiring a github token have 'github' in the test name so that they can be easily filtered
2 parents 643bc62 + 98fc72c commit 8b661fa

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

test/framework/github.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ def tearDown(self):
9595

9696
super(GithubTest, self).tearDown()
9797

98-
def test_pick_default_branch(self):
98+
def test_github_pick_default_branch(self):
9999
"""Test pick_default_branch function."""
100100

101101
self.assertEqual(pick_default_branch('easybuilders'), 'main')
102102
self.assertEqual(pick_default_branch('foobar'), 'master')
103103

104-
def test_walk(self):
104+
def test_github_walk(self):
105105
"""test the gitubfs walk function"""
106106
if self.skip_github_tests:
107107
print("Skipping test_walk, no GitHub token available?")
@@ -117,7 +117,7 @@ def test_walk(self):
117117
except IOError:
118118
pass
119119

120-
def test_read_api(self):
120+
def test_github_read_api(self):
121121
"""Test the githubfs read function"""
122122
if self.skip_github_tests:
123123
print("Skipping test_read_api, no GitHub token available?")
@@ -128,7 +128,7 @@ def test_read_api(self):
128128
except IOError:
129129
pass
130130

131-
def test_read(self):
131+
def test_github_read(self):
132132
"""Test the githubfs read function without using the api"""
133133
if self.skip_github_tests:
134134
print("Skipping test_read, no GitHub token available?")
@@ -141,7 +141,7 @@ def test_read(self):
141141
except (IOError, OSError):
142142
pass
143143

144-
def test_add_pr_labels(self):
144+
def test_github_add_pr_labels(self):
145145
"""Test add_pr_labels function."""
146146
if self.skip_github_tests:
147147
print("Skipping test_add_pr_labels, no GitHub token available?")
@@ -183,7 +183,7 @@ def test_add_pr_labels(self):
183183
self.mock_stderr(False)
184184
self.assertTrue("PR #8006 should be labelled 'update'" in stdout)
185185

186-
def test_fetch_pr_data(self):
186+
def test_github_fetch_pr_data(self):
187187
"""Test fetch_pr_data function."""
188188
if self.skip_github_tests:
189189
print("Skipping test_fetch_pr_data, no GitHub token available?")
@@ -205,7 +205,7 @@ def test_fetch_pr_data(self):
205205
self.assertEqual(pr_data['reviews'][0]['user']['login'], 'boegel')
206206
self.assertEqual(pr_data['status_last_commit'], None)
207207

208-
def test_list_prs(self):
208+
def test_github_list_prs(self):
209209
"""Test list_prs function."""
210210
if self.skip_github_tests:
211211
print("Skipping test_list_prs, no GitHub token available?")
@@ -227,7 +227,7 @@ def test_list_prs(self):
227227

228228
self.assertEqual(expected, output)
229229

230-
def test_reasons_for_closing(self):
230+
def test_github_reasons_for_closing(self):
231231
"""Test reasons_for_closing function."""
232232
if self.skip_github_tests:
233233
print("Skipping test_reasons_for_closing, no GitHub token available?")
@@ -267,7 +267,7 @@ def test_reasons_for_closing(self):
267267
for pattern in patterns:
268268
self.assertTrue(pattern in stdout, "Pattern '%s' found in: %s" % (pattern, stdout))
269269

270-
def test_close_pr(self):
270+
def test_github_close_pr(self):
271271
"""Test close_pr function."""
272272
if self.skip_github_tests:
273273
print("Skipping test_close_pr, no GitHub token available?")
@@ -312,7 +312,7 @@ def test_close_pr(self):
312312
for pattern in patterns:
313313
self.assertTrue(pattern in stdout, "Pattern '%s' found in: %s" % (pattern, stdout))
314314

315-
def test_fetch_easyblocks_from_pr(self):
315+
def test_github_fetch_easyblocks_from_pr(self):
316316
"""Test fetch_easyblocks_from_pr function."""
317317
if self.skip_github_tests:
318318
print("Skipping test_fetch_easyblocks_from_pr, no GitHub token available?")
@@ -339,7 +339,7 @@ def test_fetch_easyblocks_from_pr(self):
339339
except URLError as err:
340340
print("Ignoring URLError '%s' in test_fetch_easyblocks_from_pr" % err)
341341

342-
def test_fetch_easyconfigs_from_pr(self):
342+
def test_github_fetch_easyconfigs_from_pr(self):
343343
"""Test fetch_easyconfigs_from_pr function."""
344344
if self.skip_github_tests:
345345
print("Skipping test_fetch_easyconfigs_from_pr, no GitHub token available?")
@@ -390,7 +390,7 @@ def test_fetch_easyconfigs_from_pr(self):
390390
except URLError as err:
391391
print("Ignoring URLError '%s' in test_fetch_easyconfigs_from_pr" % err)
392392

393-
def test_fetch_files_from_pr_cache(self):
393+
def test_github_fetch_files_from_pr_cache(self):
394394
"""Test caching for fetch_files_from_pr."""
395395
if self.skip_github_tests:
396396
print("Skipping test_fetch_files_from_pr_cache, no GitHub token available?")
@@ -451,7 +451,7 @@ def test_fetch_files_from_pr_cache(self):
451451
res = gh.fetch_easyblocks_from_pr(12345, tmpdir)
452452
self.assertEqual(sorted(pr12345_files), sorted(res))
453453

454-
def test_fetch_latest_commit_sha(self):
454+
def test_github_fetch_latest_commit_sha(self):
455455
"""Test fetch_latest_commit_sha function."""
456456
if self.skip_github_tests:
457457
print("Skipping test_fetch_latest_commit_sha, no GitHub token available?")
@@ -463,7 +463,7 @@ def test_fetch_latest_commit_sha(self):
463463
branch='develop')
464464
self.assertTrue(re.match('^[0-9a-f]{40}$', sha))
465465

466-
def test_download_repo(self):
466+
def test_github_download_repo(self):
467467
"""Test download_repo function."""
468468
if self.skip_github_tests:
469469
print("Skipping test_download_repo, no GitHub token available?")
@@ -562,7 +562,7 @@ def test_validate_github_token(self):
562562
if token_old_format:
563563
self.assertTrue(gh.validate_github_token(token_old_format, GITHUB_TEST_ACCOUNT))
564564

565-
def test_find_easybuild_easyconfig(self):
565+
def test_github_find_easybuild_easyconfig(self):
566566
"""Test for find_easybuild_easyconfig function"""
567567
if self.skip_github_tests:
568568
print("Skipping test_find_easybuild_easyconfig, no GitHub token available?")
@@ -573,7 +573,7 @@ def test_find_easybuild_easyconfig(self):
573573
self.assertTrue(regex.search(path), "Pattern '%s' found in '%s'" % (regex.pattern, path))
574574
self.assertTrue(os.path.exists(path), "Path %s exists" % path)
575575

576-
def test_find_patches(self):
576+
def test_github_find_patches(self):
577577
""" Test for find_software_name_for_patch """
578578
test_dir = os.path.dirname(os.path.abspath(__file__))
579579
ec_path = os.path.join(test_dir, 'easyconfigs')
@@ -595,7 +595,7 @@ def test_find_patches(self):
595595
reg = re.compile(r'[1-9]+ of [1-9]+ easyconfigs checked')
596596
self.assertTrue(re.search(reg, txt))
597597

598-
def test_det_commit_status(self):
598+
def test_github_det_commit_status(self):
599599
"""Test det_commit_status function."""
600600

601601
if self.skip_github_tests:
@@ -642,7 +642,7 @@ def test_det_commit_status(self):
642642
res = gh.det_commit_status('easybuilders', GITHUB_REPO, commit_sha, GITHUB_TEST_ACCOUNT)
643643
self.assertEqual(res, None)
644644

645-
def test_check_pr_eligible_to_merge(self):
645+
def test_github_check_pr_eligible_to_merge(self):
646646
"""Test check_pr_eligible_to_merge function"""
647647
def run_check(expected_result=False):
648648
"""Helper function to check result of check_pr_eligible_to_merge"""
@@ -770,7 +770,7 @@ def run_check(expected_result=False):
770770
expected_warning = ''
771771
self.assertEqual(run_check(True), '')
772772

773-
def test_det_pr_labels(self):
773+
def test_github_det_pr_labels(self):
774774
"""Test for det_pr_labels function."""
775775

776776
file_info = {'new_folder': [False], 'new_file_in_existing_folder': [True]}
@@ -789,7 +789,7 @@ def test_det_pr_labels(self):
789789
res = gh.det_pr_labels(file_info, GITHUB_EASYBLOCKS_REPO)
790790
self.assertEqual(res, ['new'])
791791

792-
def test_det_patch_specs(self):
792+
def test_github_det_patch_specs(self):
793793
"""Test for det_patch_specs function."""
794794

795795
patch_paths = [os.path.join(self.test_prefix, p) for p in ['1.patch', '2.patch', '3.patch']]
@@ -841,7 +841,7 @@ def test_det_patch_specs(self):
841841
self.assertEqual(os.path.basename(res[2][0]), '3.patch')
842842
self.assertEqual(res[2][1], 'patched_ext')
843843

844-
def test_restclient(self):
844+
def test_github_restclient(self):
845845
"""Test use of RestClient."""
846846
if self.skip_github_tests:
847847
print("Skipping test_restclient, no GitHub token available?")
@@ -876,7 +876,7 @@ def test_restclient(self):
876876
httperror_hit = True
877877
self.assertTrue(httperror_hit, "expected HTTPError not encountered")
878878

879-
def test_create_delete_gist(self):
879+
def test_github_create_delete_gist(self):
880880
"""Test create_gist and delete_gist."""
881881
if self.skip_github_tests:
882882
print("Skipping test_restclient, no GitHub token available?")
@@ -888,7 +888,7 @@ def test_create_delete_gist(self):
888888
gist_id = gist_url.split('/')[-1]
889889
gh.delete_gist(gist_id, github_user=GITHUB_TEST_ACCOUNT, github_token=self.github_token)
890890

891-
def test_det_account_branch_for_pr(self):
891+
def test_github_det_account_branch_for_pr(self):
892892
"""Test det_account_branch_for_pr."""
893893
if self.skip_github_tests:
894894
print("Skipping test_det_account_branch_for_pr, no GitHub token available?")
@@ -918,7 +918,7 @@ def test_det_account_branch_for_pr(self):
918918
self.assertEqual(account, 'migueldiascosta')
919919
self.assertEqual(branch, 'fix_inject_checksums')
920920

921-
def test_det_pr_target_repo(self):
921+
def test_github_det_pr_target_repo(self):
922922
"""Test det_pr_target_repo."""
923923

924924
self.assertEqual(build_option('pr_target_repo'), None)
@@ -1005,7 +1005,7 @@ def test_push_branch_to_github(self):
10051005
regex = re.compile(pattern)
10061006
self.assertTrue(regex.match(stdout.strip()), "Pattern '%s' doesn't match: %s" % (regex.pattern, stdout))
10071007

1008-
def test_pr_test_report(self):
1008+
def test_github_pr_test_report(self):
10091009
"""Test for post_pr_test_report function."""
10101010
if self.skip_github_tests:
10111011
print("Skipping test_post_pr_test_report, no GitHub token available?")
@@ -1075,7 +1075,7 @@ def test_pr_test_report(self):
10751075
regex = re.compile(pattern, re.M)
10761076
self.assertTrue(regex.search(stdout), "Pattern '%s' should be found in: %s" % (regex.pattern, stdout))
10771077

1078-
def test_create_test_report(self):
1078+
def test_github_create_test_report(self):
10791079
"""Test create_test_report function."""
10801080
logfile = os.path.join(self.test_prefix, 'log.txt')
10811081
write_file(logfile, "Bazel failed with: error")

test/framework/options.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ def check_copied_files():
11961196
error_pattern = "One or more files to copy should be specified!"
11971197
self.assertErrorRegex(EasyBuildError, error_pattern, self.eb_main, args, raise_error=True)
11981198

1199-
def test_copy_ec_from_pr(self):
1199+
def test_github_copy_ec_from_pr(self):
12001200
"""Test combination of --copy-ec with --from-pr."""
12011201
if self.github_token is None:
12021202
print("Skipping test_copy_ec_from_pr, no GitHub token available?")
@@ -1684,7 +1684,7 @@ def test_dry_run_categorized(self):
16841684
if os.path.exists(dummylogfn):
16851685
os.remove(dummylogfn)
16861686

1687-
def test_from_pr(self):
1687+
def test_github_from_pr(self):
16881688
"""Test fetching easyconfigs from a PR."""
16891689
if self.github_token is None:
16901690
print("Skipping test_from_pr, no GitHub token available?")
@@ -1771,7 +1771,7 @@ def test_from_pr(self):
17711771
print("Ignoring URLError '%s' in test_from_pr" % err)
17721772
shutil.rmtree(tmpdir)
17731773

1774-
def test_from_pr_token_log(self):
1774+
def test_github_from_pr_token_log(self):
17751775
"""Check that --from-pr doesn't leak GitHub token in log."""
17761776
if self.github_token is None:
17771777
print("Skipping test_from_pr_token_log, no GitHub token available?")
@@ -1804,7 +1804,7 @@ def test_from_pr_token_log(self):
18041804
except URLError as err:
18051805
print("Ignoring URLError '%s' in test_from_pr" % err)
18061806

1807-
def test_from_pr_listed_ecs(self):
1807+
def test_github_from_pr_listed_ecs(self):
18081808
"""Test --from-pr in combination with specifying easyconfigs on the command line."""
18091809
if self.github_token is None:
18101810
print("Skipping test_from_pr, no GitHub token available?")
@@ -1859,7 +1859,7 @@ def test_from_pr_listed_ecs(self):
18591859
print("Ignoring URLError '%s' in test_from_pr" % err)
18601860
shutil.rmtree(tmpdir)
18611861

1862-
def test_from_pr_x(self):
1862+
def test_github_from_pr_x(self):
18631863
"""Test combination of --from-pr with --extended-dry-run."""
18641864
if self.github_token is None:
18651865
print("Skipping test_from_pr_x, no GitHub token available?")
@@ -3318,7 +3318,7 @@ def test_xxx_include_generic_easyblocks(self):
33183318

33193319
# must be run after test for --list-easyblocks, hence the '_xxx_'
33203320
# cleaning up the imported easyblocks is quite difficult...
3321-
def test_xxx_include_easyblocks_from_pr(self):
3321+
def test_github_xxx_include_easyblocks_from_pr(self):
33223322
"""Test --include-easyblocks-from-pr."""
33233323
if self.github_token is None:
33243324
print("Skipping test_preview_pr, no GitHub token available?")
@@ -3660,7 +3660,7 @@ def test_cleanup_tmpdir(self):
36603660
tweaked_dir = os.path.join(tmpdir, tmpdir_files[0], 'tweaked_easyconfigs')
36613661
self.assertTrue(os.path.exists(os.path.join(tweaked_dir, 'toy-1.0.eb')))
36623662

3663-
def test_preview_pr(self):
3663+
def test_github_preview_pr(self):
36643664
"""Test --preview-pr."""
36653665
if self.github_token is None:
36663666
print("Skipping test_preview_pr, no GitHub token available?")
@@ -3682,7 +3682,7 @@ def test_preview_pr(self):
36823682
regex = re.compile(r"^Comparing bzip2-1.0.6\S* with bzip2-1.0.6")
36833683
self.assertTrue(regex.search(txt), "Pattern '%s' not found in: %s" % (regex.pattern, txt))
36843684

3685-
def test_review_pr(self):
3685+
def test_github_review_pr(self):
36863686
"""Test --review-pr."""
36873687
if self.github_token is None:
36883688
print("Skipping test_review_pr, no GitHub token available?")
@@ -4004,7 +4004,7 @@ def test_new_branch_github(self):
40044004
]
40054005
self._assert_regexs(regexs, txt)
40064006

4007-
def test_new_pr_from_branch(self):
4007+
def test_github_new_pr_from_branch(self):
40084008
"""Test --new-pr-from-branch."""
40094009
if self.github_token is None:
40104010
print("Skipping test_new_pr_from_branch, no GitHub token available?")
@@ -4073,7 +4073,7 @@ def test_update_branch_github(self):
40734073
]
40744074
self._assert_regexs(regexs, txt)
40754075

4076-
def test_new_update_pr(self):
4076+
def test_github_new_update_pr(self):
40774077
"""Test use of --new-pr (dry run only)."""
40784078
if self.github_token is None:
40794079
print("Skipping test_new_update_pr, no GitHub token available?")
@@ -4283,7 +4283,7 @@ def test_new_update_pr(self):
42834283
]
42844284
self._assert_regexs(regexs, txt, assert_true=False)
42854285

4286-
def test_sync_pr_with_develop(self):
4286+
def test_github_sync_pr_with_develop(self):
42874287
"""Test use of --sync-pr-with-develop (dry run only)."""
42884288
if self.github_token is None:
42894289
print("Skipping test_sync_pr_with_develop, no GitHub token available?")
@@ -4313,7 +4313,7 @@ def test_sync_pr_with_develop(self):
43134313
regex = re.compile(pattern)
43144314
self.assertTrue(regex.match(txt), "Pattern '%s' doesn't match: %s" % (regex.pattern, txt))
43154315

4316-
def test_sync_branch_with_develop(self):
4316+
def test_github_sync_branch_with_develop(self):
43174317
"""Test use of --sync-branch-with-develop (dry run only)."""
43184318
if self.github_token is None:
43194319
print("Skipping test_sync_pr_with_develop, no GitHub token available?")
@@ -4343,7 +4343,7 @@ def test_sync_branch_with_develop(self):
43434343
regex = re.compile(pattern)
43444344
self.assertTrue(regex.match(stdout), "Pattern '%s' doesn't match: %s" % (regex.pattern, stdout))
43454345

4346-
def test_new_pr_python(self):
4346+
def test_github_new_pr_python(self):
43474347
"""Check generated PR title for --new-pr on easyconfig that includes Python dependency."""
43484348
if self.github_token is None:
43494349
print("Skipping test_new_pr_python, no GitHub token available?")
@@ -4388,7 +4388,7 @@ def test_new_pr_python(self):
43884388
regex = re.compile(r"^\* title: \"\{tools\}\[system/system\] toy v0.0 w/ Python 2.7.15 \+ 3.7.2\"$", re.M)
43894389
self.assertTrue(regex.search(txt), "Pattern '%s' found in: %s" % (regex.pattern, txt))
43904390

4391-
def test_new_pr_delete(self):
4391+
def test_github_new_pr_delete(self):
43924392
"""Test use of --new-pr to delete easyconfigs."""
43934393

43944394
if self.github_token is None:
@@ -4413,7 +4413,7 @@ def test_new_pr_delete(self):
44134413
]
44144414
self._assert_regexs(regexs, txt)
44154415

4416-
def test_new_pr_dependencies(self):
4416+
def test_github_new_pr_dependencies(self):
44174417
"""Test use of --new-pr with automatic dependency lookup."""
44184418

44194419
if self.github_token is None:
@@ -4461,7 +4461,7 @@ def test_new_pr_dependencies(self):
44614461

44624462
self._assert_regexs(regexs, txt)
44634463

4464-
def test_merge_pr(self):
4464+
def test_github_merge_pr(self):
44654465
"""
44664466
Test use of --merge-pr (dry run)"""
44674467
if self.github_token is None:
@@ -4566,7 +4566,7 @@ def test_merge_pr(self):
45664566
])
45674567
self.assertTrue(expected_stdout in stdout)
45684568

4569-
def test_empty_pr(self):
4569+
def test_github_empty_pr(self):
45704570
"""Test use of --new-pr (dry run only) with no changes"""
45714571
if self.github_token is None:
45724572
print("Skipping test_empty_pr, no GitHub token available?")

test/framework/robot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ def test_search_paths(self):
696696
regex = re.compile(r"^ \* %s$" % os.path.join(self.test_prefix, test_ec), re.M)
697697
self.assertTrue(regex.search(outtxt), "Found pattern %s in %s" % (regex.pattern, outtxt))
698698

699-
def test_det_easyconfig_paths_from_pr(self):
699+
def test_github_det_easyconfig_paths_from_pr(self):
700700
"""Test det_easyconfig_paths function, with --from-pr enabled as well."""
701701
if self.github_token is None:
702702
print("Skipping test_from_pr, no GitHub token available?")

0 commit comments

Comments
 (0)