mirror of
https://github.com/josegonzalez/python-github-backup.git
synced 2026-01-14 02:02:36 +01:00
Uses the real parse_args() function to get CLI defaults, so when new arguments are added they're automatically available to all tests. Changes: - Add tests/conftest.py with create_args fixture - Update 8 test files to use shared fixture - Remove duplicate _create_mock_args methods - Remove redundant @pytest.fixture mock_args definitions This eliminates the need to update multiple test files when adding new CLI arguments.
26 lines
731 B
Python
26 lines
731 B
Python
"""Shared pytest fixtures for github-backup tests."""
|
|
|
|
import pytest
|
|
|
|
from github_backup.github_backup import parse_args
|
|
|
|
|
|
@pytest.fixture
|
|
def create_args():
|
|
"""Factory fixture that creates args with real CLI defaults.
|
|
|
|
Uses the actual argument parser so new CLI args are automatically
|
|
available with their defaults - no test updates needed.
|
|
|
|
Usage:
|
|
def test_something(self, create_args):
|
|
args = create_args(include_releases=True, user="myuser")
|
|
"""
|
|
def _create(**overrides):
|
|
# Use real parser to get actual defaults
|
|
args = parse_args(["testuser"])
|
|
for key, value in overrides.items():
|
|
setattr(args, key, value)
|
|
return args
|
|
return _create
|