Skip to content

Commit 38aa94e

Browse files
committed
Add dlp to CI
1 parent 53fd41c commit 38aa94e

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

.circleci/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ jobs:
5454
if [[ -n $(grep datastore ~/target_packages) ]]; then
5555
nox -f datastore/nox.py
5656
fi
57+
- run:
58+
name: Run tests - google.cloud.dlp
59+
command: |
60+
if [[ -n $(grep dlp ~/target_packages) ]]; then
61+
nox -f dlp/nox.py
62+
fi
5763
- run:
5864
name: Run tests - google.cloud.dns
5965
command: |

dlp/nox.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
from __future__ import absolute_import
1616

17+
import os
18+
1719
import nox
1820

1921

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

30+
# Set the virtualenv dirname.
31+
session.virtualenv_dirname = 'unit-' + python_version
32+
2833
# Install all test dependencies, then install this package in-place.
29-
session.install('mock', 'pytest', 'pytest-cov')
34+
session.install('mock', 'pytest')
3035
session.install('-e', '.')
3136

3237
# Run py.test against the unit tests.
33-
session.run('py.test', '--quiet', 'tests/')
38+
session.run('py.test', '--quiet', os.path.join('tests', 'unit'))
39+
40+
41+
@nox.session
42+
@nox.parametrize('python_version', ['2.7', '3.6'])
43+
def system_tests(session, python_version):
44+
"""Run the system test suite."""
45+
46+
# Sanity check: Only run system tests if the environment variable is set.
47+
if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
48+
session.skip('Credentials must be set via environment variable.')
49+
50+
# Run unit tests against all supported versions of Python.
51+
session.interpreter = 'python{}'.format(python_version)
52+
53+
# Set the virtualenv dirname.
54+
session.virtualenv_dirname = 'sys-' + python_version
55+
56+
# Install all test dependencies, then install this package in-place.
57+
session.install('pytest')
58+
session.install('-e', '.')
59+
60+
# Run py.test against the unit tests.
61+
session.run(
62+
'py.test',
63+
'--quiet',
64+
os.path.join('tests', 'system'),
65+
*session.posargs)
66+
3467

3568
@nox.session
3669
def lint_setup_py(session):

0 commit comments

Comments
 (0)