|
import os |
|
import subprocess |
|
import tempfile |
|
|
|
|
|
def test_import_smolagents_without_extras(monkeypatch): |
|
monkeypatch.delenv("VIRTUAL_ENV", raising=False) |
|
with tempfile.TemporaryDirectory() as temp_dir: |
|
|
|
venv_dir = os.path.join(temp_dir, "venv") |
|
subprocess.run(["uv", "venv", venv_dir], check=True) |
|
|
|
|
|
subprocess.run( |
|
["uv", "pip", "install", "--python", os.path.join(venv_dir, "bin", "python"), "smolagents @ ."], check=True |
|
) |
|
|
|
|
|
result = subprocess.run( |
|
[os.path.join(venv_dir, "bin", "python"), "-c", "import smolagents"], |
|
capture_output=True, |
|
text=True, |
|
) |
|
|
|
|
|
assert result.returncode == 0, ( |
|
"Import failed with error: " |
|
+ (result.stderr.splitlines()[-1] if result.stderr else "No error message") |
|
+ "\n" |
|
+ result.stderr |
|
) |
|
|