Skip to content

Commit 1257ed9

Browse files
committed
test: add test and pre-the-commit
1 parent 1296b3f commit 1257ed9

File tree

4 files changed

+102
-4
lines changed

4 files changed

+102
-4
lines changed

conda_forge_tick/update_recipe/version.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,15 @@ def _try_pypi_api(url_tmpl: str, context: MutableMapping, hash_type: str):
148148
if "version" not in context:
149149
return None, None
150150

151-
if not any(pypi_slug in url_tmpl for pypi_slug in ["/pypi.org", "/pypi.io", "/files.pythonhosted.org"]):
151+
if not any(
152+
pypi_slug in url_tmpl
153+
for pypi_slug in ["/pypi.org", "/pypi.io", "/files.pythonhosted.org"]
154+
):
152155
return None, None
153156

154157
r = requests.get(
155158
f"https://pypi.org/simple/{context['name']}/",
156-
headers={"Accept": "application/vnd.pypi.simple.v1+json"}
159+
headers={"Accept": "application/vnd.pypi.simple.v1+json"},
157160
)
158161
r.raise_for_status()
159162

@@ -171,7 +174,9 @@ def _try_pypi_api(url_tmpl: str, context: MutableMapping, hash_type: str):
171174
break
172175

173176
if finfo is None or ext is None:
174-
logger.debug("src dist for version %s not found in PyPI API", context["version"])
177+
logger.debug(
178+
"src dist for version %s not found in PyPI API", context["version"]
179+
)
175180
return None, None
176181

177182
bn, _ = os.path.split(url_tmpl)
@@ -193,7 +198,9 @@ def _try_pypi_api(url_tmpl: str, context: MutableMapping, hash_type: str):
193198
if name_tmpl is not None:
194199
new_url_tmpl = os.path.join(bn, name_tmpl + "-" + "{{ version }}" + ext)
195200
else:
196-
new_url_tmpl = os.path.join(bn, finfo["filename"].replace(context["version"], "{{ version }}"))
201+
new_url_tmpl = os.path.join(
202+
bn, finfo["filename"].replace(context["version"], "{{ version }}")
203+
)
197204

198205
logger.debug("new url template from PyPI API: %s", new_url_tmpl)
199206
url = _render_jinja2(new_url_tmpl, context)

tests/test_version_migrator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
("quart_trio", "0.11.1"),
6262
("reproc", "14.2.5"),
6363
("riskfolio_lib", "6.3.1"),
64+
("algotree", "0.7.3"),
6465
# these contain sources that depend on conda build config variants
6566
pytest.param(
6667
"polars_mixed_selectors",
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{% set name = "algotree" %}
2+
{% set version = "0.7.2" %}
3+
4+
package:
5+
name: {{ name|lower }}
6+
version: {{ version }}
7+
8+
source:
9+
url: https://pypi.org/packages/source/{{ name[0] }}/{{ name }}/algotree-{{ version }}.tar.gz
10+
sha256: 13bb4dc6583a58e1784adee20f4d803bd4105359f1c6f52151e496d23f07152a
11+
12+
build:
13+
entry_points:
14+
- jt=bin.jt:main
15+
noarch: python
16+
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
17+
number: 0
18+
19+
requirements:
20+
host:
21+
- python >=3.6
22+
- pip
23+
- setuptools
24+
run:
25+
- python >=3.6
26+
27+
test:
28+
imports:
29+
- AlgoTree
30+
commands:
31+
- pip check
32+
- jt --help
33+
requires:
34+
- pip
35+
36+
about:
37+
home: https://github.com/queelius/AlgoTree
38+
doc_url: https://queelius.github.io/AlgoTree/
39+
summary: A algorithmic tookit for working with trees in Python
40+
license: MIT
41+
license_file: LICENSE
42+
43+
extra:
44+
recipe-maintainers:
45+
- thewchan
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{% set name = "algotree" %}
2+
{% set version = "0.7.3" %}
3+
4+
package:
5+
name: {{ name|lower }}
6+
version: {{ version }}
7+
8+
source:
9+
url: https://pypi.org/packages/source/{{ name[0] }}/{{ name }}/AlgoTree-{{ version }}.tar.gz
10+
sha256: 349eee21a57c5f40f157be218788f944a723047b35b7945a56058219b383287d
11+
12+
build:
13+
entry_points:
14+
- jt=bin.jt:main
15+
noarch: python
16+
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
17+
number: 0
18+
19+
requirements:
20+
host:
21+
- python >=3.6
22+
- pip
23+
- setuptools
24+
run:
25+
- python >=3.6
26+
27+
test:
28+
imports:
29+
- AlgoTree
30+
commands:
31+
- pip check
32+
- jt --help
33+
requires:
34+
- pip
35+
36+
about:
37+
home: https://github.com/queelius/AlgoTree
38+
doc_url: https://queelius.github.io/AlgoTree/
39+
summary: A algorithmic tookit for working with trees in Python
40+
license: MIT
41+
license_file: LICENSE
42+
43+
extra:
44+
recipe-maintainers:
45+
- thewchan

0 commit comments

Comments
 (0)