18
18
19
19
from __future__ import absolute_import
20
20
import os
21
+ import pathlib
21
22
import shutil
22
23
23
24
import nox
30
31
SYSTEM_TEST_PYTHON_VERSIONS = ["2.7" , "3.8" ]
31
32
UNIT_TEST_PYTHON_VERSIONS = ["2.7" , "3.6" , "3.7" , "3.8" , "3.9" ]
32
33
34
+ CURRENT_DIRECTORY = pathlib .Path (__file__ ).parent .absolute ()
35
+
33
36
34
37
@nox .session (python = DEFAULT_PYTHON_VERSION )
35
38
def lint (session ):
@@ -65,9 +68,12 @@ def lint_setup_py(session):
65
68
66
69
67
70
def default (session ):
71
+ constraints_path = str (
72
+ CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
73
+ )
68
74
# 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 )
71
77
72
78
# Run py.test against the unit tests.
73
79
session .run (
@@ -93,6 +99,9 @@ def unit(session):
93
99
94
100
@nox .session (python = SYSTEM_TEST_PYTHON_VERSIONS )
95
101
def system (session ):
102
+ constraints_path = str (
103
+ CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
104
+ )
96
105
"""Run the system test suite."""
97
106
system_test_path = os .path .join ("tests" , "system.py" )
98
107
system_test_folder_path = os .path .join ("tests" , "system" )
@@ -121,15 +130,15 @@ def system(session):
121
130
# 2021-05-06: defer installing 'google-cloud-*' to after this package,
122
131
# in order to work around Python 2.7 googolapis-common-protos
123
132
# 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 )
128
135
session .install (
129
136
"google-cloud-testutils" ,
130
137
"google-cloud-iam" ,
131
138
"google-cloud-pubsub < 2.0.0" ,
132
139
"google-cloud-kms < 2.0dev" ,
140
+ "-c" ,
141
+ constraints_path ,
133
142
)
134
143
135
144
# Run py.test against the system tests.
0 commit comments