2525)
2626
2727
28- @nox .session
2928def default (session ):
3029 """Default unit test session.
3130
@@ -40,14 +39,14 @@ def default(session):
4039 session .install ('-e' , local_dep )
4140
4241 # Pyarrow does not support Python 3.7
43- if session .interpreter == 'python3 .7' :
42+ if session .python == '3 .7' :
4443 dev_install = '.[pandas]'
4544 else :
4645 dev_install = '.[pandas, pyarrow]'
4746 session .install ('-e' , dev_install )
4847
4948 # IPython does not support Python 2 after version 5.x
50- if session .interpreter == 'python2 .7' :
49+ if session .python == '2 .7' :
5150 session .install ('ipython==5.5' )
5251 else :
5352 session .install ('ipython' )
@@ -67,35 +66,20 @@ def default(session):
6766 )
6867
6968
70- @nox .session
71- @nox .parametrize ('py' , ['2.7' , '3.5' , '3.6' , '3.7' ])
72- def unit (session , py ):
69+ @nox .session (python = ['2.7' , '3.5' , '3.6' , '3.7' ])
70+ def unit (session ):
7371 """Run the unit test suite."""
74-
75- # Run unit tests against all supported versions of Python.
76- session .interpreter = 'python{}' .format (py )
77-
78- # Set the virtualenv dirname.
79- session .virtualenv_dirname = 'unit-' + py
80-
8172 default (session )
8273
8374
84- @nox .session
85- @nox .parametrize ('py' , ['2.7' , '3.6' ])
86- def system (session , py ):
75+ @nox .session (python = ['2.7' , '3.6' ])
76+ def system (session ):
8777 """Run the system test suite."""
8878
8979 # Sanity check: Only run system tests if the environment variable is set.
9080 if not os .environ .get ('GOOGLE_APPLICATION_CREDENTIALS' , '' ):
9181 session .skip ('Credentials must be set via environment variable.' )
9282
93- # Run the system tests against latest Python 2 and Python 3 only.
94- session .interpreter = 'python{}' .format (py )
95-
96- # Set the virtualenv dirname.
97- session .virtualenv_dirname = 'sys-' + py
98-
9983 # Use pre-release gRPC for system tests.
10084 session .install ('--pre' , 'grpcio' )
10185
@@ -108,7 +92,7 @@ def system(session, py):
10892 session .install ('-e' , '.[pandas]' )
10993
11094 # IPython does not support Python 2 after version 5.x
111- if session .interpreter == 'python2 .7' :
95+ if session .python == '2 .7' :
11296 session .install ('ipython==5.5' )
11397 else :
11498 session .install ('ipython' )
@@ -122,21 +106,14 @@ def system(session, py):
122106 )
123107
124108
125- @nox .session
126- @nox .parametrize ('py' , ['2.7' , '3.6' ])
127- def snippets (session , py ):
109+ @nox .session (python = ['2.7' , '3.6' ])
110+ def snippets (session ):
128111 """Run the system test suite."""
129112
130113 # Sanity check: Only run system tests if the environment variable is set.
131114 if not os .environ .get ('GOOGLE_APPLICATION_CREDENTIALS' , '' ):
132115 session .skip ('Credentials must be set via environment variable.' )
133116
134- # Run the system tests against latest Python 2 and Python 3 only.
135- session .interpreter = 'python{}' .format (py )
136-
137- # Set the virtualenv dirname.
138- session .virtualenv_dirname = 'snip-' + py
139-
140117 # Install all test dependencies, then install local packages in place.
141118 session .install ('mock' , 'pytest' )
142119 for local_dep in LOCAL_DEPS :
@@ -150,14 +127,13 @@ def snippets(session, py):
150127 'py.test' , os .path .join ('docs' , 'snippets.py' ), * session .posargs )
151128
152129
153- @nox .session
130+ @nox .session ( python = '3.6' )
154131def lint (session ):
155132 """Run linters.
156133
157134 Returns a failure if the linters find linting errors or sufficiently
158135 serious code quality issues.
159136 """
160- session .interpreter = 'python3.6'
161137
162138 session .install ('flake8' , * LOCAL_DEPS )
163139 session .install ('.' )
@@ -167,28 +143,22 @@ def lint(session):
167143 'flake8' , os .path .join ('docs' , 'snippets.py' ))
168144
169145
170- @nox .session
146+ @nox .session ( python = '3.6' )
171147def lint_setup_py (session ):
172148 """Verify that setup.py is valid (including RST check)."""
173- session .interpreter = 'python3.6'
174-
175- # Set the virtualenv dirname.
176- session .virtualenv_dirname = 'setup'
177149
178150 session .install ('docutils' , 'Pygments' )
179151 session .run (
180152 'python' , 'setup.py' , 'check' , '--restructuredtext' , '--strict' )
181153
182154
183- @nox .session
155+ @nox .session ( python = '3.6' )
184156def cover (session ):
185157 """Run the final coverage report.
186158
187159 This outputs the coverage report aggregating coverage from the unit
188160 test runs (not system test runs), and then erases coverage data.
189161 """
190- session .interpreter = 'python3.6'
191-
192162 session .install ('coverage' , 'pytest-cov' )
193163 session .run ('coverage' , 'report' , '--show-missing' , '--fail-under=100' )
194164 session .run ('coverage' , 'erase' )
0 commit comments