11"""Tests for mercurial URL module."""
22
3- import pathlib
43import typing
54
65import pytest
76
8- from libvcs .pytest_plugin import CreateRepoPytestFixtureFn
97from libvcs .sync .hg import HgSync
108from libvcs .url .base import RuleMap
119from libvcs .url .hg import DEFAULT_RULES , PIP_DEFAULT_RULES , HgBaseURL , HgURL
@@ -19,16 +17,6 @@ class HgURLFixture(typing.NamedTuple):
1917 hg_url : HgURL
2018
2119
22- @pytest .fixture
23- def hg_repo (
24- set_home : pathlib .Path ,
25- hgconfig : pathlib .Path ,
26- create_hg_remote_repo : CreateRepoPytestFixtureFn ,
27- ) -> pathlib .Path :
28- """Create a remote hg repository."""
29- return create_hg_remote_repo ()
30-
31-
3220TEST_FIXTURES : list [HgURLFixture ] = [
3321 HgURLFixture (
3422 url = "https://bitbucket.com/vcs-python/libvcs" ,
@@ -64,8 +52,8 @@ def test_hg_url(
6452 hg_repo : HgSync ,
6553) -> None :
6654 """Test HgURL."""
67- url = url .format (local_repo = hg_repo )
68- hg_url .url = hg_url .url .format (local_repo = hg_repo )
55+ url = url .format (local_repo = hg_repo . path )
56+ hg_url .url = hg_url .url .format (local_repo = hg_repo . path )
6957
7058 assert HgURL .is_valid (url ) == is_valid , f"{ url } compatibility should be { is_valid } "
7159 assert HgURL (url ) == hg_url
@@ -133,10 +121,10 @@ class HgURLWithPip(HgURL):
133121 _rule_map = {m .label : m for m in [* DEFAULT_RULES , * PIP_DEFAULT_RULES ]},
134122 )
135123
136- hg_url_kwargs ["url" ] = hg_url_kwargs ["url" ].format (local_repo = hg_repo )
137- url = url .format (local_repo = hg_repo )
124+ hg_url_kwargs ["url" ] = hg_url_kwargs ["url" ].format (local_repo = hg_repo . path )
125+ url = url .format (local_repo = hg_repo . path )
138126 hg_url = HgURLWithPip (** hg_url_kwargs )
139- hg_url .url = hg_url .url .format (local_repo = hg_repo )
127+ hg_url .url = hg_url .url .format (local_repo = hg_repo . path )
140128
141129 assert (
142130 HgBaseURL .is_valid (url ) != is_valid
@@ -198,6 +186,6 @@ def test_hg_to_url(
198186 hg_repo : HgSync ,
199187) -> None :
200188 """Test HgURL.to_url()."""
201- hg_url .url = hg_url .url .format (local_repo = hg_repo )
189+ hg_url .url = hg_url .url .format (local_repo = hg_repo . path )
202190
203191 assert hg_url .to_url () == expected
0 commit comments