@@ -150,31 +150,36 @@ def default(session, install_extras=True):
150150
151151
152152@nox .session (python = ALL_PYTHON )
153+ @nox .parametrize ("test_type" , ["unit" , "unit_noextras" ])
153154@_calculate_duration
154- def unit (session ):
155+ def unit (session , test_type ):
155156 """Run the unit test suite."""
156157
157- if session .python in ( "3.7" ,) :
158+ if session .python == "3.7" :
158159 session .skip ("Python 3.7 is no longer supported" )
159160
160- default (session )
161-
162-
163- @nox .session (python = [UNIT_TEST_PYTHON_VERSIONS [0 ], UNIT_TEST_PYTHON_VERSIONS [- 1 ]])
164- @_calculate_duration
165- def unit_noextras (session ):
166- """Run the unit test suite."""
167-
168- # Install optional dependencies that are out-of-date to see that
169- # we fail gracefully.
170- # https://github.com/googleapis/google-cloud-python/issues/933
171- #
172- # We only install this extra package on one of the two Python versions
173- # so that it continues to be an optional dependency.
174- # https://github.com/googleapis/google-cloud-python/issues/1877
175- if session .python == UNIT_TEST_PYTHON_VERSIONS [0 ]:
176- session .install ("pyarrow==4.0.0" , "numpy==1.20.2" )
177- default (session , install_extras = False )
161+ install_extras = True
162+ if test_type == "unit_noextras" :
163+ # unit_noextras only runs on the oldest and newest Python versions
164+ if session .python not in (UNIT_TEST_PYTHON_VERSIONS [0 ], UNIT_TEST_PYTHON_VERSIONS [- 1 ]):
165+ session .skip (
166+ f"unit_noextras only runs on the oldest ({ UNIT_TEST_PYTHON_VERSIONS [0 ]} ) "
167+ f"and newest ({ UNIT_TEST_PYTHON_VERSIONS [- 1 ]} ) supported Python versions"
168+ )
169+
170+ install_extras = False
171+
172+ # Install optional dependencies that are out-of-date to see that
173+ # we fail gracefully.
174+ # https://github.com/googleapis/google-cloud-python/issues/933
175+ #
176+ # We only install this extra package on one of the two Python versions
177+ # so that it continues to be an optional dependency.
178+ # https://github.com/googleapis/google-cloud-python/issues/1877
179+ if session .python == UNIT_TEST_PYTHON_VERSIONS [0 ]:
180+ session .install ("pyarrow==4.0.0" , "numpy==1.20.2" )
181+
182+ default (session , install_extras = install_extras )
178183
179184
180185@nox .session (python = DEFAULT_PYTHON_VERSION )
0 commit comments