Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix integration test of PyPI error message #867

Merged
merged 1 commit into from
Feb 5, 2022
Merged
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
15 changes: 8 additions & 7 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import subprocess
import sys

import colorama
import jaraco.envs
import munch
import portend
Expand Down Expand Up @@ -64,7 +63,7 @@ def test_pypi_upload(sampleproject_dist):
cli.dispatch(command)


def test_pypi_error(sampleproject_dist, monkeypatch):
def test_pypi_error(sampleproject_dist, monkeypatch, capsys):
command = [
"twine",
"upload",
Expand All @@ -79,14 +78,16 @@ def test_pypi_error(sampleproject_dist, monkeypatch):
monkeypatch.setattr(sys, "argv", command)

message = (
re.escape(colorama.Fore.RED)
+ r"HTTPError: 403 Forbidden from https://test\.pypi\.org/legacy/\n"
+ r".+?authentication"
r"HTTPError: 403 Forbidden from https://test\.pypi\.org/legacy/"
+ r".+authentication information"
)

result = dunder_main.main()
error = dunder_main.main()
assert error

assert re.match(message, result)
captured = capsys.readouterr()

assert re.search(message, captured.out, re.DOTALL)


@pytest.fixture(
Expand Down