import os
import subprocess
import sys
from pathlib import Path


def test_repo_core_module_imports_from_repo_root():
    repo_root = Path(__file__).resolve().parents[1]
    result = subprocess.run(
        [sys.executable, "-c", "import repo_core; print(repo_core.__file__)"],
        cwd=repo_root,
        capture_output=True,
        text=True,
        env={**os.environ, "PYTHONPATH": ""},
    )

    assert result.returncode == 0, result.stderr or result.stdout
    assert "repo_core" in result.stdout
