1414
1515from __future__ import absolute_import
1616
17+ import os
18+
1719import 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
3669def lint_setup_py (session ):
0 commit comments