Skip to content

Commit 58c456a

Browse files
committed
update
1 parent 61aa299 commit 58c456a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

backend/src/hatchling/metadata/core.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ def classifiers(self) -> list[str]:
962962
message = 'Field `project.classifiers` must be an array'
963963
raise TypeError(message)
964964

965-
verify_classifiers = not os.environ.get("HATCH_NO_VERIFY_TROVE_CLASSIFIERS")
965+
verify_classifiers = not os.environ.get('HATCH_METADATA_CLASSIFIERS_NO_VERIFY')
966966
if verify_classifiers:
967967
import trove_classifiers
968968

@@ -979,7 +979,11 @@ def classifiers(self) -> list[str]:
979979
message = f'Classifier #{i} of field `project.classifiers` must be a string'
980980
raise TypeError(message)
981981

982-
if not self.__classifier_is_private(classifier) and verify_classifiers and classifier not in known_classifiers:
982+
if (
983+
not self.__classifier_is_private(classifier)
984+
and verify_classifiers
985+
and classifier not in known_classifiers
986+
):
983987
message = f'Unknown classifier in field `project.classifiers`: {classifier}'
984988
raise ValueError(message)
985989

tests/backend/metadata/test_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,14 +899,14 @@ def test_entry_not_string(self, isolation):
899899
_ = metadata.core.classifiers
900900

901901
def test_entry_unknown(self, isolation, monkeypatch):
902-
monkeypatch.delenv("HATCH_NO_VERIFY_TROVE_CLASSIFIERS", False)
902+
monkeypatch.delenv('HATCH_METADATA_CLASSIFIERS_NO_VERIFY', False)
903903
metadata = ProjectMetadata(str(isolation), None, {'project': {'classifiers': ['foo']}})
904904

905905
with pytest.raises(ValueError, match='Unknown classifier in field `project.classifiers`: foo'):
906906
_ = metadata.core.classifiers
907907

908908
def test_entry_unknown_no_verify(self, isolation, monkeypatch):
909-
monkeypatch.setenv("HATCH_NO_VERIFY_TROVE_CLASSIFIERS", "1")
909+
monkeypatch.setenv('HATCH_METADATA_CLASSIFIERS_NO_VERIFY', '1')
910910
classifiers = [
911911
'Programming Language :: Python :: 3.11',
912912
'Programming Language :: Python :: 3.11',

0 commit comments

Comments
 (0)