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

tests: simplify test_remote_usage_prog #508

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
20 changes: 3 additions & 17 deletions testing/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,29 +258,15 @@ def test_mainargv(request):


def test_remote_usage_prog(testdir, request):
"""Check that pytest's argparser's prog gets monkeypatched."""
if not hasattr(request.config._parser, "prog"):
pytest.skip("prog not available in config parser")
testdir.makeconftest(
"""
import pytest

config_parser = None

@pytest.fixture
def get_config_parser():
return config_parser

def pytest_configure(config):
global config_parser
config_parser = config._parser
"""
)
testdir.makepyfile(
"""
import sys

def test(get_config_parser, request):
get_config_parser._getparser().error("my_usage_error")
def test(pytestconfig):
pytestconfig._parser._getparser().error("my_usage_error")
"""
)

Expand Down