Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/poetry/console/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def validate_classifiers(
unrecognized = sorted(
project_classifiers - set(classifiers) - set(deprecated_classifiers)
)
# Allow "Private ::" classifiers as recommended on PyPI and the packaging guide
# to allow users to avoid accidentally publishing private packages to PyPI.
# https://pypi.org/classifiers/
unrecognized = [u for u in unrecognized if not u.startswith("Private ::")]
if unrecognized:
errors.append(f"Unrecognized classifiers: {unrecognized!r}.")

Expand Down
18 changes: 18 additions & 0 deletions tests/console/commands/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,21 @@ def test_check_invalid(mocker: MockerFixture, tester: CommandTester):
"""

assert tester.io.fetch_error() == expected


def test_check_private(mocker: MockerFixture, tester: CommandTester):
mocker.patch(
"poetry.factory.Factory.locate",
return_value=Path(__file__).parent.parent.parent
/ "fixtures"
/ "private_pyproject"
/ "pyproject.toml",
)

tester.execute()

expected = """\
All set!
"""

assert tester.io.fetch_output() == expected
17 changes: 17 additions & 0 deletions tests/fixtures/private_pyproject/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[tool.poetry]
name = "private"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]
readme = "README.md"
classifiers = [
"Private :: Do Not Upload",
]


[tool.poetry.dependencies]
python = "^3.7"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"