10
10
class GitURLFixture (typing .NamedTuple ):
11
11
url : str
12
12
is_valid : bool
13
- git_location : GitURL
13
+ git_url : GitURL
14
14
15
15
16
16
TEST_FIXTURES : list [GitURLFixture ] = [
17
17
GitURLFixture (
18
18
url = "https://github.com/vcs-python/libvcs.git" ,
19
19
is_valid = True ,
20
- git_location = GitURL (
20
+ git_url = GitURL (
21
21
url = "https://github.com/vcs-python/libvcs.git" ,
22
22
scheme = "https" ,
23
23
hostname = "github.com" ,
@@ -27,7 +27,7 @@ class GitURLFixture(typing.NamedTuple):
27
27
GitURLFixture (
28
28
url = "https://github.com/vcs-python/libvcs" ,
29
29
is_valid = True ,
30
- git_location = GitURL (
30
+ git_url = GitURL (
31
31
url = "https://github.com/vcs-python/libvcs" ,
32
32
scheme = "https" ,
33
33
hostname = "github.com" ,
@@ -37,7 +37,7 @@ class GitURLFixture(typing.NamedTuple):
37
37
GitURLFixture (
38
38
url = "https://github.com:7999/vcs-python/libvcs" ,
39
39
is_valid = True ,
40
- git_location = GitURL (
40
+ git_url = GitURL (
41
41
url = "https://github.com:7999/vcs-python/libvcs" ,
42
42
scheme = "https" ,
43
43
hostname = "github.com" ,
@@ -52,7 +52,7 @@ class GitURLFixture(typing.NamedTuple):
52
52
GitURLFixture (
53
53
url = "git@github.com:liuxinyu95/AlgoXY.git" ,
54
54
is_valid = True ,
55
- git_location = GitURL (
55
+ git_url = GitURL (
56
56
url = "git@github.com:liuxinyu95/AlgoXY.git" ,
57
57
scheme = None ,
58
58
hostname = "github.com" ,
@@ -62,7 +62,7 @@ class GitURLFixture(typing.NamedTuple):
62
62
GitURLFixture (
63
63
url = "git@github.com:vcs-python/libvcs.git" ,
64
64
is_valid = True ,
65
- git_location = GitURL (
65
+ git_url = GitURL (
66
66
url = "git@github.com:vcs-python/libvcs.git" ,
67
67
scheme = "https" ,
68
68
hostname = "github.com" ,
@@ -73,20 +73,20 @@ class GitURLFixture(typing.NamedTuple):
73
73
74
74
75
75
@pytest .mark .parametrize (
76
- "url,is_valid,git_location " ,
76
+ "url,is_valid,git_url " ,
77
77
TEST_FIXTURES ,
78
78
)
79
- def test_git_location (
79
+ def test_git_url (
80
80
url : str ,
81
81
is_valid : bool ,
82
- git_location : GitURL ,
82
+ git_url : GitURL ,
83
83
git_repo : GitProject ,
84
84
):
85
85
url = url .format (local_repo = git_repo .dir )
86
- git_location .url = git_location .url .format (local_repo = git_repo .dir )
86
+ git_url .url = git_url .url .format (local_repo = git_repo .dir )
87
87
88
88
assert GitURL .is_valid (url ) == is_valid , f"{ url } compatibility should be { is_valid } "
89
- assert GitURL (url ) == git_location
89
+ assert GitURL (url ) == git_url
90
90
91
91
92
92
class GitURLKwargs (typing .TypedDict ):
@@ -96,7 +96,7 @@ class GitURLKwargs(typing.TypedDict):
96
96
class GitURLKwargsFixture (typing .NamedTuple ):
97
97
url : str
98
98
is_valid : bool
99
- git_location_kwargs : GitURLKwargs
99
+ git_url_kwargs : GitURLKwargs
100
100
101
101
102
102
#
@@ -110,75 +110,67 @@ class GitURLKwargsFixture(typing.NamedTuple):
110
110
GitURLKwargsFixture (
111
111
url = "git+https://github.com/liuxinyu95/AlgoXY.git" ,
112
112
is_valid = True ,
113
- git_location_kwargs = GitURLKwargs (
114
- url = "git+https://github.com/liuxinyu95/AlgoXY.git"
115
- ),
113
+ git_url_kwargs = GitURLKwargs (url = "git+https://github.com/liuxinyu95/AlgoXY.git" ),
116
114
),
117
115
GitURLKwargsFixture (
118
116
url = "git+ssh://git@github.com:tony/AlgoXY.git" ,
119
117
is_valid = True ,
120
- git_location_kwargs = GitURLKwargs (
121
- url = "git+ssh://git@github.com:tony/AlgoXY.git"
122
- ),
118
+ git_url_kwargs = GitURLKwargs (url = "git+ssh://git@github.com:tony/AlgoXY.git" ),
123
119
),
124
120
GitURLKwargsFixture (
125
121
url = "git+file://{local_repo}" ,
126
122
is_valid = True ,
127
- git_location_kwargs = GitURLKwargs (url = "git+file://{local_repo}" ),
123
+ git_url_kwargs = GitURLKwargs (url = "git+file://{local_repo}" ),
128
124
),
129
125
# Incompatible
130
126
GitURLKwargsFixture (
131
127
url = "git+ssh://git@github.com/tony/AlgoXY.git" ,
132
128
is_valid = True ,
133
- git_location_kwargs = GitURLKwargs (
134
- url = "git+ssh://git@github.com/tony/AlgoXY.git"
135
- ),
129
+ git_url_kwargs = GitURLKwargs (url = "git+ssh://git@github.com/tony/AlgoXY.git" ),
136
130
),
137
131
]
138
132
139
133
140
134
@pytest .mark .parametrize (
141
- "url,is_valid,git_location_kwargs " ,
135
+ "url,is_valid,git_url_kwargs " ,
142
136
PIP_TEST_FIXTURES ,
143
137
)
144
- def test_git_location_extension_pip (
138
+ def test_git_url_extension_pip (
145
139
url : str ,
146
140
is_valid : bool ,
147
- git_location_kwargs : GitURLKwargs ,
141
+ git_url_kwargs : GitURLKwargs ,
148
142
git_repo : GitProject ,
149
143
):
150
144
class GitURLWithPip (GitURL ):
151
145
matchers = MatcherRegistry = MatcherRegistry (
152
146
_matchers = {m .label : m for m in [* DEFAULT_MATCHERS , * PIP_DEFAULT_MATCHERS ]}
153
147
)
154
148
155
- git_location_kwargs ["url" ] = git_location_kwargs ["url" ].format (
156
- local_repo = git_repo .dir
157
- )
149
+ git_url_kwargs ["url" ] = git_url_kwargs ["url" ].format (local_repo = git_repo .dir )
158
150
url = url .format (local_repo = git_repo .dir )
159
- git_location = GitURLWithPip (** git_location_kwargs )
160
- git_location .url = git_location .url .format (local_repo = git_repo .dir )
151
+ git_url = GitURLWithPip (** git_url_kwargs )
152
+ git_url .url = git_url .url .format (local_repo = git_repo .dir )
161
153
162
154
assert (
163
155
GitURL .is_valid (url ) != is_valid
164
156
), f"{ url } compatibility should work with core, expects { not is_valid } "
165
157
assert (
166
158
GitURLWithPip .is_valid (url ) == is_valid
167
159
), f"{ url } compatibility should be { is_valid } "
168
- assert GitURLWithPip (url ) == git_location
160
+ assert GitURLWithPip (url ) == git_url
169
161
170
162
171
163
class ToURLFixture (typing .NamedTuple ):
172
- git_location : GitURL
164
+ git_url : GitURL
173
165
expected : str
174
166
175
167
176
168
@pytest .mark .parametrize (
177
- "git_location ,expected" ,
169
+ "git_url ,expected" ,
178
170
[
179
171
ToURLFixture (
180
172
expected = "https://github.com/vcs-python/libvcs.git" ,
181
- git_location = GitURL (
173
+ git_url = GitURL (
182
174
url = "https://github.com/vcs-python/libvcs.git" ,
183
175
scheme = "https" ,
184
176
hostname = "github.com" ,
@@ -187,7 +179,7 @@ class ToURLFixture(typing.NamedTuple):
187
179
),
188
180
ToURLFixture (
189
181
expected = "https://github.com/vcs-python/libvcs" ,
190
- git_location = GitURL (
182
+ git_url = GitURL (
191
183
url = "https://github.com/vcs-python/libvcs" ,
192
184
scheme = "https" ,
193
185
hostname = "github.com" ,
@@ -200,7 +192,7 @@ class ToURLFixture(typing.NamedTuple):
200
192
#
201
193
ToURLFixture (
202
194
expected = "git@github.com:liuxinyu95/AlgoXY.git" ,
203
- git_location = GitURL (
195
+ git_url = GitURL (
204
196
url = "git@github.com:liuxinyu95/AlgoXY.git" ,
205
197
scheme = None ,
206
198
hostname = "github.com" ,
@@ -209,7 +201,7 @@ class ToURLFixture(typing.NamedTuple):
209
201
),
210
202
ToURLFixture (
211
203
expected = "git@github.com:vcs-python/libvcs.git" ,
212
- git_location = GitURL (
204
+ git_url = GitURL (
213
205
url = "git@github.com:vcs-python/libvcs.git" ,
214
206
scheme = "https" ,
215
207
hostname = "github.com" ,
@@ -220,10 +212,10 @@ class ToURLFixture(typing.NamedTuple):
220
212
)
221
213
def test_git_to_url (
222
214
expected : str ,
223
- git_location : GitURL ,
215
+ git_url : GitURL ,
224
216
git_repo : GitProject ,
225
217
):
226
218
"""Test GitURL.to_url()"""
227
- git_location .url = git_location .url .format (local_repo = git_repo .dir )
219
+ git_url .url = git_url .url .format (local_repo = git_repo .dir )
228
220
229
- assert git_location .to_url () == expected
221
+ assert git_url .to_url () == expected
0 commit comments