1
1
"""Tests for mercurial URL module."""
2
2
3
- import pathlib
4
3
import typing
5
4
6
5
import pytest
7
6
8
- from libvcs .pytest_plugin import CreateRepoPytestFixtureFn
9
7
from libvcs .sync .hg import HgSync
10
8
from libvcs .url .base import RuleMap
11
9
from libvcs .url .hg import DEFAULT_RULES , PIP_DEFAULT_RULES , HgBaseURL , HgURL
@@ -19,16 +17,6 @@ class HgURLFixture(typing.NamedTuple):
19
17
hg_url : HgURL
20
18
21
19
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
-
32
20
TEST_FIXTURES : list [HgURLFixture ] = [
33
21
HgURLFixture (
34
22
url = "https://bitbucket.com/vcs-python/libvcs" ,
@@ -64,8 +52,8 @@ def test_hg_url(
64
52
hg_repo : HgSync ,
65
53
) -> None :
66
54
"""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 (lo
8000
cal_repo = hg_repo . path )
69
57
70
58
assert HgURL .is_valid (url ) == is_valid , f"{ url } compatibility should be { is_valid } "
71
59
assert HgURL (url ) == hg_url
@@ -133,10 +121,10 @@ class HgURLWithPip(HgURL):
133
121
_rule_map = {m .label : m for m in [* DEFAULT_RULES , * PIP_DEFAULT_RULES ]},
134
122
)
135
123
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 )
138
126
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 )
140
128
141
129
assert (
142
130
HgBaseURL .is_valid (url ) != is_valid
@@ -198,6 +186,6 @@ def test_hg_to_url(
198
186
hg_repo : HgSync ,
199
187
) -> None :
200
188
"""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 )
202
190
203
191
assert hg_url .to_url () == expected
0 commit comments