Skip to content

Commit c419bf7

Browse files
busunkim96theacodes
authored andcommitted
Use new Nox (#6175)
1 parent bbb361f commit c419bf7

File tree

1 file changed

+10
-39
lines changed

1 file changed

+10
-39
lines changed

nox.py renamed to noxfile.py

Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,13 @@
3434
)
3535

3636

37-
@nox.session
3837
def default(session, django_dep=('django',)):
3938
"""Default unit test session.
40-
41-
This is intended to be run **without** an interpreter set, so
42-
that the current ``python`` (on the ``PATH``) or the version of
43-
Python corresponding to the ``nox`` binary the ``PATH`` can
44-
run the tests.
4539
"""
40+
4641
# Install all test dependencies, then install this package in-place.
4742
deps = UNIT_TEST_DEPS
48-
49-
if session.interpreter is None and sys.version_info[:2] == (2, 7):
50-
deps += ('django >= 1.11.0, < 2.0.0dev',)
51-
else:
52-
deps += django_dep
43+
deps += django_dep
5344

5445
session.install(*deps)
5546
for local_dep in LOCAL_DEPS:
@@ -71,45 +62,31 @@ def default(session, django_dep=('django',)):
7162
)
7263

7364

74-
@nox.session
75-
@nox.parametrize('py', ['2.7', '3.5', '3.6', '3.7'])
76-
def unit(session, py):
65+
@nox.session(python=['2.7', '3.5', '3.6', '3.7'])
66+
def unit(session):
7767
"""Run the unit test suite."""
7868

79-
# Run unit tests against all supported versions of Python.
80-
session.interpreter = 'python{}'.format(py)
81-
82-
# Set the virtualenv dirname.
83-
session.virtualenv_dirname = 'unit-' + py
84-
8569
# Testing multiple version of django
8670
# See https://www.djangoproject.com/download/ for supported version
8771
django_deps_27 = [
8872
('django==1.8.19',),
8973
('django >= 1.11.0, < 2.0.0dev',),
9074
]
9175

92-
if session.interpreter == 'python2.7':
76+
if session.virtualenv.interpreter == '2.7':
9377
[default(session, django_dep=django) for django in django_deps_27]
9478
else:
9579
default(session)
9680

9781

98-
@nox.session
99-
@nox.parametrize('py', ['2.7', '3.6'])
100-
def system(session, py):
82+
@nox.session(python=['2.7', '3.6'])
83+
def system(session):
10184
"""Run the system test suite."""
10285

10386
# Sanity check: Only run system tests if the environment variable is set.
10487
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
10588
session.skip('Credentials must be set via environment variable.')
10689

107-
# Run the system tests against latest Python 2 and Python 3 only.
108-
session.interpreter = 'python{}'.format(py)
109-
110-
# Set the virtualenv dirname.
111-
session.virtualenv_dirname = 'sys-' + py
112-
11390
# Use pre-release gRPC for system tests.
11491
session.install('--pre', 'grpcio')
11592

@@ -137,40 +114,34 @@ def system(session, py):
137114
*session.posargs)
138115

139116

140-
@nox.session
117+
@nox.session(python='3.6')
141118
def lint(session):
142119
"""Run linters.
143120
144121
Returns a failure if the linters find linting errors or sufficiently
145122
serious code quality issues.
146123
"""
147-
session.interpreter = 'python3.6'
148124
session.install('flake8', *LOCAL_DEPS)
149125
session.install('.')
150126
session.run('flake8', 'google', 'tests')
151127

152128

153-
@nox.session
129+
@nox.session(python='3.6')
154130
def lint_setup_py(session):
155131
"""Verify that setup.py is valid (including RST check)."""
156-
session.interpreter = 'python3.6'
157-
158-
# Set the virtualenv dirname.
159-
session.virtualenv_dirname = 'setup'
160132

161133
session.install('docutils', 'Pygments')
162134
session.run(
163135
'python', 'setup.py', 'check', '--restructuredtext', '--strict')
164136

165137

166-
@nox.session
138+
@nox.session(python='3.6')
167139
def cover(session):
168140
"""Run the final coverage report.
169141
170142
This outputs the coverage report aggregating coverage from the unit
171143
test runs (not system test runs), and then erases coverage data.
172144
"""
173-
session.interpreter = 'python3.6'
174145
session.install('coverage', 'pytest-cov')
175146
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
176147
session.run('coverage', 'erase')

0 commit comments

Comments
 (0)