Skip to content

Commit

Permalink
Use new Nox (#6175)
Browse files Browse the repository at this point in the history
  • Loading branch information
busunkim96 authored and theacodes committed Oct 10, 2018
1 parent 78eeaa4 commit a28117b
Showing 1 changed file with 7 additions and 29 deletions.
36 changes: 7 additions & 29 deletions google-cloud-speech/nox.py → google-cloud-speech/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
)


@nox.session
def default(session):
"""Default unit test session.
Expand All @@ -50,35 +49,20 @@ def default(session):
)


@nox.session
@nox.parametrize('py', ['2.7', '3.5', '3.6', '3.7'])
def unit(session, py):
@nox.session(python=['2.7', '3.5', '3.6', '3.7'])
def unit(session):
"""Run the unit test suite."""

# Run unit tests against all supported versions of Python.
session.interpreter = 'python{}'.format(py)

# Set the virtualenv dirname.
session.virtualenv_dirname = 'unit-' + py

default(session)


@nox.session
@nox.parametrize('py', ['2.7', '3.6'])
def system(session, py):
@nox.session(python=['2.7', '3.6'])
def system(session):
"""Run the system test suite."""

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

# Run the system tests against latest Python 2 and Python 3 only.
session.interpreter = 'python{}'.format(py)

# Set the virtualenv dirname.
session.virtualenv_dirname = 'sys-' + py

# Use pre-release gRPC for system tests.
session.install('--pre', 'grpcio')

Expand All @@ -92,40 +76,34 @@ def system(session, py):
session.run('py.test', '--quiet', os.path.join('tests', 'system'))


@nox.session
@nox.session(python='3.6')
def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.interpreter = 'python3.6'
session.install('flake8', *LOCAL_DEPS)
session.install('.')
session.run('flake8', 'google', 'tests')


@nox.session
@nox.session(python='3.6')
def lint_setup_py(session):
"""Verify that setup.py is valid (including RST check)."""
session.interpreter = 'python3.6'

# Set the virtualenv dirname.
session.virtualenv_dirname = 'setup'

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


@nox.session
@nox.session(python='3.6')
def cover(session):
"""Run the final coverage report.
This outputs the coverage report aggregating coverage from the unit
test runs (not system test runs), and then erases coverage data.
"""
session.interpreter = 'python3.6'
session.chdir(os.path.dirname(__file__))
session.install('coverage', 'pytest-cov')
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
Expand Down

0 comments on commit a28117b

Please sign in to comment.