Skip to content

Commit 5c514f8

Browse files
authored
Merge pull request #1158 from pre-commit/rm-master
remove master references from tests
2 parents 6db05e2 + 0a0af67 commit 5c514f8

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

tests/check_merge_conflict_test.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def f1_is_a_conflict_file(tmpdir):
2727

2828
cmd_output('git', 'clone', str(repo1), str(repo2))
2929

30-
# Commit in master
30+
# Commit in mainline
3131
with repo1.as_cwd():
3232
repo1_f1.write('parent\n')
33-
git_commit('-am', 'master commit2')
33+
git_commit('-am', 'mainline commit2')
3434

3535
# Commit in clone and pull
3636
with repo2.as_cwd():
@@ -82,10 +82,10 @@ def repository_pending_merge(tmpdir):
8282

8383
cmd_output('git', 'clone', str(repo1), str(repo2))
8484

85-
# Commit in master
85+
# Commit in mainline
8686
with repo1.as_cwd():
8787
repo1_f1.write('parent\n')
88-
git_commit('-am', 'master commit2')
88+
git_commit('-am', 'mainline commit2')
8989

9090
# Commit in clone and pull without committing
9191
with repo2.as_cwd():
@@ -112,7 +112,7 @@ def test_merge_conflicts_git(capsys):
112112

113113

114114
@pytest.mark.parametrize(
115-
'contents', (b'<<<<<<< HEAD\n', b'=======\n', b'>>>>>>> master\n'),
115+
'contents', (b'<<<<<<< HEAD\n', b'=======\n', b'>>>>>>> main\n'),
116116
)
117117
def test_merge_conflicts_failing(contents, repository_pending_merge):
118118
repository_pending_merge.join('f2').write_binary(contents)
@@ -150,7 +150,7 @@ def test_worktree_merge_conflicts(f1_is_a_conflict_file, tmpdir, capsys):
150150
cmd_output('git', 'worktree', 'add', str(worktree))
151151
with worktree.as_cwd():
152152
cmd_output(
153-
'git', 'pull', '--no-rebase', 'origin', 'master', retcode=None,
153+
'git', 'pull', '--no-rebase', 'origin', 'HEAD', retcode=None,
154154
)
155155
msg = f1_is_a_conflict_file.join('.git/worktrees/worktree/MERGE_MSG')
156156
assert msg.exists()

tests/check_vcs_permalinks_test.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,25 @@ def test_passing(tmpdir):
1616
# tags are ok
1717
b'https://github.com/asottile/test/blob/1.0.0/foo%20bar#L1\n'
1818
# links to files but not line numbers are ok
19-
b'https://github.com/asottile/test/blob/master/foo%20bar\n'
19+
b'https://github.com/asottile/test/blob/main/foo%20bar\n'
2020
# regression test for overly-greedy regex
21-
b'https://github.com/ yes / no ? /blob/master/foo#L1\n',
21+
b'https://github.com/ yes / no ? /blob/main/foo#L1\n',
2222
)
2323
assert not main((str(f),))
2424

2525

2626
def test_failing(tmpdir, capsys):
2727
with tmpdir.as_cwd():
2828
tmpdir.join('f.txt').write_binary(
29-
b'https://github.com/asottile/test/blob/master/foo#L1\n'
30-
b'https://example.com/asottile/test/blob/master/foo#L1\n'
29+
b'https://github.com/asottile/test/blob/main/foo#L1\n'
3130
b'https://example.com/asottile/test/blob/main/foo#L1\n',
3231
)
3332

3433
assert main(('f.txt', '--additional-github-domain', 'example.com'))
3534
out, _ = capsys.readouterr()
3635
assert out == (
37-
'f.txt:1:https://github.com/asottile/test/blob/master/foo#L1\n'
38-
'f.txt:2:https://example.com/asottile/test/blob/master/foo#L1\n'
39-
'f.txt:3:https://example.com/asottile/test/blob/main/foo#L1\n'
36+
'f.txt:1:https://github.com/asottile/test/blob/main/foo#L1\n'
37+
'f.txt:2:https://example.com/asottile/test/blob/main/foo#L1\n'
4038
'\n'
4139
'Non-permanent github link detected.\n'
4240
'On any page on github press [y] to load a permalink.\n'

tests/no_commit_to_branch_test.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
def test_other_branch(temp_git_dir):
1212
with temp_git_dir.as_cwd():
1313
cmd_output('git', 'checkout', '-b', 'anotherbranch')
14-
assert is_on_branch({'master'}) is False
14+
assert is_on_branch({'placeholder'}) is False
1515

1616

1717
def test_multi_branch(temp_git_dir):
1818
with temp_git_dir.as_cwd():
1919
cmd_output('git', 'checkout', '-b', 'another/branch')
20-
assert is_on_branch({'master'}) is False
20+
assert is_on_branch({'placeholder'}) is False
2121

2222

2323
def test_multi_branch_fail(temp_git_dir):
@@ -26,9 +26,10 @@ def test_multi_branch_fail(temp_git_dir):
2626
assert is_on_branch({'another/branch'}) is True
2727

2828

29-
def test_master_branch(temp_git_dir):
29+
def test_exact_branch(temp_git_dir):
3030
with temp_git_dir.as_cwd():
31-
assert is_on_branch({'master'}) is True
31+
cmd_output('git', 'checkout', '-b', 'branchname')
32+
assert is_on_branch({'branchname'}) is True
3233

3334

3435
def test_main_branch_call(temp_git_dir):
@@ -50,11 +51,11 @@ def test_branch_pattern_fail(temp_git_dir):
5051
assert is_on_branch(set(), {'another/.*'}) is True
5152

5253

53-
@pytest.mark.parametrize('branch_name', ('master', 'another/branch'))
54+
@pytest.mark.parametrize('branch_name', ('somebranch', 'another/branch'))
5455
def test_branch_pattern_multiple_branches_fail(temp_git_dir, branch_name):
5556
with temp_git_dir.as_cwd():
5657
cmd_output('git', 'checkout', '-b', branch_name)
57-
assert main(('--branch', 'master', '--pattern', 'another/.*'))
58+
assert main(('--branch', 'somebranch', '--pattern', 'another/.*'))
5859

5960

6061
def test_main_default_call(temp_git_dir):

0 commit comments

Comments
 (0)