diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-04-15 10:54:17 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-04-15 10:54:17 +0200 |
commit | 32604a6651813e25ee6d328c880ef95f76c9c744 (patch) | |
tree | c991070184b6d9c112ae1e173e9dc41b133ecff2 /tests | |
parent | 7ce827749cc0e41bf5783030ef660270c2e5932c (diff) | |
download | qutebrowser-32604a6651813e25ee6d328c880ef95f76c9c744.tar.gz qutebrowser-32604a6651813e25ee6d328c880ef95f76c9c744.zip |
tests: Fix test_version with git's init.defaultBranch
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/utils/test_version.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/unit/utils/test_version.py b/tests/unit/utils/test_version.py index 59f9052ca..b50352e34 100644 --- a/tests/unit/utils/test_version.py +++ b/tests/unit/utils/test_version.py @@ -484,8 +484,17 @@ class TestGitStrSubprocess: @needs_git def test_real_git(self, git_repo): """Test with a real git repository.""" + branch_name = subprocess.run( + ['git', 'config', 'init.defaultBranch'], + check=False, + stdout=subprocess.PIPE, + encoding='utf-8', + ).stdout.strip() + if not branch_name: + branch_name = 'master' + ret = version._git_str_subprocess(str(git_repo)) - assert ret == '6e4b65a on master (1970-01-01 01:00:00 +0100)' + assert ret == f'6e4b65a on {branch_name} (1970-01-01 01:00:00 +0100)' def test_missing_dir(self, tmp_path): """Test with a directory which doesn't exist.""" |