Skip to content

Commit 8a3be8e

Browse files
committed
Update unit tests to be compliant with auto fetch branch name feature
1 parent 5a4d4af commit 8a3be8e

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

tests/conftest.py

+3
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ def git_mock(mocker):
206206
p = mocker.patch("poetry.core.vcs.git.Git.rev_parse")
207207
p.return_value = "9cf87a285a2d3fbb0b9fa621997b3acc3631ed24"
208208

209+
p2 = mocker.patch("poetry.core.vcs.git.Git.get_current_branch", create=True)
210+
p2.return_value = "main"
211+
209212

210213
@pytest.fixture
211214
def http():

tests/console/commands/plugin/test_add.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ def test_add_with_git_constraint(app, repo, tester, env, installed):
7979
"""
8080

8181
assert_plugin_add_result(
82-
tester, app, env, expected, {"git": "https://github.com/demo/poetry-plugin.git"}
82+
tester,
83+
app,
84+
env,
85+
expected,
86+
{"git": "https://github.com/demo/poetry-plugin.git", "rev": "main"},
8387
)
8488

8589

@@ -110,6 +114,7 @@ def test_add_with_git_constraint_with_extras(app, repo, tester, env, installed):
110114
{
111115
"git": "https://github.com/demo/poetry-plugin.git",
112116
"extras": ["foo"],
117+
"rev": "main",
113118
},
114119
)
115120

tests/console/commands/test_add.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ def test_add_git_constraint(app, repo, tester, tmp_venv):
197197

198198
assert "demo" in content["dependencies"]
199199
assert content["dependencies"]["demo"] == {
200-
"git": "https://github.com/demo/demo.git"
200+
"git": "https://github.com/demo/demo.git",
201+
"rev": "main",
201202
}
202203

203204

@@ -258,6 +259,7 @@ def test_add_git_constraint_with_extras(app, repo, tester, tmp_venv):
258259
assert content["dependencies"]["demo"] == {
259260
"git": "https://github.com/demo/demo.git",
260261
"extras": ["foo", "bar"],
262+
"rev": "main",
261263
}
262264

263265

@@ -1040,7 +1042,8 @@ def test_add_git_constraint_old_installer(app, repo, installer, old_tester):
10401042

10411043
assert "demo" in content["dependencies"]
10421044
assert content["dependencies"]["demo"] == {
1043-
"git": "https://github.com/demo/demo.git"
1045+
"git": "https://github.com/demo/demo.git",
1046+
"rev": "main",
10441047
}
10451048

10461049

@@ -1099,6 +1102,7 @@ def test_add_git_constraint_with_extras_old_installer(app, repo, installer, old_
10991102
assert content["dependencies"]["demo"] == {
11001103
"git": "https://github.com/demo/demo.git",
11011104
"extras": ["foo", "bar"],
1105+
"rev": "main",
11021106
}
11031107

11041108

tests/console/commands/test_init.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def test_interactive_with_git_dependencies(tester, repo):
214214
215215
[tool.poetry.dependencies]
216216
python = "~2.7 || ^3.6"
217-
demo = {git = "https://github.com/demo/demo.git"}
217+
demo = {git = "https://github.com/demo/demo.git", rev = "main"}
218218
219219
[tool.poetry.group.dev.dependencies]
220220
pytest = "^3.6.0"
@@ -302,7 +302,7 @@ def test_interactive_with_git_dependencies_and_other_name(tester, repo):
302302
303303
[tool.poetry.dependencies]
304304
python = "~2.7 || ^3.6"
305-
demo = {git = "https://github.com/demo/pyproject-demo.git"}
305+
demo = {git = "https://github.com/demo/pyproject-demo.git", rev = "main"}
306306
307307
[tool.poetry.group.dev.dependencies]
308308
pytest = "^3.6.0"

0 commit comments

Comments
 (0)