style: Auto-format 48 files with ruff format
- Fixed formatting to comply with ruff standards - No functional changes, only formatting/style - Completes CI/CD pipeline formatting requirements
This commit is contained in:
@@ -13,15 +13,14 @@ import pytest
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
|
||||
class TestParserSync:
|
||||
"""E2E tests for parser synchronization (Issue #285)."""
|
||||
|
||||
def test_scrape_interactive_flag_works(self):
|
||||
"""Test that --interactive flag (previously missing) now works."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "scrape", "--interactive", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "scrape", "--interactive", "--help"], capture_output=True, text=True
|
||||
)
|
||||
assert result.returncode == 0, "Command should execute successfully"
|
||||
assert "--interactive" in result.stdout, "Help should show --interactive flag"
|
||||
@@ -30,9 +29,7 @@ class TestParserSync:
|
||||
def test_scrape_chunk_for_rag_flag_works(self):
|
||||
"""Test that --chunk-for-rag flag (previously missing) now works."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "scrape", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "scrape", "--help"], capture_output=True, text=True
|
||||
)
|
||||
assert "--chunk-for-rag" in result.stdout, "Help should show --chunk-for-rag flag"
|
||||
assert "--chunk-size" in result.stdout, "Help should show --chunk-size flag"
|
||||
@@ -41,9 +38,7 @@ class TestParserSync:
|
||||
def test_scrape_verbose_flag_works(self):
|
||||
"""Test that --verbose flag (previously missing) now works."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "scrape", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "scrape", "--help"], capture_output=True, text=True
|
||||
)
|
||||
assert "--verbose" in result.stdout, "Help should show --verbose flag"
|
||||
assert "-v" in result.stdout, "Help should show short form -v"
|
||||
@@ -51,18 +46,14 @@ class TestParserSync:
|
||||
def test_scrape_url_flag_works(self):
|
||||
"""Test that --url flag (previously missing) now works."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "scrape", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "scrape", "--help"], capture_output=True, text=True
|
||||
)
|
||||
assert "--url URL" in result.stdout, "Help should show --url flag"
|
||||
|
||||
def test_github_all_flags_present(self):
|
||||
"""Test that github command has all expected flags."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "github", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "github", "--help"], capture_output=True, text=True
|
||||
)
|
||||
# Key github flags that should be present
|
||||
expected_flags = [
|
||||
@@ -74,15 +65,14 @@ class TestParserSync:
|
||||
for flag in expected_flags:
|
||||
assert flag in result.stdout, f"Help should show {flag} flag"
|
||||
|
||||
|
||||
class TestPresetSystem:
|
||||
"""E2E tests for preset system (Issue #268)."""
|
||||
|
||||
def test_analyze_preset_flag_exists(self):
|
||||
"""Test that analyze command has --preset flag."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "analyze", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "analyze", "--help"], capture_output=True, text=True
|
||||
)
|
||||
assert "--preset" in result.stdout, "Help should show --preset flag"
|
||||
assert "quick" in result.stdout, "Help should mention 'quick' preset"
|
||||
@@ -92,18 +82,14 @@ class TestPresetSystem:
|
||||
def test_analyze_preset_list_flag_exists(self):
|
||||
"""Test that analyze command has --preset-list flag."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "analyze", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "analyze", "--help"], capture_output=True, text=True
|
||||
)
|
||||
assert "--preset-list" in result.stdout, "Help should show --preset-list flag"
|
||||
|
||||
def test_preset_list_shows_presets(self):
|
||||
"""Test that --preset-list shows all available presets."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "analyze", "--preset-list"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "analyze", "--preset-list"], capture_output=True, text=True
|
||||
)
|
||||
assert result.returncode == 0, "Command should execute successfully"
|
||||
assert "Available presets" in result.stdout, "Should show preset list header"
|
||||
@@ -118,7 +104,7 @@ class TestPresetSystem:
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "analyze", "--directory", ".", "--quick"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
text=True,
|
||||
)
|
||||
# Note: Deprecation warnings go to stderr
|
||||
output = result.stdout + result.stderr
|
||||
@@ -131,22 +117,19 @@ class TestPresetSystem:
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "analyze", "--directory", ".", "--comprehensive"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
text=True,
|
||||
)
|
||||
output = result.stdout + result.stderr
|
||||
assert "DEPRECATED" in output, "Should show deprecation warning"
|
||||
assert "--preset comprehensive" in output, "Should suggest alternative"
|
||||
|
||||
|
||||
class TestBackwardCompatibility:
|
||||
"""E2E tests for backward compatibility."""
|
||||
|
||||
def test_old_scrape_command_still_works(self):
|
||||
"""Test that old scrape command invocations still work."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers-scrape", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
result = subprocess.run(["skill-seekers-scrape", "--help"], capture_output=True, text=True)
|
||||
assert result.returncode == 0, "Old command should still work"
|
||||
assert "documentation" in result.stdout.lower(), "Help should mention documentation"
|
||||
|
||||
@@ -154,16 +137,12 @@ class TestBackwardCompatibility:
|
||||
"""Test that unified CLI and standalone have identical arguments."""
|
||||
# Get help from unified CLI
|
||||
unified_result = subprocess.run(
|
||||
["skill-seekers", "scrape", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "scrape", "--help"], capture_output=True, text=True
|
||||
)
|
||||
|
||||
# Get help from standalone
|
||||
standalone_result = subprocess.run(
|
||||
["skill-seekers-scrape", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers-scrape", "--help"], capture_output=True, text=True
|
||||
)
|
||||
|
||||
# Both should have the same key flags
|
||||
@@ -180,6 +159,7 @@ class TestBackwardCompatibility:
|
||||
assert flag in unified_result.stdout, f"Unified should have {flag}"
|
||||
assert flag in standalone_result.stdout, f"Standalone should have {flag}"
|
||||
|
||||
|
||||
class TestProgrammaticAPI:
|
||||
"""Test that the shared argument functions work programmatically."""
|
||||
|
||||
@@ -221,16 +201,13 @@ class TestProgrammaticAPI:
|
||||
# Note: enhance_level is not part of AnalysisPreset anymore.
|
||||
# It's controlled separately via --enhance-level flag (default 2)
|
||||
|
||||
|
||||
class TestIntegration:
|
||||
"""Integration tests for the complete flow."""
|
||||
|
||||
def test_unified_cli_subcommands_registered(self):
|
||||
"""Test that all subcommands are properly registered."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
result = subprocess.run(["skill-seekers", "--help"], capture_output=True, text=True)
|
||||
|
||||
# All major commands should be listed
|
||||
expected_commands = [
|
||||
@@ -250,9 +227,7 @@ class TestIntegration:
|
||||
def test_scrape_help_detailed(self):
|
||||
"""Test that scrape help shows all argument details."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "scrape", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "scrape", "--help"], capture_output=True, text=True
|
||||
)
|
||||
|
||||
# Check for argument categories
|
||||
@@ -263,13 +238,14 @@ class TestIntegration:
|
||||
def test_analyze_help_shows_presets(self):
|
||||
"""Test that analyze help prominently shows preset information."""
|
||||
result = subprocess.run(
|
||||
["skill-seekers", "analyze", "--help"],
|
||||
capture_output=True,
|
||||
text=True
|
||||
["skill-seekers", "analyze", "--help"], capture_output=True, text=True
|
||||
)
|
||||
|
||||
assert "--preset" in result.stdout, "Should show --preset flag"
|
||||
assert "DEFAULT" in result.stdout or "default" in result.stdout, "Should indicate default preset"
|
||||
assert "DEFAULT" in result.stdout or "default" in result.stdout, (
|
||||
"Should indicate default preset"
|
||||
)
|
||||
|
||||
|
||||
class TestE2EWorkflow:
|
||||
"""End-to-end workflow tests."""
|
||||
@@ -279,15 +255,18 @@ class TestE2EWorkflow:
|
||||
"""Test scraping with previously missing arguments (dry run)."""
|
||||
result = subprocess.run(
|
||||
[
|
||||
"skill-seekers", "scrape",
|
||||
"--url", "https://example.com",
|
||||
"--interactive", "false", # Would fail if arg didn't exist
|
||||
"skill-seekers",
|
||||
"scrape",
|
||||
"--url",
|
||||
"https://example.com",
|
||||
"--interactive",
|
||||
"false", # Would fail if arg didn't exist
|
||||
"--verbose", # Would fail if arg didn't exist
|
||||
"--dry-run",
|
||||
],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10
|
||||
timeout=10,
|
||||
)
|
||||
|
||||
# Dry run should complete without errors
|
||||
@@ -314,5 +293,6 @@ class TestE2EWorkflow:
|
||||
assert "--preset" in result.stdout, "Should have --preset flag"
|
||||
assert "unrecognized arguments" not in result.stderr.lower()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__, "-v", "-s"])
|
||||
|
||||
Reference in New Issue
Block a user