From 145936e81a8ce82f532df35465bafb8b512babad Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Wed, 10 Oct 2018 11:04:44 -0700 Subject: [PATCH] Use new Nox (#6175) --- .../{nox.py => noxfile.py} | 36 ++++--------------- 1 file changed, 7 insertions(+), 29 deletions(-) rename packages/google-cloud-python-speech/{nox.py => noxfile.py} (79%) diff --git a/packages/google-cloud-python-speech/nox.py b/packages/google-cloud-python-speech/noxfile.py similarity index 79% rename from packages/google-cloud-python-speech/nox.py rename to packages/google-cloud-python-speech/noxfile.py index ee5edd578ef0..264c617cb39b 100644 --- a/packages/google-cloud-python-speech/nox.py +++ b/packages/google-cloud-python-speech/noxfile.py @@ -24,7 +24,6 @@ ) -@nox.session def default(session): """Default unit test session. @@ -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') @@ -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')