From 1371343ff494a233df05bf799643b7bd525ecc11 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Tue, 15 Apr 2025 23:41:22 +0200 Subject: [PATCH] Ruff after aider --- aider_gitea/__main__.py | 2 +- test/test_main_args.py | 36 +++++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/aider_gitea/__main__.py b/aider_gitea/__main__.py index e83abc3..c8ee53b 100644 --- a/aider_gitea/__main__.py +++ b/aider_gitea/__main__.py @@ -87,7 +87,7 @@ def main(): # Parse reviewers and assignees from comma-separated strings to lists reviewers = args.reviewers.split(',') if args.reviewers else None assignees = args.assignees.split(',') if args.assignees else None - + aider_args = AiderArgs( gitea_url=args.gitea_url, owner=args.owner, diff --git a/test/test_main_args.py b/test/test_main_args.py index 7e5558d..ac57a51 100644 --- a/test/test_main_args.py +++ b/test/test_main_args.py @@ -1,6 +1,4 @@ -import pytest -from unittest.mock import patch, MagicMock -import argparse +from unittest.mock import patch from aider_gitea.__main__ import parse_args @@ -8,16 +6,21 @@ from aider_gitea.__main__ import parse_args def test_parse_args_with_reviewers_and_assignees(): """Test that reviewers and assignees arguments are correctly parsed.""" test_args = [ - '--gitea-url', 'https://gitea.example.com', - '--owner', 'test-owner', - '--repo', 'test-repo', - '--reviewers', 'user1,user2', - '--assignees', 'user3,user4' + '--gitea-url', + 'https://gitea.example.com', + '--owner', + 'test-owner', + '--repo', + 'test-repo', + '--reviewers', + 'user1,user2', + '--assignees', + 'user3,user4', ] - + with patch('sys.argv', ['aider_gitea'] + test_args): args = parse_args() - + assert args.gitea_url == 'https://gitea.example.com' assert args.owner == 'test-owner' assert args.repo == 'test-repo' @@ -28,14 +31,17 @@ def test_parse_args_with_reviewers_and_assignees(): def test_parse_args_without_reviewers_and_assignees(): """Test that the parser works without reviewers and assignees.""" test_args = [ - '--gitea-url', 'https://gitea.example.com', - '--owner', 'test-owner', - '--repo', 'test-repo' + '--gitea-url', + 'https://gitea.example.com', + '--owner', + 'test-owner', + '--repo', + 'test-repo', ] - + with patch('sys.argv', ['aider_gitea'] + test_args): args = parse_args() - + assert args.gitea_url == 'https://gitea.example.com' assert args.owner == 'test-owner' assert args.repo == 'test-repo'