Test import without extras (#370)
* Test import without extras * Add import test to CI * Use uv run
This commit is contained in:
		
							parent
							
								
									242a6e59c5
								
							
						
					
					
						commit
						cc21135188
					
				|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|     ) | ||||
		Loading…
	
		Reference in New Issue