2828@nox .session
2929def default (session ):
3030 """Default unit test session.
31-
32- This is intended to be run **without** an interpreter set, so
33- that the current ``python`` (on the ``PATH``) or the version of
34- Python corresponding to the ``nox`` binary the ``PATH`` can
35- run the tests.
3631 """
3732 # Install all test dependencies, then install local packages in-place.
3833 session .install ('mock' , 'pytest' , 'pytest-cov' )
@@ -54,35 +49,20 @@ def default(session):
5449 )
5550
5651
57- @nox .session
58- @nox .parametrize ('py' , ['2.7' , '3.5' , '3.6' , '3.7' ])
59- def unit (session , py ):
52+ @nox .session (python = ['2.7' , '3.5' , '3.6' , '3.7' ])
53+ def unit (session ):
6054 """Run the unit test suite."""
61-
62- # Run unit tests against all supported versions of Python.
63- session .interpreter = 'python{}' .format (py )
64-
65- # Set the virtualenv dirname.
66- session .virtualenv_dirname = 'unit-' + py
67-
6855 default (session )
6956
7057
71- @nox .session
72- @nox .parametrize ('py' , ['2.7' , '3.6' ])
73- def system (session , py ):
58+ @nox .session (python = ['2.7' , '3.6' ])
59+ def system (session ):
7460 """Run the system test suite."""
7561
7662 # Sanity check: Only run system tests if the environment variable is set.
7763 if not os .environ .get ('GOOGLE_APPLICATION_CREDENTIALS' , '' ):
7864 session .skip ('Credentials must be set via environment variable.' )
7965
80- # Run the system tests against latest Python 2 and Python 3 only.
81- session .interpreter = 'python{}' .format (py )
82-
83- # Set the virtualenv dirname.
84- session .virtualenv_dirname = 'sys-' + py
85-
8666 # Use pre-release gRPC for system tests.
8767 session .install ('--pre' , 'grpcio' )
8868
@@ -102,40 +82,33 @@ def system(session, py):
10282 )
10383
10484
105- @nox .session
85+ @nox .session ( python = '3.6' )
10686def lint (session ):
10787 """Run linters.
10888
10989 Returns a failure if the linters find linting errors or sufficiently
11090 serious code quality issues.
11191 """
112- session .interpreter = 'python3.6'
11392 session .install ('flake8' , * LOCAL_DEPS )
11493 session .install ('.' )
11594 session .run ('flake8' , 'google' , 'tests' )
11695
11796
118- @nox .session
97+ @nox .session ( python = '3.6' )
11998def lint_setup_py (session ):
12099 """Verify that setup.py is valid (including RST check)."""
121- session .interpreter = 'python3.6'
122-
123- # Set the virtualenv dirname.
124- session .virtualenv_dirname = 'setup'
125-
126100 session .install ('docutils' , 'Pygments' )
127101 session .run (
128102 'python' , 'setup.py' , 'check' , '--restructuredtext' , '--strict' )
129103
130104
131- @nox .session
105+ @nox .session ( python = '3.6' )
132106def cover (session ):
133107 """Run the final coverage report.
134108
135109 This outputs the coverage report aggregating coverage from the unit
136110 test runs (not system test runs), and then erases coverage data.
137111 """
138- session .interpreter = 'python3.6'
139112 session .install ('coverage' , 'pytest-cov' )
140113 session .run ('coverage' , 'report' , '--show-missing' , '--fail-under=100' )
141114 session .run ('coverage' , 'erase' )
0 commit comments