1818"""
1919
2020import os
21+ import pathlib
2122import shutil
2223
2324import nox
2829ALL_INTERPRETERS = ("2.7" , "3.6" , "3.7" , "3.8" , "3.9" )
2930PY3_INTERPRETERS = ("3.6" , "3.7" , "3.8" , "3.9" )
3031MAJOR_INTERPRETERS = ("2.7" , "3.8" )
32+ CURRENT_DIRECTORY = pathlib .Path (__file__ ).parent .absolute ()
3133
3234BLACK_VERSION = "black==20.8b1"
3335
@@ -38,10 +40,13 @@ def get_path(*names):
3840
3941@nox .session (py = ALL_INTERPRETERS )
4042def unit (session ):
43+ constraints_path = str (
44+ CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
45+ )
4146 # Install all dependencies.
4247 session .install ("pytest" , "pytest-cov" )
4348 session .install ("mock" )
44- session .install ("-e" , "." )
49+ session .install ("-e" , "." , "-c" , constraints_path )
4550 # This variable is used to skip coverage by Python version
4651 session .env ["PY_VERSION" ] = session .python [0 ]
4752 # Run py.test against the unit tests.
@@ -159,6 +164,9 @@ def doctest(session):
159164@nox .session (py = MAJOR_INTERPRETERS )
160165def system (session ):
161166 """Run the system test suite."""
167+ constraints_path = str (
168+ CURRENT_DIRECTORY / "testing" / f"constraints-{ session .python } .txt"
169+ )
162170 system_test_path = get_path ("tests" , "system.py" )
163171 system_test_folder_path = os .path .join ("tests" , "system" )
164172
@@ -182,7 +190,7 @@ def system(session):
182190 for local_dep in LOCAL_DEPS :
183191 session .install (local_dep )
184192 session .install ("-e" , get_path ("test_utils" , "test_utils" ))
185- session .install ("-e" , "." )
193+ session .install ("-e" , "." , "-c" , constraints_path )
186194
187195 # Run py.test against the system tests.
188196 if system_test_exists :
0 commit comments