|
39 | 39 | "pytest",
|
40 | 40 | "pytest-cov",
|
41 | 41 | "pytest-asyncio",
|
| 42 | + # Preventing: py.test: error: unrecognized arguments: -n=auto --dist=loadscope |
| 43 | + "pytest-xdist", |
42 | 44 | ]
|
43 | 45 | UNIT_TEST_EXTERNAL_DEPENDENCIES = []
|
44 | 46 | UNIT_TEST_LOCAL_DEPENDENCIES = []
|
@@ -201,9 +203,32 @@ def default(session):
|
201 | 203 | @nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
|
202 | 204 | def unit(session):
|
203 | 205 | """Run the unit test suite."""
|
| 206 | + # First run the minimal GenAI tests |
| 207 | + unit_genai_minimal_dependencies(session) |
| 208 | + |
| 209 | + # Then run the default full test suite |
204 | 210 | default(session)
|
205 | 211 |
|
206 | 212 |
|
| 213 | +def unit_genai_minimal_dependencies(session): |
| 214 | + # Install minimal test dependencies, then install this package in-place. |
| 215 | + |
| 216 | + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES |
| 217 | + session.install(*standard_deps) |
| 218 | + session.install("-e", ".") |
| 219 | + |
| 220 | + # Run py.test against the unit tests. |
| 221 | + session.run( |
| 222 | + "py.test", |
| 223 | + "--quiet", |
| 224 | + f"--junitxml=unit_{session.python}_sponge_log.xml", |
| 225 | + # These tests require the PIL module |
| 226 | + # "--ignore=TestGenerativeModels::test_image_mime_types", |
| 227 | + os.path.join("tests", "unit", "vertexai", "test_generative_models.py"), |
| 228 | + *session.posargs, |
| 229 | + ) |
| 230 | + |
| 231 | + |
207 | 232 | @nox.session(python="3.10")
|
208 | 233 | @nox.parametrize("ray", ["2.9.3"])
|
209 | 234 | def unit_ray(session, ray):
|
|
0 commit comments