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
1 change: 1 addition & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ types-PyYAML
types-requests
types-setuptools
types-toml
build
25 changes: 25 additions & 0 deletions test/test_mismatch_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import shutil
import sqlite3
import subprocess
import sys
from pathlib import Path
from test.utils import LONG_TESTS
from unittest.mock import patch

import pytest
Expand All @@ -26,6 +30,14 @@ def test_db(tmpdir_factory):
yield str(db_file)


@pytest.fixture(scope="module")
def build_cleanup():
yield
dist_dir = Path(__file__).resolve().parent.parent / "dist"
if dist_dir.exists():
shutil.rmtree(dist_dir)


def test_lookup(capsys, monkeypatch, test_db):
# Test with custom database path using the --database flag
monkeypatch.setattr(
Expand Down Expand Up @@ -93,3 +105,16 @@ def verify_db(test_db):
"facebook",
)
assert expected in result


@pytest.mark.skipif(not LONG_TESTS(), reason="Skipping long tests")
def test_package_build(build_cleanup):
build = subprocess.run([sys.executable, "-m", "build"], check=True)
assert build.returncode == 0, "Python build failed"

dist_dir = Path(__file__).resolve().parent.parent / "dist"
package_path = list(dist_dir.glob("*.whl"))[0]
subprocess.run(["pip", "install", str(package_path)], check=True)

result = subprocess.run(["mismatch", "--help"], capture_output=True, text=True)
assert "ModuleNotFoundError: No module named 'mismatch'" not in result.stderr
Loading