Skip to content

Commit

Permalink
Add dlp to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
landrito committed Aug 22, 2017
1 parent 53fd41c commit 38aa94e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ jobs:
if [[ -n $(grep datastore ~/target_packages) ]]; then
nox -f datastore/nox.py
fi
- run:
name: Run tests - google.cloud.dlp
command: |
if [[ -n $(grep dlp ~/target_packages) ]]; then
nox -f dlp/nox.py
fi
- run:
name: Run tests - google.cloud.dns
command: |
Expand Down
37 changes: 35 additions & 2 deletions dlp/nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from __future__ import absolute_import

import os

import nox


Expand All @@ -25,12 +27,43 @@ def unit_tests(session, python_version):
# Run unit tests against all supported versions of Python.
session.interpreter = 'python{}'.format(python_version)

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

# Install all test dependencies, then install this package in-place.
session.install('mock', 'pytest', 'pytest-cov')
session.install('mock', 'pytest')
session.install('-e', '.')

# Run py.test against the unit tests.
session.run('py.test', '--quiet', 'tests/')
session.run('py.test', '--quiet', os.path.join('tests', 'unit'))


@nox.session
@nox.parametrize('python_version', ['2.7', '3.6'])
def system_tests(session, python_version):
"""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 unit tests against all supported versions of Python.
session.interpreter = 'python{}'.format(python_version)

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

# Install all test dependencies, then install this package in-place.
session.install('pytest')
session.install('-e', '.')

# Run py.test against the unit tests.
session.run(
'py.test',
'--quiet',
os.path.join('tests', 'system'),
*session.posargs)


@nox.session
def lint_setup_py(session):
Expand Down

0 comments on commit 38aa94e

Please sign in to comment.