File pull-request-47.patch of Package python-hatch-requirements-txt
From b353fbefa4a4db95562193bd9a6556987b85ddb5 Mon Sep 17 00:00:00 2001
From: Maxwell G <maxwell@gtmx.me>
Date: Fri, 15 Dec 2023 20:20:52 +0000
Subject: [PATCH] tests: handle hatchling dependency spec formatting changes
Relates: https://github.com/pypa/hatch/commit/2741233fcc19177a7a045d67a39077d828e31fd6
Fixes: https://github.com/repo-helper/hatch-requirements-txt/issues/46
---
tests/test_metadata.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/test_metadata.py b/tests/test_metadata.py
index 3e52ce0..b7da135 100644
--- a/tests/test_metadata.py
+++ b/tests/test_metadata.py
@@ -6,7 +6,9 @@
import pytest
from coincidence.regressions import AdvancedDataRegressionFixture
from domdf_python_tools.paths import PathPlus, in_directory
+from hatchling.__about__ import __version__ as hatchling_version
from hatchling.build import build_sdist, build_wheel
+from packaging.version import Version
# this package
from hatch_requirements_txt import parse_requirements
@@ -249,11 +251,15 @@ def test_optional_dependencies(tmp_pathplus: PathPlus, build_func: Callable):
])
info = get_pkginfo(tmp_pathplus, build_func, pyproject_toml)
assert info.provides_extras == ["cli", "crypto", "fastjson"]
+ colorama_dependency = "colorama; (platform_system == 'Windows') and extra == 'cli'"
+ # https://github.com/pypa/hatch/commit/2741233fcc19177a7a045d67a39077d828e31fd6
+ if Version(hatchling_version) < Version("1.20"):
+ colorama_dependency = "colorama; platform_system == 'Windows' and extra == 'cli'"
assert info.requires_dist == [
"bar",
"baz>1",
"foo",
- "colorama; platform_system == 'Windows' and extra == 'cli'",
+ colorama_dependency,
"prompt-toolkit; extra == 'cli'",
"cryptography; extra == 'crypto'",
"pyjwt; extra == 'crypto'",