unrealon 1.0.8__py3-none-any.whl → 1.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unrealon/__init__.py +23 -21
- unrealon-1.1.0.dist-info/METADATA +164 -0
- unrealon-1.1.0.dist-info/RECORD +82 -0
- {unrealon-1.0.8.dist-info → unrealon-1.1.0.dist-info}/WHEEL +1 -1
- unrealon-1.1.0.dist-info/entry_points.txt +9 -0
- {unrealon-1.0.8.dist-info → unrealon-1.1.0.dist-info/licenses}/LICENSE +1 -1
- unrealon_bridge/__init__.py +114 -0
- unrealon_bridge/cli.py +316 -0
- unrealon_bridge/client/__init__.py +93 -0
- unrealon_bridge/client/base.py +78 -0
- unrealon_bridge/client/commands.py +89 -0
- unrealon_bridge/client/connection.py +90 -0
- unrealon_bridge/client/events.py +65 -0
- unrealon_bridge/client/health.py +38 -0
- unrealon_bridge/client/html_parser.py +146 -0
- unrealon_bridge/client/logging.py +139 -0
- unrealon_bridge/client/proxy.py +70 -0
- unrealon_bridge/client/scheduler.py +450 -0
- unrealon_bridge/client/session.py +70 -0
- unrealon_bridge/configs/__init__.py +14 -0
- unrealon_bridge/configs/bridge_config.py +212 -0
- unrealon_bridge/configs/bridge_config.yaml +39 -0
- unrealon_bridge/models/__init__.py +138 -0
- unrealon_bridge/models/base.py +28 -0
- unrealon_bridge/models/command.py +41 -0
- unrealon_bridge/models/events.py +40 -0
- unrealon_bridge/models/html_parser.py +79 -0
- unrealon_bridge/models/logging.py +55 -0
- unrealon_bridge/models/parser.py +63 -0
- unrealon_bridge/models/proxy.py +41 -0
- unrealon_bridge/models/requests.py +95 -0
- unrealon_bridge/models/responses.py +88 -0
- unrealon_bridge/models/scheduler.py +592 -0
- unrealon_bridge/models/session.py +28 -0
- unrealon_bridge/server/__init__.py +91 -0
- unrealon_bridge/server/base.py +171 -0
- unrealon_bridge/server/handlers/__init__.py +23 -0
- unrealon_bridge/server/handlers/command.py +110 -0
- unrealon_bridge/server/handlers/html_parser.py +139 -0
- unrealon_bridge/server/handlers/logging.py +95 -0
- unrealon_bridge/server/handlers/parser.py +95 -0
- unrealon_bridge/server/handlers/proxy.py +75 -0
- unrealon_bridge/server/handlers/scheduler.py +545 -0
- unrealon_bridge/server/handlers/session.py +66 -0
- unrealon_browser/__init__.py +61 -18
- unrealon_browser/{src/cli → cli}/browser_cli.py +6 -13
- unrealon_browser/{src/cli → cli}/cookies_cli.py +5 -1
- unrealon_browser/{src/core → core}/browser_manager.py +2 -2
- unrealon_browser/{src/managers → managers}/captcha.py +1 -1
- unrealon_browser/{src/managers → managers}/cookies.py +1 -1
- unrealon_browser/managers/logger_bridge.py +231 -0
- unrealon_browser/{src/managers → managers}/profile.py +1 -1
- unrealon_driver/__init__.py +73 -19
- unrealon_driver/browser/__init__.py +8 -0
- unrealon_driver/browser/config.py +74 -0
- unrealon_driver/browser/manager.py +416 -0
- unrealon_driver/exceptions.py +28 -0
- unrealon_driver/parser/__init__.py +55 -0
- unrealon_driver/parser/cli_manager.py +141 -0
- unrealon_driver/parser/daemon_manager.py +227 -0
- unrealon_driver/parser/managers/__init__.py +46 -0
- unrealon_driver/parser/managers/browser.py +51 -0
- unrealon_driver/parser/managers/config.py +281 -0
- unrealon_driver/parser/managers/error.py +412 -0
- unrealon_driver/parser/managers/html.py +732 -0
- unrealon_driver/parser/managers/logging.py +609 -0
- unrealon_driver/parser/managers/result.py +321 -0
- unrealon_driver/parser/parser_manager.py +628 -0
- unrealon/sdk_config.py +0 -88
- unrealon-1.0.8.dist-info/METADATA +0 -803
- unrealon-1.0.8.dist-info/RECORD +0 -246
- unrealon_browser/pyproject.toml +0 -182
- unrealon_browser/src/__init__.py +0 -62
- unrealon_browser/src/managers/logger_bridge.py +0 -395
- unrealon_driver/README.md +0 -204
- unrealon_driver/pyproject.toml +0 -187
- unrealon_driver/src/__init__.py +0 -90
- unrealon_driver/src/cli/__init__.py +0 -10
- unrealon_driver/src/cli/main.py +0 -66
- unrealon_driver/src/cli/simple.py +0 -510
- unrealon_driver/src/config/__init__.py +0 -11
- unrealon_driver/src/config/auto_config.py +0 -478
- unrealon_driver/src/core/__init__.py +0 -18
- unrealon_driver/src/core/exceptions.py +0 -289
- unrealon_driver/src/core/parser.py +0 -638
- unrealon_driver/src/dto/__init__.py +0 -66
- unrealon_driver/src/dto/cli.py +0 -119
- unrealon_driver/src/dto/config.py +0 -18
- unrealon_driver/src/dto/events.py +0 -237
- unrealon_driver/src/dto/execution.py +0 -313
- unrealon_driver/src/dto/services.py +0 -311
- unrealon_driver/src/execution/__init__.py +0 -23
- unrealon_driver/src/execution/daemon_mode.py +0 -317
- unrealon_driver/src/execution/interactive_mode.py +0 -88
- unrealon_driver/src/execution/modes.py +0 -45
- unrealon_driver/src/execution/scheduled_mode.py +0 -209
- unrealon_driver/src/execution/test_mode.py +0 -250
- unrealon_driver/src/logging/__init__.py +0 -24
- unrealon_driver/src/logging/driver_logger.py +0 -512
- unrealon_driver/src/services/__init__.py +0 -24
- unrealon_driver/src/services/browser_service.py +0 -726
- unrealon_driver/src/services/llm/__init__.py +0 -15
- unrealon_driver/src/services/llm/browser_llm_service.py +0 -363
- unrealon_driver/src/services/llm/llm.py +0 -195
- unrealon_driver/src/services/logger_service.py +0 -232
- unrealon_driver/src/services/metrics_service.py +0 -185
- unrealon_driver/src/services/scheduler_service.py +0 -489
- unrealon_driver/src/services/websocket_service.py +0 -362
- unrealon_driver/src/utils/__init__.py +0 -16
- unrealon_driver/src/utils/service_factory.py +0 -317
- unrealon_driver/src/utils/time_formatter.py +0 -338
- unrealon_llm/README.md +0 -44
- unrealon_llm/__init__.py +0 -26
- unrealon_llm/pyproject.toml +0 -154
- unrealon_llm/src/__init__.py +0 -228
- unrealon_llm/src/cli/__init__.py +0 -0
- unrealon_llm/src/core/__init__.py +0 -11
- unrealon_llm/src/core/smart_client.py +0 -438
- unrealon_llm/src/dto/__init__.py +0 -155
- unrealon_llm/src/dto/models/__init__.py +0 -0
- unrealon_llm/src/dto/models/config.py +0 -343
- unrealon_llm/src/dto/models/core.py +0 -328
- unrealon_llm/src/dto/models/enums.py +0 -123
- unrealon_llm/src/dto/models/html_analysis.py +0 -345
- unrealon_llm/src/dto/models/statistics.py +0 -473
- unrealon_llm/src/dto/models/translation.py +0 -383
- unrealon_llm/src/dto/models/type_conversion.py +0 -462
- unrealon_llm/src/dto/schemas/__init__.py +0 -0
- unrealon_llm/src/exceptions.py +0 -392
- unrealon_llm/src/llm_config/__init__.py +0 -20
- unrealon_llm/src/llm_config/logging_config.py +0 -178
- unrealon_llm/src/llm_logging/__init__.py +0 -42
- unrealon_llm/src/llm_logging/llm_events.py +0 -107
- unrealon_llm/src/llm_logging/llm_logger.py +0 -466
- unrealon_llm/src/managers/__init__.py +0 -15
- unrealon_llm/src/managers/cache_manager.py +0 -67
- unrealon_llm/src/managers/cost_manager.py +0 -107
- unrealon_llm/src/managers/request_manager.py +0 -298
- unrealon_llm/src/modules/__init__.py +0 -0
- unrealon_llm/src/modules/html_processor/__init__.py +0 -25
- unrealon_llm/src/modules/html_processor/base_processor.py +0 -415
- unrealon_llm/src/modules/html_processor/details_processor.py +0 -85
- unrealon_llm/src/modules/html_processor/listing_processor.py +0 -91
- unrealon_llm/src/modules/html_processor/models/__init__.py +0 -20
- unrealon_llm/src/modules/html_processor/models/processing_models.py +0 -40
- unrealon_llm/src/modules/html_processor/models/universal_model.py +0 -56
- unrealon_llm/src/modules/html_processor/processor.py +0 -102
- unrealon_llm/src/modules/llm/__init__.py +0 -0
- unrealon_llm/src/modules/translator/__init__.py +0 -0
- unrealon_llm/src/provider.py +0 -116
- unrealon_llm/src/utils/__init__.py +0 -95
- unrealon_llm/src/utils/common.py +0 -64
- unrealon_llm/src/utils/data_extractor.py +0 -188
- unrealon_llm/src/utils/html_cleaner.py +0 -767
- unrealon_llm/src/utils/language_detector.py +0 -308
- unrealon_llm/src/utils/models_cache.py +0 -592
- unrealon_llm/src/utils/smart_counter.py +0 -229
- unrealon_llm/src/utils/token_counter.py +0 -189
- unrealon_sdk/README.md +0 -25
- unrealon_sdk/__init__.py +0 -30
- unrealon_sdk/pyproject.toml +0 -231
- unrealon_sdk/src/__init__.py +0 -150
- unrealon_sdk/src/cli/__init__.py +0 -12
- unrealon_sdk/src/cli/commands/__init__.py +0 -22
- unrealon_sdk/src/cli/commands/benchmark.py +0 -42
- unrealon_sdk/src/cli/commands/diagnostics.py +0 -573
- unrealon_sdk/src/cli/commands/health.py +0 -46
- unrealon_sdk/src/cli/commands/integration.py +0 -498
- unrealon_sdk/src/cli/commands/reports.py +0 -43
- unrealon_sdk/src/cli/commands/security.py +0 -36
- unrealon_sdk/src/cli/commands/server.py +0 -483
- unrealon_sdk/src/cli/commands/servers.py +0 -56
- unrealon_sdk/src/cli/commands/tests.py +0 -55
- unrealon_sdk/src/cli/main.py +0 -126
- unrealon_sdk/src/cli/utils/reporter.py +0 -519
- unrealon_sdk/src/clients/openapi.yaml +0 -3347
- unrealon_sdk/src/clients/python_http/__init__.py +0 -3
- unrealon_sdk/src/clients/python_http/api_config.py +0 -228
- unrealon_sdk/src/clients/python_http/models/BaseModel.py +0 -12
- unrealon_sdk/src/clients/python_http/models/BroadcastDeliveryStats.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastMessage.py +0 -17
- unrealon_sdk/src/clients/python_http/models/BroadcastMessageRequest.py +0 -35
- unrealon_sdk/src/clients/python_http/models/BroadcastPriority.py +0 -10
- unrealon_sdk/src/clients/python_http/models/BroadcastResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/BroadcastResultResponse.py +0 -33
- unrealon_sdk/src/clients/python_http/models/BroadcastTarget.py +0 -11
- unrealon_sdk/src/clients/python_http/models/ConnectionStats.py +0 -27
- unrealon_sdk/src/clients/python_http/models/ConnectionsResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/DeveloperMessageResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ErrorResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/HTTPValidationError.py +0 -16
- unrealon_sdk/src/clients/python_http/models/HealthResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/HealthStatus.py +0 -33
- unrealon_sdk/src/clients/python_http/models/LogLevel.py +0 -10
- unrealon_sdk/src/clients/python_http/models/LoggingRequest.py +0 -27
- unrealon_sdk/src/clients/python_http/models/LoggingResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/MaintenanceMode.py +0 -9
- unrealon_sdk/src/clients/python_http/models/MaintenanceModeRequest.py +0 -33
- unrealon_sdk/src/clients/python_http/models/MaintenanceStatusResponse.py +0 -39
- unrealon_sdk/src/clients/python_http/models/ParserCommandRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserMessageResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationRequest.py +0 -28
- unrealon_sdk/src/clients/python_http/models/ParserRegistrationResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ParserType.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyBlockRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyEndpointResponse.py +0 -20
- unrealon_sdk/src/clients/python_http/models/ProxyListResponse.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyProvider.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyPurchaseRequest.py +0 -25
- unrealon_sdk/src/clients/python_http/models/ProxyResponse.py +0 -47
- unrealon_sdk/src/clients/python_http/models/ProxyRotationRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ProxyStatus.py +0 -10
- unrealon_sdk/src/clients/python_http/models/ProxyUsageRequest.py +0 -19
- unrealon_sdk/src/clients/python_http/models/ProxyUsageStatsResponse.py +0 -26
- unrealon_sdk/src/clients/python_http/models/ServiceRegistrationDto.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ServiceStatsResponse.py +0 -31
- unrealon_sdk/src/clients/python_http/models/SessionStartRequest.py +0 -23
- unrealon_sdk/src/clients/python_http/models/SuccessResponse.py +0 -25
- unrealon_sdk/src/clients/python_http/models/SystemNotificationResponse.py +0 -23
- unrealon_sdk/src/clients/python_http/models/ValidationError.py +0 -18
- unrealon_sdk/src/clients/python_http/models/ValidationErrorResponse.py +0 -21
- unrealon_sdk/src/clients/python_http/models/WebSocketMetrics.py +0 -21
- unrealon_sdk/src/clients/python_http/models/__init__.py +0 -44
- unrealon_sdk/src/clients/python_http/services/None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/SocketLogging_service.py +0 -187
- unrealon_sdk/src/clients/python_http/services/SystemHealth_service.py +0 -119
- unrealon_sdk/src/clients/python_http/services/WebSocketAPI_service.py +0 -198
- unrealon_sdk/src/clients/python_http/services/__init__.py +0 -0
- unrealon_sdk/src/clients/python_http/services/admin_service.py +0 -125
- unrealon_sdk/src/clients/python_http/services/async_None_service.py +0 -35
- unrealon_sdk/src/clients/python_http/services/async_ParserManagement_service.py +0 -190
- unrealon_sdk/src/clients/python_http/services/async_ProxyManagement_service.py +0 -289
- unrealon_sdk/src/clients/python_http/services/async_SocketLogging_service.py +0 -189
- unrealon_sdk/src/clients/python_http/services/async_SystemHealth_service.py +0 -123
- unrealon_sdk/src/clients/python_http/services/async_WebSocketAPI_service.py +0 -200
- unrealon_sdk/src/clients/python_http/services/async_admin_service.py +0 -125
- unrealon_sdk/src/clients/python_websocket/__init__.py +0 -28
- unrealon_sdk/src/clients/python_websocket/client.py +0 -490
- unrealon_sdk/src/clients/python_websocket/events.py +0 -732
- unrealon_sdk/src/clients/python_websocket/example.py +0 -136
- unrealon_sdk/src/clients/python_websocket/types.py +0 -871
- unrealon_sdk/src/core/__init__.py +0 -64
- unrealon_sdk/src/core/client.py +0 -556
- unrealon_sdk/src/core/config.py +0 -465
- unrealon_sdk/src/core/exceptions.py +0 -239
- unrealon_sdk/src/core/metadata.py +0 -191
- unrealon_sdk/src/core/models.py +0 -142
- unrealon_sdk/src/core/types.py +0 -68
- unrealon_sdk/src/dto/__init__.py +0 -268
- unrealon_sdk/src/dto/authentication.py +0 -108
- unrealon_sdk/src/dto/cache.py +0 -208
- unrealon_sdk/src/dto/common.py +0 -19
- unrealon_sdk/src/dto/concurrency.py +0 -393
- unrealon_sdk/src/dto/events.py +0 -108
- unrealon_sdk/src/dto/health.py +0 -339
- unrealon_sdk/src/dto/load_balancing.py +0 -336
- unrealon_sdk/src/dto/logging.py +0 -230
- unrealon_sdk/src/dto/performance.py +0 -165
- unrealon_sdk/src/dto/rate_limiting.py +0 -295
- unrealon_sdk/src/dto/resource_pooling.py +0 -128
- unrealon_sdk/src/dto/structured_logging.py +0 -112
- unrealon_sdk/src/dto/task_scheduling.py +0 -121
- unrealon_sdk/src/dto/websocket.py +0 -55
- unrealon_sdk/src/enterprise/__init__.py +0 -59
- unrealon_sdk/src/enterprise/authentication.py +0 -401
- unrealon_sdk/src/enterprise/cache_manager.py +0 -578
- unrealon_sdk/src/enterprise/error_recovery.py +0 -494
- unrealon_sdk/src/enterprise/event_system.py +0 -549
- unrealon_sdk/src/enterprise/health_monitor.py +0 -747
- unrealon_sdk/src/enterprise/load_balancer.py +0 -964
- unrealon_sdk/src/enterprise/logging/__init__.py +0 -68
- unrealon_sdk/src/enterprise/logging/cleanup.py +0 -156
- unrealon_sdk/src/enterprise/logging/development.py +0 -744
- unrealon_sdk/src/enterprise/logging/service.py +0 -410
- unrealon_sdk/src/enterprise/multithreading_manager.py +0 -853
- unrealon_sdk/src/enterprise/performance_monitor.py +0 -539
- unrealon_sdk/src/enterprise/proxy_manager.py +0 -696
- unrealon_sdk/src/enterprise/rate_limiter.py +0 -652
- unrealon_sdk/src/enterprise/resource_pool.py +0 -763
- unrealon_sdk/src/enterprise/task_scheduler.py +0 -709
- unrealon_sdk/src/internal/__init__.py +0 -10
- unrealon_sdk/src/internal/command_router.py +0 -497
- unrealon_sdk/src/internal/connection_manager.py +0 -397
- unrealon_sdk/src/internal/http_client.py +0 -446
- unrealon_sdk/src/internal/websocket_client.py +0 -420
- unrealon_sdk/src/provider.py +0 -471
- unrealon_sdk/src/utils.py +0 -234
- /unrealon_browser/{src/cli → cli}/__init__.py +0 -0
- /unrealon_browser/{src/cli → cli}/interactive_mode.py +0 -0
- /unrealon_browser/{src/cli → cli}/main.py +0 -0
- /unrealon_browser/{src/core → core}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/__init__.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/config.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/core.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/dataclasses.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/detection.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/enums.py +0 -0
- /unrealon_browser/{src/dto → dto}/models/statistics.py +0 -0
- /unrealon_browser/{src/managers → managers}/__init__.py +0 -0
- /unrealon_browser/{src/managers → managers}/stealth.py +0 -0
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Mock Server Management CLI Commands
|
|
3
|
-
|
|
4
|
-
Start, stop, and manage development mock servers.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import click
|
|
8
|
-
import questionary
|
|
9
|
-
import asyncio
|
|
10
|
-
import signal
|
|
11
|
-
import sys
|
|
12
|
-
from pathlib import Path
|
|
13
|
-
from rich.console import Console
|
|
14
|
-
from rich.panel import Panel
|
|
15
|
-
from rich.table import Table
|
|
16
|
-
from typing import Dict, List, Any, Optional
|
|
17
|
-
|
|
18
|
-
console = Console()
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@click.group()
|
|
22
|
-
def server_cli():
|
|
23
|
-
"""🖥️ Mock server management for development."""
|
|
24
|
-
pass
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@server_cli.command()
|
|
28
|
-
@click.option('--websocket-port', default=18765, help='WebSocket server port')
|
|
29
|
-
@click.option('--http-port', default=18080, help='HTTP server port')
|
|
30
|
-
@click.option('--latency', default=50, help='Simulated latency in ms')
|
|
31
|
-
@click.option('--error-rate', default=0.05, help='Error simulation rate (0-1)')
|
|
32
|
-
@click.option('--background', '-d', is_flag=True, help='Run in background')
|
|
33
|
-
def start(websocket_port, http_port, latency, error_rate, background):
|
|
34
|
-
"""🚀 Start development mock servers."""
|
|
35
|
-
console.print("[bold blue]🖥️ Starting Development Mock Servers[/bold blue]")
|
|
36
|
-
|
|
37
|
-
if background:
|
|
38
|
-
console.print("[yellow]Starting servers in background mode...[/yellow]")
|
|
39
|
-
start_servers_background(websocket_port, http_port, latency, error_rate)
|
|
40
|
-
else:
|
|
41
|
-
console.print("[yellow]Starting servers in foreground mode (Press Ctrl+C to stop)...[/yellow]")
|
|
42
|
-
start_servers_foreground(websocket_port, http_port, latency, error_rate)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
@server_cli.command()
|
|
46
|
-
@click.option('--all', 'stop_all', is_flag=True, help='Stop all running servers')
|
|
47
|
-
@click.option('--websocket', is_flag=True, help='Stop WebSocket server only')
|
|
48
|
-
@click.option('--http', is_flag=True, help='Stop HTTP server only')
|
|
49
|
-
def stop(stop_all, websocket, http):
|
|
50
|
-
"""🛑 Stop mock servers."""
|
|
51
|
-
console.print("[bold blue]🛑 Stopping Mock Servers[/bold blue]")
|
|
52
|
-
|
|
53
|
-
if stop_all:
|
|
54
|
-
stop_all_servers()
|
|
55
|
-
elif websocket:
|
|
56
|
-
stop_websocket_server()
|
|
57
|
-
elif http:
|
|
58
|
-
stop_http_server()
|
|
59
|
-
else:
|
|
60
|
-
# Interactive selection
|
|
61
|
-
servers_to_stop = questionary.checkbox(
|
|
62
|
-
"Select servers to stop:",
|
|
63
|
-
choices=["WebSocket Server", "HTTP Server"]
|
|
64
|
-
).ask()
|
|
65
|
-
|
|
66
|
-
for server in servers_to_stop:
|
|
67
|
-
if "WebSocket" in server:
|
|
68
|
-
stop_websocket_server()
|
|
69
|
-
elif "HTTP" in server:
|
|
70
|
-
stop_http_server()
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
@server_cli.command()
|
|
74
|
-
def status():
|
|
75
|
-
"""📊 Show server status and information."""
|
|
76
|
-
console.print("[bold blue]📊 Mock Server Status[/bold blue]")
|
|
77
|
-
|
|
78
|
-
server_status = get_server_status()
|
|
79
|
-
display_server_status(server_status)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
@server_cli.command()
|
|
83
|
-
@click.option('--server', default='both',
|
|
84
|
-
type=click.Choice(['websocket', 'http', 'both']),
|
|
85
|
-
help='Server to restart')
|
|
86
|
-
def restart(server):
|
|
87
|
-
"""🔄 Restart mock servers."""
|
|
88
|
-
console.print(f"[bold blue]🔄 Restarting {server.title()} Server(s)[/bold blue]")
|
|
89
|
-
|
|
90
|
-
if server in ['websocket', 'both']:
|
|
91
|
-
console.print("[yellow]Restarting WebSocket server...[/yellow]")
|
|
92
|
-
restart_websocket_server()
|
|
93
|
-
|
|
94
|
-
if server in ['http', 'both']:
|
|
95
|
-
console.print("[yellow]Restarting HTTP server...[/yellow]")
|
|
96
|
-
restart_http_server()
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
@server_cli.command()
|
|
100
|
-
@click.option('--config-file', help='Server configuration file')
|
|
101
|
-
def configure(config_file):
|
|
102
|
-
"""⚙️ Configure mock server settings."""
|
|
103
|
-
console.print("[bold blue]⚙️ Mock Server Configuration[/bold blue]")
|
|
104
|
-
|
|
105
|
-
if config_file and Path(config_file).exists():
|
|
106
|
-
load_server_config(config_file)
|
|
107
|
-
else:
|
|
108
|
-
create_interactive_config()
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
@server_cli.command()
|
|
112
|
-
def interactive():
|
|
113
|
-
"""🎯 Interactive server management."""
|
|
114
|
-
console.print("[bold blue]🖥️ Interactive Server Management[/bold blue]")
|
|
115
|
-
|
|
116
|
-
action = questionary.select(
|
|
117
|
-
"What would you like to do?",
|
|
118
|
-
choices=[
|
|
119
|
-
"🚀 Start development servers",
|
|
120
|
-
"🛑 Stop running servers",
|
|
121
|
-
"📊 Check server status",
|
|
122
|
-
"🔄 Restart servers",
|
|
123
|
-
"⚙️ Configure server settings",
|
|
124
|
-
"📋 View server logs",
|
|
125
|
-
"🔧 Server troubleshooting"
|
|
126
|
-
]
|
|
127
|
-
).ask()
|
|
128
|
-
|
|
129
|
-
if "Start development" in action:
|
|
130
|
-
start_servers_interactive()
|
|
131
|
-
elif "Stop running" in action:
|
|
132
|
-
stop_servers_interactive()
|
|
133
|
-
elif "Check server status" in action:
|
|
134
|
-
console.print("[yellow]📊 Checking server status...[/yellow]")
|
|
135
|
-
server_status = get_server_status()
|
|
136
|
-
display_server_status(server_status)
|
|
137
|
-
elif "Restart servers" in action:
|
|
138
|
-
restart_servers_interactive()
|
|
139
|
-
elif "Configure server" in action:
|
|
140
|
-
configure_servers_interactive()
|
|
141
|
-
elif "View server logs" in action:
|
|
142
|
-
view_server_logs()
|
|
143
|
-
elif "Server troubleshooting" in action:
|
|
144
|
-
troubleshoot_servers()
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
def start_servers_foreground(ws_port: int, http_port: int, latency: int, error_rate: float):
|
|
148
|
-
"""Start servers in foreground mode."""
|
|
149
|
-
console.print(f"[green]🔗 WebSocket Server: ws://localhost:{ws_port}[/green]")
|
|
150
|
-
console.print(f"[green]🌐 HTTP Server: http://localhost:{http_port}[/green]")
|
|
151
|
-
console.print(f"[dim]Latency: {latency}ms | Error Rate: {error_rate*100:.1f}%[/dim]")
|
|
152
|
-
|
|
153
|
-
# Setup signal handlers for graceful shutdown
|
|
154
|
-
def signal_handler(sig, frame):
|
|
155
|
-
console.print("\n[yellow]Shutting down servers...[/yellow]")
|
|
156
|
-
# Stop servers gracefully
|
|
157
|
-
stop_all_servers()
|
|
158
|
-
console.print("[green]Servers stopped successfully[/green]")
|
|
159
|
-
sys.exit(0)
|
|
160
|
-
|
|
161
|
-
signal.signal(signal.SIGINT, signal_handler)
|
|
162
|
-
signal.signal(signal.SIGTERM, signal_handler)
|
|
163
|
-
|
|
164
|
-
try:
|
|
165
|
-
# This would start the actual async servers
|
|
166
|
-
console.print("[green]✅ Servers started successfully[/green]")
|
|
167
|
-
console.print("[dim]Press Ctrl+C to stop servers[/dim]")
|
|
168
|
-
|
|
169
|
-
# Keep running
|
|
170
|
-
asyncio.run(run_servers_forever(ws_port, http_port, latency, error_rate))
|
|
171
|
-
|
|
172
|
-
except KeyboardInterrupt:
|
|
173
|
-
console.print("\n[yellow]Stopping servers...[/yellow]")
|
|
174
|
-
except Exception as e:
|
|
175
|
-
console.print(f"[red]❌ Server error: {e}[/red]")
|
|
176
|
-
finally:
|
|
177
|
-
stop_all_servers()
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
def start_servers_background(ws_port: int, http_port: int, latency: int, error_rate: float):
|
|
181
|
-
"""Start servers in background mode."""
|
|
182
|
-
# This would start servers as daemon processes
|
|
183
|
-
console.print(f"[green]✅ Servers started in background[/green]")
|
|
184
|
-
console.print(f"[green]🔗 WebSocket: ws://localhost:{ws_port}[/green]")
|
|
185
|
-
console.print(f"[green]🌐 HTTP: http://localhost:{http_port}[/green]")
|
|
186
|
-
|
|
187
|
-
# Save server info for management
|
|
188
|
-
save_server_info({
|
|
189
|
-
'websocket': {'port': ws_port, 'status': 'running'},
|
|
190
|
-
'http': {'port': http_port, 'status': 'running'},
|
|
191
|
-
'config': {'latency': latency, 'error_rate': error_rate}
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
async def run_servers_forever(ws_port: int, http_port: int, latency: int, error_rate: float):
|
|
196
|
-
"""Run servers indefinitely."""
|
|
197
|
-
# This would run the actual async servers
|
|
198
|
-
try:
|
|
199
|
-
# Import and start actual mock servers
|
|
200
|
-
from unrealon_sdk.src.tests.integration.mock_servers.websocket_server import (
|
|
201
|
-
MockWebSocketServer, MockServerConfig
|
|
202
|
-
)
|
|
203
|
-
from unrealon_sdk.src.tests.integration.mock_servers.http_server import (
|
|
204
|
-
MockHTTPServer, MockHTTPConfig
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
# Create server configurations
|
|
208
|
-
ws_config = MockServerConfig(
|
|
209
|
-
host="localhost",
|
|
210
|
-
port=ws_port,
|
|
211
|
-
simulate_latency_ms=latency,
|
|
212
|
-
simulate_errors=True,
|
|
213
|
-
error_rate=error_rate
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
http_config = MockHTTPConfig(
|
|
217
|
-
host="localhost",
|
|
218
|
-
port=http_port,
|
|
219
|
-
simulate_latency_ms=latency,
|
|
220
|
-
simulate_errors=True,
|
|
221
|
-
error_rate=error_rate
|
|
222
|
-
)
|
|
223
|
-
|
|
224
|
-
# Start servers
|
|
225
|
-
ws_server = MockWebSocketServer(ws_config)
|
|
226
|
-
http_server = MockHTTPServer(http_config)
|
|
227
|
-
|
|
228
|
-
await ws_server.start_server()
|
|
229
|
-
await http_server.start_server()
|
|
230
|
-
|
|
231
|
-
console.print("[green]✅ Mock servers running successfully[/green]")
|
|
232
|
-
|
|
233
|
-
# Keep running
|
|
234
|
-
while True:
|
|
235
|
-
await asyncio.sleep(1)
|
|
236
|
-
|
|
237
|
-
except Exception as e:
|
|
238
|
-
console.print(f"[red]❌ Server error: {e}[/red]")
|
|
239
|
-
finally:
|
|
240
|
-
try:
|
|
241
|
-
await ws_server.stop_server()
|
|
242
|
-
await http_server.stop_server()
|
|
243
|
-
except:
|
|
244
|
-
pass
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
def stop_all_servers():
|
|
248
|
-
"""Stop all running mock servers."""
|
|
249
|
-
console.print("[yellow]Stopping all servers...[/yellow]")
|
|
250
|
-
# Implementation would stop actual servers
|
|
251
|
-
console.print("[green]✅ All servers stopped[/green]")
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
def stop_websocket_server():
|
|
255
|
-
"""Stop WebSocket server."""
|
|
256
|
-
console.print("[yellow]Stopping WebSocket server...[/yellow]")
|
|
257
|
-
console.print("[green]✅ WebSocket server stopped[/green]")
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
def stop_http_server():
|
|
261
|
-
"""Stop HTTP server."""
|
|
262
|
-
console.print("[yellow]Stopping HTTP server...[/yellow]")
|
|
263
|
-
console.print("[green]✅ HTTP server stopped[/green]")
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
def restart_websocket_server():
|
|
267
|
-
"""Restart WebSocket server."""
|
|
268
|
-
stop_websocket_server()
|
|
269
|
-
# Wait a moment
|
|
270
|
-
import time
|
|
271
|
-
time.sleep(1)
|
|
272
|
-
console.print("[green]✅ WebSocket server restarted[/green]")
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
def restart_http_server():
|
|
276
|
-
"""Restart HTTP server."""
|
|
277
|
-
stop_http_server()
|
|
278
|
-
# Wait a moment
|
|
279
|
-
import time
|
|
280
|
-
time.sleep(1)
|
|
281
|
-
console.print("[green]✅ HTTP server restarted[/green]")
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
def get_server_status() -> Dict[str, Any]:
|
|
285
|
-
"""Get current server status."""
|
|
286
|
-
# This would check actual server status
|
|
287
|
-
return {
|
|
288
|
-
'websocket': {
|
|
289
|
-
'status': 'running',
|
|
290
|
-
'port': 18765,
|
|
291
|
-
'connections': 3,
|
|
292
|
-
'uptime': '2h 15m',
|
|
293
|
-
'requests_handled': 1247
|
|
294
|
-
},
|
|
295
|
-
'http': {
|
|
296
|
-
'status': 'running',
|
|
297
|
-
'port': 18080,
|
|
298
|
-
'connections': 5,
|
|
299
|
-
'uptime': '2h 15m',
|
|
300
|
-
'requests_handled': 892
|
|
301
|
-
},
|
|
302
|
-
'system': {
|
|
303
|
-
'memory_usage': '45.2 MB',
|
|
304
|
-
'cpu_usage': '2.1%',
|
|
305
|
-
'total_connections': 8
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
def display_server_status(status: Dict[str, Any]):
|
|
311
|
-
"""Display server status information."""
|
|
312
|
-
# Status overview panel
|
|
313
|
-
overview_text = f"""
|
|
314
|
-
[bold]Mock Servers Status[/bold]
|
|
315
|
-
|
|
316
|
-
🔗 WebSocket: {status['websocket']['status']} (Port {status['websocket']['port']})
|
|
317
|
-
🌐 HTTP: {status['http']['status']} (Port {status['http']['port']})
|
|
318
|
-
|
|
319
|
-
📊 Total Connections: {status['system']['total_connections']}
|
|
320
|
-
💾 Memory Usage: {status['system']['memory_usage']}
|
|
321
|
-
⚡ CPU Usage: {status['system']['cpu_usage']}
|
|
322
|
-
"""
|
|
323
|
-
|
|
324
|
-
console.print(Panel(overview_text, title="Server Status", border_style="green"))
|
|
325
|
-
|
|
326
|
-
# Detailed status table
|
|
327
|
-
table = Table(title="Detailed Server Information")
|
|
328
|
-
table.add_column("Server", style="cyan")
|
|
329
|
-
table.add_column("Status", style="green")
|
|
330
|
-
table.add_column("Port", justify="right", style="blue")
|
|
331
|
-
table.add_column("Connections", justify="right", style="yellow")
|
|
332
|
-
table.add_column("Uptime", style="magenta")
|
|
333
|
-
table.add_column("Requests", justify="right", style="white")
|
|
334
|
-
|
|
335
|
-
for server_type, server_info in status.items():
|
|
336
|
-
if server_type != 'system':
|
|
337
|
-
table.add_row(
|
|
338
|
-
server_type.title(),
|
|
339
|
-
f"✅ {server_info['status']}",
|
|
340
|
-
str(server_info['port']),
|
|
341
|
-
str(server_info['connections']),
|
|
342
|
-
server_info['uptime'],
|
|
343
|
-
str(server_info['requests_handled'])
|
|
344
|
-
)
|
|
345
|
-
|
|
346
|
-
console.print(table)
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
def save_server_info(info: Dict[str, Any]):
|
|
350
|
-
"""Save server information for management."""
|
|
351
|
-
server_info_file = Path.home() / '.unrealon_servers.json'
|
|
352
|
-
import json
|
|
353
|
-
with open(server_info_file, 'w') as f:
|
|
354
|
-
json.dump(info, f, indent=2)
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
def load_server_config(config_file: str):
|
|
358
|
-
"""Load server configuration from file."""
|
|
359
|
-
console.print(f"[yellow]Loading configuration from {config_file}...[/yellow]")
|
|
360
|
-
# Implementation to load config
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
def create_interactive_config():
|
|
364
|
-
"""Create server configuration interactively."""
|
|
365
|
-
console.print("[yellow]⚙️ Creating server configuration...[/yellow]")
|
|
366
|
-
|
|
367
|
-
ws_port = questionary.text("WebSocket port:", default="18765").ask()
|
|
368
|
-
http_port = questionary.text("HTTP port:", default="18080").ask()
|
|
369
|
-
latency = questionary.text("Simulated latency (ms):", default="50").ask()
|
|
370
|
-
error_rate = questionary.text("Error rate (0-1):", default="0.05").ask()
|
|
371
|
-
|
|
372
|
-
config = {
|
|
373
|
-
'websocket_port': int(ws_port),
|
|
374
|
-
'http_port': int(http_port),
|
|
375
|
-
'latency': int(latency),
|
|
376
|
-
'error_rate': float(error_rate)
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
console.print("[green]✅ Configuration created[/green]")
|
|
380
|
-
console.print(f"[dim]Config: {config}[/dim]")
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
def start_servers_interactive():
|
|
384
|
-
"""Start servers interactively."""
|
|
385
|
-
ws_port = questionary.text("WebSocket port:", default="18765").ask()
|
|
386
|
-
http_port = questionary.text("HTTP port:", default="18080").ask()
|
|
387
|
-
latency = questionary.text("Simulated latency (ms):", default="50").ask()
|
|
388
|
-
error_rate = questionary.text("Error rate (0-1):", default="0.05").ask()
|
|
389
|
-
background = questionary.confirm("Run in background?").ask()
|
|
390
|
-
|
|
391
|
-
if background:
|
|
392
|
-
start_servers_background(int(ws_port), int(http_port), int(latency), float(error_rate))
|
|
393
|
-
else:
|
|
394
|
-
start_servers_foreground(int(ws_port), int(http_port), int(latency), float(error_rate))
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
def stop_servers_interactive():
|
|
398
|
-
"""Stop servers interactively."""
|
|
399
|
-
servers_to_stop = questionary.checkbox(
|
|
400
|
-
"Select servers to stop:",
|
|
401
|
-
choices=["WebSocket Server (Port 18765)", "HTTP Server (Port 18080)"]
|
|
402
|
-
).ask()
|
|
403
|
-
|
|
404
|
-
for server in servers_to_stop:
|
|
405
|
-
if "WebSocket" in server:
|
|
406
|
-
stop_websocket_server()
|
|
407
|
-
elif "HTTP" in server:
|
|
408
|
-
stop_http_server()
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
def restart_servers_interactive():
|
|
412
|
-
"""Restart servers interactively."""
|
|
413
|
-
server = questionary.select(
|
|
414
|
-
"Which server to restart?",
|
|
415
|
-
choices=["WebSocket Server", "HTTP Server", "Both Servers"]
|
|
416
|
-
).ask()
|
|
417
|
-
|
|
418
|
-
if "WebSocket" in server:
|
|
419
|
-
restart_websocket_server()
|
|
420
|
-
elif "HTTP" in server:
|
|
421
|
-
restart_http_server()
|
|
422
|
-
elif "Both" in server:
|
|
423
|
-
restart_websocket_server()
|
|
424
|
-
restart_http_server()
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
def configure_servers_interactive():
|
|
428
|
-
"""Configure servers interactively."""
|
|
429
|
-
console.print("[yellow]⚙️ Interactive server configuration...[/yellow]")
|
|
430
|
-
create_interactive_config()
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
def view_server_logs():
|
|
434
|
-
"""View server logs."""
|
|
435
|
-
console.print("[yellow]📋 Viewing server logs...[/yellow]")
|
|
436
|
-
|
|
437
|
-
# Mock log entries
|
|
438
|
-
logs = [
|
|
439
|
-
"[2025-08-11 01:00:15] WebSocket server started on port 18765",
|
|
440
|
-
"[2025-08-11 01:00:16] HTTP server started on port 18080",
|
|
441
|
-
"[2025-08-11 01:00:20] WebSocket client connected from 127.0.0.1",
|
|
442
|
-
"[2025-08-11 01:00:25] HTTP request: GET /api/v1/health",
|
|
443
|
-
"[2025-08-11 01:00:30] WebSocket message received: register_parser"
|
|
444
|
-
]
|
|
445
|
-
|
|
446
|
-
for log in logs:
|
|
447
|
-
console.print(f"[dim]{log}[/dim]")
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
def troubleshoot_servers():
|
|
451
|
-
"""Troubleshoot server issues."""
|
|
452
|
-
console.print("[yellow]🔧 Server troubleshooting...[/yellow]")
|
|
453
|
-
|
|
454
|
-
issue_type = questionary.select(
|
|
455
|
-
"What issue are you experiencing?",
|
|
456
|
-
choices=[
|
|
457
|
-
"Server won't start",
|
|
458
|
-
"Connection refused",
|
|
459
|
-
"High latency",
|
|
460
|
-
"Memory issues",
|
|
461
|
-
"Port conflicts"
|
|
462
|
-
]
|
|
463
|
-
).ask()
|
|
464
|
-
|
|
465
|
-
console.print(f"[yellow]Diagnosing: {issue_type}[/yellow]")
|
|
466
|
-
|
|
467
|
-
# Provide troubleshooting steps based on issue
|
|
468
|
-
if "won't start" in issue_type:
|
|
469
|
-
console.print("[dim]• Check if ports are already in use[/dim]")
|
|
470
|
-
console.print("[dim]• Verify Python dependencies are installed[/dim]")
|
|
471
|
-
console.print("[dim]• Check system permissions[/dim]")
|
|
472
|
-
elif "Connection refused" in issue_type:
|
|
473
|
-
console.print("[dim]• Verify server is running: unrealon-cli server status[/dim]")
|
|
474
|
-
console.print("[dim]• Check firewall settings[/dim]")
|
|
475
|
-
console.print("[dim]• Confirm correct port numbers[/dim]")
|
|
476
|
-
elif "High latency" in issue_type:
|
|
477
|
-
console.print("[dim]• Check latency configuration[/dim]")
|
|
478
|
-
console.print("[dim]• Monitor system resources[/dim]")
|
|
479
|
-
console.print("[dim]• Verify network connectivity[/dim]")
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
if __name__ == '__main__':
|
|
483
|
-
server_cli()
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Server Management Commands
|
|
3
|
-
|
|
4
|
-
Mock server management for UnrealOn SDK.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import questionary
|
|
8
|
-
from rich.console import Console
|
|
9
|
-
from typing import Dict, Any
|
|
10
|
-
|
|
11
|
-
console = Console()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def start_mock_server(port: int) -> Dict[str, Any]:
|
|
15
|
-
"""Start WebSocket server."""
|
|
16
|
-
console.print(f"[green]🚀 Starting WebSocket server on port {port}...[/green]")
|
|
17
|
-
console.print(f"[cyan]URL: ws://localhost:{port}[/cyan]")
|
|
18
|
-
console.print("[dim]Press Ctrl+C to stop[/dim]")
|
|
19
|
-
|
|
20
|
-
try:
|
|
21
|
-
# Here would be real server startup
|
|
22
|
-
import time
|
|
23
|
-
while True:
|
|
24
|
-
time.sleep(1)
|
|
25
|
-
except KeyboardInterrupt:
|
|
26
|
-
console.print("\n[yellow]Server stopped[/yellow]")
|
|
27
|
-
return {'status': 'stopped'}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def manage_servers() -> Dict[str, Any]:
|
|
31
|
-
"""Server management menu."""
|
|
32
|
-
console.print("[bold blue]🖥️ Mock server management...[/bold blue]")
|
|
33
|
-
|
|
34
|
-
action = questionary.select(
|
|
35
|
-
"Choose action:",
|
|
36
|
-
choices=[
|
|
37
|
-
"🚀 Start WebSocket server",
|
|
38
|
-
"🌐 Start HTTP server",
|
|
39
|
-
"🛑 Stop servers",
|
|
40
|
-
"📊 Server status"
|
|
41
|
-
]
|
|
42
|
-
).ask()
|
|
43
|
-
|
|
44
|
-
if "WebSocket" in action:
|
|
45
|
-
port = questionary.text("WebSocket port:", default="18765").ask()
|
|
46
|
-
return start_mock_server(int(port))
|
|
47
|
-
elif "HTTP" in action:
|
|
48
|
-
port = questionary.text("HTTP port:", default="18080").ask()
|
|
49
|
-
console.print(f"[green]HTTP server on port {port} (in development)[/green]")
|
|
50
|
-
return {'status': 'development', 'port': port}
|
|
51
|
-
elif "Stop" in action:
|
|
52
|
-
console.print("[yellow]Stopping servers...[/yellow]")
|
|
53
|
-
return {'status': 'stopped'}
|
|
54
|
-
elif "status" in action:
|
|
55
|
-
console.print("[green]All servers running normally[/green]")
|
|
56
|
-
return {'status': 'running'}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Test Runner Commands
|
|
3
|
-
|
|
4
|
-
Test execution for UnrealOn SDK.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import subprocess
|
|
8
|
-
from rich.console import Console
|
|
9
|
-
from typing import Dict, Any
|
|
10
|
-
|
|
11
|
-
console = Console()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def run_all_tests() -> Dict[str, Any]:
|
|
15
|
-
"""Run all tests."""
|
|
16
|
-
console.print("[bold blue]🧪 Running all tests...[/bold blue]")
|
|
17
|
-
|
|
18
|
-
with console.status("[bold green]Testing..."):
|
|
19
|
-
try:
|
|
20
|
-
result = subprocess.run([
|
|
21
|
-
'python', '-m', 'pytest',
|
|
22
|
-
'unrealon_sdk/tests/unit/',
|
|
23
|
-
'--tb=short', '-v'
|
|
24
|
-
], capture_output=True, text=True)
|
|
25
|
-
|
|
26
|
-
# Parse results
|
|
27
|
-
lines = result.stdout.split('\n')
|
|
28
|
-
passed = failed = 0
|
|
29
|
-
|
|
30
|
-
for line in lines:
|
|
31
|
-
if 'passed' in line and 'failed' in line:
|
|
32
|
-
# Extract statistics
|
|
33
|
-
parts = line.split()
|
|
34
|
-
for i, part in enumerate(parts):
|
|
35
|
-
if 'passed' in part:
|
|
36
|
-
try:
|
|
37
|
-
passed = int(parts[i-1])
|
|
38
|
-
except:
|
|
39
|
-
pass
|
|
40
|
-
if 'failed' in part:
|
|
41
|
-
try:
|
|
42
|
-
failed = int(parts[i-1])
|
|
43
|
-
except:
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
if failed == 0:
|
|
47
|
-
console.print(f"[green]✅ All {passed} tests passed successfully[/green]")
|
|
48
|
-
return {'status': 'passed', 'passed': passed, 'failed': 0}
|
|
49
|
-
else:
|
|
50
|
-
console.print(f"[red]❌ {failed} tests failed out of {passed + failed}[/red]")
|
|
51
|
-
return {'status': 'failed', 'passed': passed, 'failed': failed}
|
|
52
|
-
|
|
53
|
-
except Exception as e:
|
|
54
|
-
console.print(f"[red]Error: {e}[/red]")
|
|
55
|
-
return {'status': 'error', 'message': str(e)}
|