1818
1919from __future__ import absolute_import
2020import os
21+ import pathlib
2122import shutil
2223
2324import nox
3031SYSTEM_TEST_PYTHON_VERSIONS = ["2.7" , "3.8" ]
3132UNIT_TEST_PYTHON_VERSIONS = ["2.7" , "3.6" , "3.7" , "3.8" , "3.9" ]
3233
34+ CURRENT_DIRECTORY = pathlib .Path (__file__ ).parent .absolute ()
35+
3336
3437@nox .session (python = DEFAULT_PYTHON_VERSION )
3538def lint (session ):
@@ -65,9 +68,12 @@ def lint_setup_py(session):
6568
6669
6770def default (session ):
71+ constraints_path = str (
72+ CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
73+ )
6874 # Install all test dependencies, then install this package in-place.
69- session .install ("mock" , "pytest" , "pytest-cov" )
70- session .install ("-e" , "." )
75+ session .install ("mock" , "pytest" , "pytest-cov" , "-c" , constraints_path )
76+ session .install ("-e" , "." , "-c" , constraints_path )
7177
7278 # Run py.test against the unit tests.
7379 session .run (
@@ -93,6 +99,9 @@ def unit(session):
9399
94100@nox .session (python = SYSTEM_TEST_PYTHON_VERSIONS )
95101def system (session ):
102+ constraints_path = str (
103+ CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
104+ )
96105 """Run the system test suite."""
97106 system_test_path = os .path .join ("tests" , "system.py" )
98107 system_test_folder_path = os .path .join ("tests" , "system" )
@@ -121,15 +130,15 @@ def system(session):
121130 # 2021-05-06: defer installing 'google-cloud-*' to after this package,
122131 # in order to work around Python 2.7 googolapis-common-protos
123132 # issue.
124- session .install (
125- "mock" , "pytest" ,
126- )
127- session .install ("-e" , "." )
133+ session .install ("mock" , "pytest" , "-c" , constraints_path )
134+ session .install ("-e" , "." , "-c" , constraints_path )
128135 session .install (
129136 "google-cloud-testutils" ,
130137 "google-cloud-iam" ,
131138 "google-cloud-pubsub < 2.0.0" ,
132139 "google-cloud-kms < 2.0dev" ,
140+ "-c" ,
141+ constraints_path ,
133142 )
134143
135144 # Run py.test against the system tests.
0 commit comments