diff --git a/.circleci/config.yml b/.circleci/config.yml index 0bc24fa6..5cea19af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 jobs: build: docker: - - image: googleapis/nox:0.17.0 + - image: gcr.io/cloud-devrel-public-resources/python steps: - checkout - run: diff --git a/nox.py b/noxfile.py similarity index 83% rename from nox.py rename to noxfile.py index e0ed0437..4a015d8f 100644 --- a/nox.py +++ b/noxfile.py @@ -26,14 +26,10 @@ GOOGLE_AUTH = 'google-auth >= 0.10.0' -@nox.session -@nox.parametrize('python_version', ['2.7', '3.4', '3.5', '3.6']) -def unit_tests(session, python_version): +@nox.session(python=['2,7', '3.4', '3.5', '3.6', '3.7']) +def unit_tests(session): """Run the unit test suite.""" - # Run unit tests against all supported versions of Python. - session.interpreter = 'python{}'.format(python_version) - # Install all test dependencies, then install this package in-place. session.install('mock', 'pytest', 'pytest-cov', REQUESTS) session.install('-e', '.') @@ -55,13 +51,10 @@ def unit_tests(session, python_version): ) -@nox.session +@nox.session(python='3.6') def docs(session): """Build the docs.""" - # Build docs against the latest version of Python, because we can. - session.interpreter = 'python3.6' - # Install Sphinx and other dependencies. session.chdir(os.path.realpath(os.path.dirname(__file__))) session.install( @@ -76,11 +69,9 @@ def docs(session): session.run('bash', os.path.join('scripts', 'build_docs.sh')) -@nox.session +@nox.session(python='3.6') def doctest(session): """Run the doctests.""" - session.interpreter = 'python3.6' - # Install Sphinx and other dependencies. session.chdir(os.path.realpath(os.path.dirname(__file__))) session.install( @@ -101,14 +92,13 @@ def doctest(session): ) -@nox.session +@nox.session(python='3.6') def lint(session): """Run flake8. Returns a failure if flake8 finds linting errors or sufficiently serious code quality issues. """ - session.interpreter = 'python3.6' session.install('flake8') session.install('-e', '.') session.run( @@ -118,18 +108,16 @@ def lint(session): ) -@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' session.install('docutils', 'Pygments') session.run( 'python', 'setup.py', 'check', '--restructuredtext', '--strict') -@nox.session -@nox.parametrize('python_version', ['2.7', '3.6']) -def system_tests(session, python_version): +@nox.session(python=['2.7', '3.6']) +def system_tests(session): """Run the system test suite.""" # Sanity check: environment variables are set. @@ -144,9 +132,6 @@ def system_tests(session, python_version): msg = 'Environment variable(s) unset: {}'.format(all_vars) session.skip(msg) - # Run the system tests against latest Python 2 and Python 3 only. - session.interpreter = 'python{}'.format(python_version) - # Install all test dependencies, then install this package into the # virutalenv's dist-packages. session.install('mock', 'pytest', REQUESTS, GOOGLE_AUTH) @@ -160,14 +145,13 @@ def system_tests(session, python_version): ) -@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.install('coverage', 'pytest-cov') session.run('coverage', 'report', '--show-missing', '--fail-under=100') session.run('coverage', 'erase')