Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to new nox #57

Merged
merged 1 commit into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
34 changes: 9 additions & 25 deletions nox.py → noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', '.')
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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.
Expand All @@ -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)
Expand All @@ -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')