Skip to content

Commit 8c5a80e

Browse files
busunkim96theacodes
authored andcommitted
Use new Nox (#6175)
1 parent 2515119 commit 8c5a80e

1 file changed

Lines changed: 7 additions & 29 deletions

File tree

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,35 +55,20 @@ def default(session):
5555
)
5656

5757

58-
@nox.session
59-
@nox.parametrize('py', ['2.7', '3.5', '3.6', '3.7'])
60-
def unit(session, py):
58+
@nox.session(python=['2.7', '3.5', '3.6', '3.7'])
59+
def unit(session):
6160
"""Run the unit test suite."""
62-
63-
# Run unit tests against all supported versions of Python.
64-
session.interpreter = 'python{}'.format(py)
65-
66-
# Set the virtualenv dirname.
67-
session.virtualenv_dirname = 'unit-' + py
68-
6961
default(session)
7062

7163

72-
@nox.session
73-
@nox.parametrize('py', ['2.7', '3.6'])
74-
def system(session, py):
64+
@nox.session(python=['2.7', '3.6'])
65+
def system(session):
7566
"""Run the system test suite."""
7667

7768
# Sanity check: Only run system tests if the environment variable is set.
7869
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
7970
session.skip('Credentials must be set via environment variable.')
8071

81-
# Run the system tests against latest Python 2 and Python 3 only.
82-
session.interpreter = 'python{}'.format(py)
83-
84-
# Set the virtualenv dirname.
85-
session.virtualenv_dirname = 'sys-' + py
86-
8772
# Use pre-release gRPC for system tests.
8873
session.install('--pre', 'grpcio')
8974

@@ -104,40 +89,33 @@ def system(session, py):
10489
session.run('py.test', '--quiet', 'tests/system.py', *session.posargs)
10590

10691

107-
@nox.session
92+
@nox.session(python='3.6')
10893
def lint(session):
10994
"""Run linters.
11095
11196
Returns a failure if the linters find linting errors or sufficiently
11297
serious code quality issues.
11398
"""
114-
session.interpreter = 'python3.6'
11599
session.install('flake8', *LOCAL_DEPS)
116100
session.install('.')
117101
session.run('flake8', 'google', 'tests')
118102

119103

120-
@nox.session
104+
@nox.session(python='3.6')
121105
def lint_setup_py(session):
122106
"""Verify that setup.py is valid (including RST check)."""
123-
session.interpreter = 'python3.6'
124-
125-
# Set the virtualenv dirname.
126-
session.virtualenv_dirname = 'setup'
127-
128107
session.install('docutils', 'Pygments')
129108
session.run(
130109
'python', 'setup.py', 'check', '--restructuredtext', '--strict')
131110

132111

133-
@nox.session
112+
@nox.session(python='3.6')
134113
def cover(session):
135114
"""Run the final coverage report.
136115
137116
This outputs the coverage report aggregating coverage from the unit
138117
test runs (not system test runs), and then erases coverage data.
139118
"""
140-
session.interpreter = 'python3.6'
141119
session.install('coverage', 'pytest-cov')
142120
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
143121
session.run('coverage', 'erase')

0 commit comments

Comments
 (0)