Skip to content

Commit

Permalink
TST: Try not to fail after rename
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Feb 1, 2024
1 parent 53e12c4 commit a03fb3e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion asv/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class NoRepository(Repo):
"""

dvcs = "none"
_default_branch = "main"
_default_branch = "master"

def __init__(self, url=None, path=None):
self.url = None
Expand Down
4 changes: 2 additions & 2 deletions asv/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,8 +1279,8 @@ def git_default_branch():
[which('git'), 'config', '--system', 'init.defaultBranch'],
display_error=False).strip()
except ProcessError:
# Default to main when global and system are not set
default_branch = 'main'
# Default to master when global and system are not set
default_branch = 'master'
return default_branch


Expand Down
20 changes: 10 additions & 10 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def two_branch_repo_case(request, tmpdir):
|
| o Revision 5 (stable)
| |
| o Merge main
| o Merge master
|/|
o | Revision 4
| |
Expand All @@ -166,30 +166,30 @@ def two_branch_repo_case(request, tmpdir):
dvcs_type = request.param
tmpdir = str(tmpdir)
if dvcs_type == "git":
main = f"{util.git_default_branch()}"
master = f"{util.git_default_branch()}"
elif dvcs_type == "hg":
main = "default"
master = "default"
dvcs = tools.generate_repo_from_ops(tmpdir, dvcs_type, [
("commit", 1),
("checkout", "stable", main),
("checkout", "stable", master),
("commit", 2),
("checkout", main),
("checkout", master),
("commit", 3),
("merge", "stable"),
("commit", 4),
("checkout", "stable"),
("merge", main, "Merge main"),
("merge", master, "Merge master"),
("commit", 5),
("checkout", main),
("checkout", master),
("commit", 6),
])

conf = config.Config()
conf.branches = [main, "stable"]
conf.branches = [master, "stable"]
conf.repo = dvcs.path
conf.project = join(tmpdir, "repo")
r = repo.get_repo(conf)
return dvcs, main, r, conf
return dvcs, master, r, conf


@pytest.fixture
Expand Down Expand Up @@ -354,7 +354,7 @@ def benchmarks_fixture(tmpdir):
d['env_dir'] = "env"
d['benchmark_dir'] = 'benchmark'
d['repo'] = tools.generate_test_repo(tmpdir, [0]).path
d['branches'] = ["main"]
d['branches'] = ["master"]
conf = config.Config.from_json(d)

repo = get_repo(conf)
Expand Down
10 changes: 5 additions & 5 deletions test/test_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def test_get_branch_commits(two_branch_repo_case):
],
"stable": [
"Revision 5",
"Merge main",
"Merge master",
"Revision 2",
"Revision 1",
],
Expand All @@ -230,18 +230,18 @@ def test_get_branch_commits(two_branch_repo_case):

@pytest.mark.parametrize("existing, expected", [
# No existing commit, we expect all commits in commit order,
# main branch first
# master branch first
([], ["Revision 6", "Revision 4", "Merge stable", "Revision 3",
"Revision 1", "Revision 5", "Merge main", "Revision 2"]),
"Revision 1", "Revision 5", "Merge master", "Revision 2"]),
# New commits on each branch
(["Revision 4", "Merge main"], ["Revision 6", "Revision 5"]),
(["Revision 4", "Merge master"], ["Revision 6", "Revision 5"]),
# No new commits
(["Revision 6", "Revision 5"], []),
# Missing all commits on one branch (case of new branch added in config)
(["Revision 6"], ["Revision 5", "Merge main", "Revision 2", "Revision 1"]),
(["Revision 6"], ["Revision 5", "Merge master", "Revision 2", "Revision 1"]),
], ids=["all", "new", "no-new", "new-branch-added-in-config"])
def test_get_new_branch_commits(two_branch_repo_case, existing, expected):
dvcs, main, r, conf = two_branch_repo_case
Expand Down
2 changes: 1 addition & 1 deletion test/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_run_publish(capfd, basic_conf):
filename = glob.glob(join(tmpdir, 'html', 'graphs', 'arch-x86_64',
'asv_dummy_test_package_1',
'asv_dummy_test_package_2-' + tools.DUMMY2_VERSIONS[1],
'branch-main',
'branch-master',
'cpu-Blazingly fast',
'env-SOME_TEST_VAR-1',
'machine-orangutan',
Expand Down

0 comments on commit a03fb3e

Please sign in to comment.