8000 test: remove unused imports/variables; un-shadow duplicated test_export_post by devin-ai-integration[bot] · Pull Request #110 · dominicusin/package-maximizer · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions tests/test_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

import pytest

from package_maximizer.adapters import (
APTMetadataAdapter,
PackageMetadata,
Expand Down
1 change: 0 additions & 1 deletion tests/test_adapters_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from package_maximizer.adapters import (
BrewMetadataAdapter,
NpmMetadataAdapter,
PackageMetadata,
) 8000


Expand Down
2 changes: 0 additions & 2 deletions tests/test_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

import pytest

from package_maximizer.core.package import Package
from package_maximizer.utils.benchmark import (
BenchmarkReport,
Expand Down
3 changes: 0 additions & 3 deletions 3 tests/test_brew_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

from unittest.mock import MagicMock, patch

import pytest

from package_maximizer.core.package import Package
from package_maximizer.parsers.brew_parser import BrewParser


Expand Down
1 change: 0 additions & 1 deletion tests/test_cli_analyze_compare.py
8000
Original file line numberDiff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import json
from unittest.mock import MagicMock, patch

import pytest
from click.testing import CliRunner

from package_maximizer.cli.main import cli
Expand Down
3 changes: 0 additions & 3 deletions tests/test_cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@

import json
import sys
from pathlib import Path

import pytest
from click.testing import CliRunner

from package_maximizer.cli.main import (
cli,
config_command,
export_command,
from_file,
Expand Down
3 changes: 0 additions & 3 deletions tests/test_cli_extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
Tests for extended CLI commands (Phase 4)
"""

import json

import pytest
from click.testing import CliRunner

from package_maximizer.cli import (
Expand Down
4 changes: 0 additions & 4 deletions tests/test_cli_extended_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@

import json
import sys
from pathlib import Path

import pytest
from click.testing import CliRunner

from package_maximizer.cli.main import (
Expand All @@ -20,10 +18,8 @@
from_file,
info,
init_config_command,
list_installed,
list_managers,
list_solvers,
maximize,
search,
system_info,
tui_command,
Expand Down
4 changes: 1 addition & 3 deletions tests/test_cli_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

from __future__ import annotations

import json
from unittest.mock import patch

import pytest
from click.testing import CliRunner

from package_maximizer.cli.main import cli
Expand All @@ -18,7 +16,7 @@
def test_shell_command_imports():
"""shell command imports MaximizerShell without crashing."""
runner = CliRunner()
with patch("package_maximizer.tui.shell.MaximizerShell") as mock_shell:
with patch("package_maximizer.tui.shell.MaximizerShell"):
result = runner.invoke(cli, ["shell"])
assert result.exit_code == 0

Expand Down
3 changes: 0 additions & 3 deletions tests/test_config_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
from __future__ import annotations

import json
import os

import pytest

from package_maximizer.core.config import Config, load_config
from package_maximizer.utils.logging_config import configure_logging, get_logger
Expand Down
2 changes: 0 additions & 2 deletions tests/test_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Tests for constraints module
"""

import pytest

from package_maximizer.core.constraints import (
ConflictConstraint,
ConstraintParser,
Expand Down
2 changes: 0 additions & 2 deletions tests/test_core_maximizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

from __future__ import annotations

import pytest

from package_maximizer.core.enums import PackageManagerType, SolverType
from package_maximizer.core.maximizer import PackageMaximizer
from package_maximizer.core.package import Package
Expand Down
17 changes: 15 additions & 2 deletions tests/test_coverage_gaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,17 @@ async def _wait_for(pilot, condition, attempts=100):
await pilot.pause(0.05)


async def _wait_for_log(pilot, log, before, attempts=100):
"""Wait until the log grew past ``before`` and stopped changing."""
prev = -1
for _ in range(attempts):
await pilot.pause(0.05)
n = len(log.lines)
if n > before and n == prev:
return
prev = n


class TestTuiAppExtras:
def test_dark_mode_button_toggles_twice(self):
async def actions(app, pilot):
Expand Down Expand Up @@ -348,9 +359,11 @@ async def actions(app, pilot):
app.query_one("#packages").value = packages
app.query_one("#metadata").value = metadata
await pilot.pause()
log = app.query_one("#log_output")
before = len(log.lines)
app.query_one("#run").press()
await pilot.pause()
return list(app.query_one("#log_output").lines)
await _wait_for_log(pilot, log, before)
return list(log.lines)

patches = [
patch("package_maximizer.adapters.get_adapter", return_value=adapter)
Expand Down
3 changes: 0 additions & 3 deletions tests/test_di.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

from __future__ import annotations

import pytest

from package_maximizer.core.package import Package
from package_maximizer.di import (
Container,
ServiceLocator,
Expand Down
5 changes: 1 addition & 4 deletions tests/test_golden_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@

from __future__ import annotations

import pytest

from package_maximizer.core.model_encoder import ModelConstraints, encode_packages
from package_maximizer.core.model_encoder import encode_packages
from package_maximizer.core.package import Package
from package_maximizer.solvers.enhanced_greedy import EnhancedGreedySolver
from package_maximizer.solvers.greedy import GreedySolver


Expand Down
6 changes: 2 additions & 4 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

from __future__ import annotations

import json

import pytest

from package_maximizer.core.constraints import ConstraintParser, VersionConstraint
from package_maximizer.core.maximizer import PackageMaximizer
from package_maximizer.core.package import Package
from package_maximizer.parsers import PARSER_REGISTRY, get_parser
from package_maximizer.solvers import SOLVER_REGISTRY, get_solver
from package_maximizer.parsers import get_parser
from package_maximizer.solvers import get_solver


# ─── End-to-end maximization scenarios ───────────────────────
Expand Down
3 changes: 0 additions & 3 deletions tests/test_integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

from unittest.mock import MagicMock, patch

import pytest

from package_maximizer.core.package import Package
from package_maximizer.integrations import RealRepoIntegration


Expand Down
2 changes: 0 additions & 2 deletions tests/test_lazy_registries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

import importlib

import pytest


Expand Down
2 changes: 1 addition & 1 deletion tests/test_maximizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest

from package_maximizer import Package, PackageManagerType, PackageMaximizer, SolverType
from package_maximizer.solvers import GreedySolver, Z3Solver
from package_maximizer.solvers import GreedySolver


class TestPackageMaximizer:
Expand Down
4 changes: 0 additions & 4 deletions tests/test_minisat_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

from __future__ import annotations

from unittest.mock import MagicMock, patch

import pytest

from package_maximizer.core.package import Package


Expand Down
4 changes: 0 additions & 4 deletions tests/test_ortools_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

from __future__ import annotations

from unittest.mock import MagicMock, patch

import pytest

from package_maximizer.core.package import Package


Expand Down
3 changes: 0 additions & 3 deletions tests/test_pacman_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

from __future__ import annotations

import pytest

from package_maximizer.core.package import Package
from package_maximizer.parsers.pacman_parser import PacmanParser


Expand Down
1 change: 0 additions & 1 deletion tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import pytest

from package_maximizer.core.package import Package
from package_maximizer.parsers import APTParser, get_parser


Expand Down
2 changes: 0 additions & 2 deletions tests/test_parsers_conda_portage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

import pytest

from package_maximizer.parsers import CondaParser, PortageParser


Expand Down
9 changes: 3 additions & 6 deletions tests/test_parsers_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,9 @@ def test_npm_text_fallback(self):
def test_registry_includes_new_parsers(self):
for key in ("snap", "flatpak", "cargo", "npm"):
assert key in PARSER_REGISTRY
assert isinstance(
get_parser(key),
PackageParser := __import__(
"package_maximizer.core.interfaces", fromlist=["PackageParser"]
).PackageParser,
)
from package_maximizer.core.interfaces import PackageParser

assert isinstance(get_parser(key), PackageParser)

def test_conda_parser(self):
pkgs = CondaParser().parse(CONDA_LIST)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_solver_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

import pytest

from package_maximizer.core.package import Package
from package_maximizer.solvers.enhanced_greedy import EnhancedGreedySolver
from package_maximizer.solvers.greedy import GreedySolver
Expand Down
2 changes: 0 additions & 2 deletions tests/test_solvers_enhanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Tests for EnhancedGreedySolver
"""

import pytest

from package_maximizer.core.package import Package
from package_maximizer.solvers import EnhancedGreedySolver

Expand Down
3 changes: 0 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

import tempfile
import time
from pathlib import Path

import pytest

from package_maximizer.core.package import Package
from package_maximizer.utils import CacheManager
Expand Down
2 changes: 1 addition & 1 deletion tests/test_web_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def test_history_get_with_params(client):
# --- Export endpoint ---------------------------------------------------------


def test_export_post(client):
def test_export_post_returns_selected(client):
"""POST /api/v1/export returns JSON result."""
payload = {"packages": ["pkg1"], "manager": "apt", "format": "json"}
r = client.post("/api/v1/export", json=payload, headers=auth_headers())
Expand Down
2 changes: 0 additions & 2 deletions tests/test_z3_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

import pytest

from package_maximizer.core.package import Package


Expand Down
Loading
0