Merge pull request #1158 from pre-commit/rm-master
remove master references from tests
diff --git a/tests/check_merge_conflict_test.py b/tests/check_merge_conflict_test.py
index 76c4283..64112d7 100644
--- a/tests/check_merge_conflict_test.py
+++ b/tests/check_merge_conflict_test.py
@@ -27,10 +27,10 @@
cmd_output('git', 'clone', str(repo1), str(repo2))
- # Commit in master
+ # Commit in mainline
with repo1.as_cwd():
repo1_f1.write('parent\n')
- git_commit('-am', 'master commit2')
+ git_commit('-am', 'mainline commit2')
# Commit in clone and pull
with repo2.as_cwd():
@@ -82,10 +82,10 @@
cmd_output('git', 'clone', str(repo1), str(repo2))
- # Commit in master
+ # Commit in mainline
with repo1.as_cwd():
repo1_f1.write('parent\n')
- git_commit('-am', 'master commit2')
+ git_commit('-am', 'mainline commit2')
# Commit in clone and pull without committing
with repo2.as_cwd():
@@ -112,7 +112,7 @@
@pytest.mark.parametrize(
- 'contents', (b'<<<<<<< HEAD\n', b'=======\n', b'>>>>>>> master\n'),
+ 'contents', (b'<<<<<<< HEAD\n', b'=======\n', b'>>>>>>> main\n'),
)
def test_merge_conflicts_failing(contents, repository_pending_merge):
repository_pending_merge.join('f2').write_binary(contents)
@@ -150,7 +150,7 @@
cmd_output('git', 'worktree', 'add', str(worktree))
with worktree.as_cwd():
cmd_output(
- 'git', 'pull', '--no-rebase', 'origin', 'master', retcode=None,
+ 'git', 'pull', '--no-rebase', 'origin', 'HEAD', retcode=None,
)
msg = f1_is_a_conflict_file.join('.git/worktrees/worktree/MERGE_MSG')
assert msg.exists()
diff --git a/tests/check_vcs_permalinks_test.py b/tests/check_vcs_permalinks_test.py
index 01ce94d..324b70c 100644
--- a/tests/check_vcs_permalinks_test.py
+++ b/tests/check_vcs_permalinks_test.py
@@ -16,9 +16,9 @@
# tags are ok
b'https://github.com/asottile/test/blob/1.0.0/foo%20bar#L1\n'
# links to files but not line numbers are ok
- b'https://github.com/asottile/test/blob/master/foo%20bar\n'
+ b'https://github.com/asottile/test/blob/main/foo%20bar\n'
# regression test for overly-greedy regex
- b'https://github.com/ yes / no ? /blob/master/foo#L1\n',
+ b'https://github.com/ yes / no ? /blob/main/foo#L1\n',
)
assert not main((str(f),))
@@ -26,17 +26,15 @@
def test_failing(tmpdir, capsys):
with tmpdir.as_cwd():
tmpdir.join('f.txt').write_binary(
- b'https://github.com/asottile/test/blob/master/foo#L1\n'
- b'https://example.com/asottile/test/blob/master/foo#L1\n'
+ b'https://github.com/asottile/test/blob/main/foo#L1\n'
b'https://example.com/asottile/test/blob/main/foo#L1\n',
)
assert main(('f.txt', '--additional-github-domain', 'example.com'))
out, _ = capsys.readouterr()
assert out == (
- 'f.txt:1:https://github.com/asottile/test/blob/master/foo#L1\n'
- 'f.txt:2:https://example.com/asottile/test/blob/master/foo#L1\n'
- 'f.txt:3:https://example.com/asottile/test/blob/main/foo#L1\n'
+ 'f.txt:1:https://github.com/asottile/test/blob/main/foo#L1\n'
+ 'f.txt:2:https://example.com/asottile/test/blob/main/foo#L1\n'
'\n'
'Non-permanent github link detected.\n'
'On any page on github press [y] to load a permalink.\n'
diff --git a/tests/no_commit_to_branch_test.py b/tests/no_commit_to_branch_test.py
index eaae5e6..7d37e49 100644
--- a/tests/no_commit_to_branch_test.py
+++ b/tests/no_commit_to_branch_test.py
@@ -11,13 +11,13 @@
def test_other_branch(temp_git_dir):
with temp_git_dir.as_cwd():
cmd_output('git', 'checkout', '-b', 'anotherbranch')
- assert is_on_branch({'master'}) is False
+ assert is_on_branch({'placeholder'}) is False
def test_multi_branch(temp_git_dir):
with temp_git_dir.as_cwd():
cmd_output('git', 'checkout', '-b', 'another/branch')
- assert is_on_branch({'master'}) is False
+ assert is_on_branch({'placeholder'}) is False
def test_multi_branch_fail(temp_git_dir):
@@ -26,9 +26,10 @@
assert is_on_branch({'another/branch'}) is True
-def test_master_branch(temp_git_dir):
+def test_exact_branch(temp_git_dir):
with temp_git_dir.as_cwd():
- assert is_on_branch({'master'}) is True
+ cmd_output('git', 'checkout', '-b', 'branchname')
+ assert is_on_branch({'branchname'}) is True
def test_main_branch_call(temp_git_dir):
@@ -50,11 +51,11 @@
assert is_on_branch(set(), {'another/.*'}) is True
-@pytest.mark.parametrize('branch_name', ('master', 'another/branch'))
+@pytest.mark.parametrize('branch_name', ('somebranch', 'another/branch'))
def test_branch_pattern_multiple_branches_fail(temp_git_dir, branch_name):
with temp_git_dir.as_cwd():
cmd_output('git', 'checkout', '-b', branch_name)
- assert main(('--branch', 'master', '--pattern', 'another/.*'))
+ assert main(('--branch', 'somebranch', '--pattern', 'another/.*'))
def test_main_default_call(temp_git_dir):