Skip to content

Commit e5ba8f5

Browse files
busunkim96theacodes
authored andcommitted
Use new Nox (#6175)
1 parent 2bf5025 commit e5ba8f5

File tree

1 file changed

+8
-37
lines changed

1 file changed

+8
-37
lines changed

packages/google-cloud-translate/nox.py renamed to packages/google-cloud-translate/noxfile.py

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,8 @@
2525
)
2626

2727

28-
@nox.session
2928
def default(session):
30-
"""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.
36-
"""
29+
"""Default unit test session."""
3730
# Install all test dependencies, then install local packages in-place.
3831
session.install('mock', 'pytest', 'pytest-cov')
3932
for local_dep in LOCAL_DEPS:
@@ -49,35 +42,20 @@ def default(session):
4942
)
5043

5144

52-
@nox.session
53-
@nox.parametrize('py', ['2.7', '3.5', '3.6', '3.7'])
54-
def unit(session, py):
45+
@nox.session(python=['2.7', '3.5', '3.6', '3.7'])
46+
def unit(session):
5547
"""Run the unit test suite."""
56-
57-
# Run unit tests against all supported versions of Python.
58-
session.interpreter = 'python{}'.format(py)
59-
60-
# Set the virtualenv dirname.
61-
session.virtualenv_dirname = 'unit-' + py
62-
6348
default(session)
6449

6550

66-
@nox.session
67-
@nox.parametrize('py', ['2.7', '3.6'])
68-
def system(session, py):
51+
@nox.session(python=['2.7', '3.6'])
52+
def system(session):
6953
"""Run the system test suite."""
7054

7155
# Sanity check: Only run system tests if the environment variable is set.
7256
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
7357
session.skip('Credentials must be set via environment variable.')
7458

75-
# Run the system tests against latest Python 2 and Python 3 only.
76-
session.interpreter = 'python{}'.format(py)
77-
78-
# Set the virtualenv dirname.
79-
session.virtualenv_dirname = 'sys-' + py
80-
8159
# Use pre-release gRPC for system tests.
8260
session.install('--pre', 'grpcio')
8361

@@ -92,40 +70,33 @@ def system(session, py):
9270
session.run('py.test', '--quiet', 'tests/system.py')
9371

9472

95-
@nox.session
73+
@nox.session(python='3.6')
9674
def lint(session):
9775
"""Run linters.
9876
9977
Returns a failure if the linters find linting errors or sufficiently
10078
serious code quality issues.
10179
"""
102-
session.interpreter = 'python3.6'
10380
session.install('flake8', *LOCAL_DEPS)
10481
session.install('.')
10582
session.run('flake8', 'google', 'tests')
10683

10784

108-
@nox.session
85+
@nox.session(python='3.6')
10986
def lint_setup_py(session):
11087
"""Verify that setup.py is valid (including RST check)."""
111-
session.interpreter = 'python3.6'
112-
113-
# Set the virtualenv dirname.
114-
session.virtualenv_dirname = 'setup'
115-
11688
session.install('docutils', 'Pygments')
11789
session.run(
11890
'python', 'setup.py', 'check', '--restructuredtext', '--strict')
11991

12092

121-
@nox.session
93+
@nox.session(python='3.6')
12294
def cover(session):
12395
"""Run the final coverage report.
12496
12597
This outputs the coverage report aggregating coverage from the unit
12698
test runs (not system test runs), and then erases coverage data.
12799
"""
128-
session.interpreter = 'python3.6'
129100
session.install('coverage', 'pytest-cov')
130101
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
131102
session.run('coverage', 'erase')

0 commit comments

Comments
 (0)