def test_not_on_a_branch(temp_git_dir): with temp_git_dir.as_cwd(): cmd_output('git', 'commit', '--no-gpg-sign', '--allow-empty', '-m1') head = cmd_output('git', 'rev-parse', 'HEAD').strip() cmd_output('git', 'checkout', head) # we're not on a branch! assert main(()) == 0
def test_main_default_call(temp_git_dir): with temp_git_dir.as_cwd(): cmd_output('git', 'checkout', '-b', 'anotherbranch') assert main() == 0
def test_main_branch_call(temp_git_dir): with temp_git_dir.as_cwd(): cmd_output('git', 'checkout', '-b', 'other') assert main(['--branch', 'other']) == 1
def test_main_default_call(temp_git_dir): with temp_git_dir.as_cwd(): cmd_output('git', 'checkout', '-b', 'anotherbranch') assert main(()) == 0
def test_forbid_multiple_branches(temp_git_dir, branch_name): with temp_git_dir.as_cwd(): cmd_output('git', 'checkout', '-b', branch_name) assert main(('--branch', 'b1', '--branch', 'b2'))
def test_main_branch_call(temp_git_dir): with temp_git_dir.as_cwd(): cmd_output('git', 'checkout', '-b', 'other') assert main(('--branch', 'other')) == 1
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/.*'))
def test_default_branch_names(temp_git_dir, branch_name): with temp_git_dir.as_cwd(): cmd_output('git', 'checkout', '-b', branch_name) assert main(()) == 1