Skip to content

Commit 9f45e3c

Browse files
busunkim96theacodes
authored andcommitted
Use new Nox (#6175)
1 parent 2ab3a09 commit 9f45e3c

File tree

1 file changed

+8
-31
lines changed

1 file changed

+8
-31
lines changed

nox.py renamed to noxfile.py

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import nox # pytype: disable=import-error
2020

2121

22-
@nox.session
2322
def default(session):
2423
"""Default unit test session.
2524
@@ -52,57 +51,37 @@ def default(session):
5251
)
5352

5453

55-
@nox.session
56-
@nox.parametrize('py', ['2.7', '3.5', '3.6', '3.7'])
57-
def unit(session, py):
54+
@nox.session(python=['2.7', '3.5', '3.6', '3.7'])
55+
def unit(session):
5856
"""Run the unit test suite."""
59-
60-
# Run unit tests against all supported versions of Python.
61-
session.interpreter = 'python{}'.format(py)
62-
63-
# Set the virtualenv dirname.
64-
session.virtualenv_dirname = 'unit-' + py
65-
6657
default(session)
6758

6859

69-
@nox.session
70-
@nox.parametrize('py', ['2.7', '3.5', '3.6', '3.7'])
71-
def unit_grpc_gcp(session, py):
60+
@nox.session(python=['2.7', '3.5', '3.6', '3.7'])
61+
def unit_grpc_gcp(session):
7262
"""Run the unit test suite with grpcio-gcp installed."""
7363

74-
# Run unit tests against all supported versions of Python.
75-
session.interpreter = 'python{}'.format(py)
76-
77-
# Set the virtualenv dirname.
78-
session.virtualenv_dirname = 'unit-grpc-gcp-' + py
79-
8064
# Install grpcio-gcp
8165
session.install('grpcio-gcp')
8266

8367
default(session)
8468

8569

86-
@nox.session
70+
@nox.session(python='3.6')
8771
def lint(session):
8872
"""Run linters.
8973
9074
Returns a failure if the linters find linting errors or sufficiently
9175
serious code quality issues.
9276
"""
93-
session.interpreter = 'python3.6'
9477
session.install('flake8', 'flake8-import-order')
9578
session.install('.')
9679
session.run('flake8', 'google', 'tests')
9780

9881

99-
@nox.session
82+
@nox.session(python='3.6')
10083
def lint_setup_py(session):
10184
"""Verify that setup.py is valid (including RST check)."""
102-
session.interpreter = 'python3.6'
103-
104-
# Set the virtualenv dirname.
105-
session.virtualenv_dirname = 'setup'
10685

10786
session.install('docutils', 'Pygments')
10887
session.run(
@@ -111,25 +90,23 @@ def lint_setup_py(session):
11190

11291
# No 2.7 due to https://github.com/google/importlab/issues/26.
11392
# No 3.7 because pytype supports up to 3.6 only.
114-
@nox.session
93+
@nox.session(python='3.6')
11594
def pytype(session):
11695
"""Run type-checking."""
117-
session.interpreter = 'python3.6'
11896
session.install('.',
11997
'grpcio >= 1.8.2',
12098
'grpcio-gcp >= 0.2.2',
12199
'pytype >= 2018.9.26')
122100
session.run('pytype')
123101

124102

125-
@nox.session
103+
@nox.session(python='3.6')
126104
def cover(session):
127105
"""Run the final coverage report.
128106
129107
This outputs the coverage report aggregating coverage from the unit
130108
test runs (not system test runs), and then erases coverage data.
131109
"""
132-
session.interpreter = 'python3.6'
133110
session.install('coverage', 'pytest-cov')
134111
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
135112
session.run('coverage', 'erase')

0 commit comments

Comments
 (0)