Files
python-github-backup/tests/conftest.py
Rodos ab0eebb175 Refactor test fixtures to use shared create_args helper
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.
2026-01-13 13:47:33 +11:00

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