diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b379dee..324e906 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,6 +34,11 @@ jobs: # Run all tests separately for individual feedback # Use 'if success() || failure()' so that all tests are run even if one failed # See https://stackoverflow.com/a/62112985 + - name: Import tests + run: | + uv run pytest ./tests/test_import.py + if: ${{ success() || failure() }} + - name: Agent tests run: | uv run pytest ./tests/test_agents.py diff --git a/tests/test_import.py b/tests/test_import.py new file mode 100644 index 0000000..3253b6d --- /dev/null +++ b/tests/test_import.py @@ -0,0 +1,15 @@ +import subprocess + + +def test_import_smolagents_without_extras(): + # Run the import statement in an isolated virtual environment + result = subprocess.run( + ["uv", "run", "--isolated", "-"], input="import smolagents", text=True, capture_output=True + ) + # Check if the import was successful + assert result.returncode == 0, ( + "Import failed with error: " + + (result.stderr.splitlines()[-1] if result.stderr else "No error message") + + "\n" + + result.stderr + )