Skip to content

Commit 11355d5

Browse files
author
Luke Sneeringer
committed
Migrating PubSub to new CI.
1 parent 39d491a commit 11355d5

16 files changed

Lines changed: 93 additions & 42 deletions

File tree

monitoring/nox.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def system_tests(session, python_version):
4646
# Install all test dependencies, then install this package into the
4747
# virutalenv's dist-packages.
4848
session.install('mock', 'pytest',
49-
'../core/', '../test_utils/',
50-
) #'../bigquery/', '../pubsub/', '../storage/')
49+
'../core/', '../test_utils/')
5150
session.install('.')
5251

5352
# Run py.test against the system tests.

pubsub/.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
exclude =
3+
__pycache__,
4+
.git,
5+
*.pyc,
6+
conf.py

pubsub/google/cloud/pubsub/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@
3030
from google.cloud.pubsub.client import Client
3131
from google.cloud.pubsub.subscription import Subscription
3232
from google.cloud.pubsub.topic import Topic
33+
34+
__all__ = ['__version__', 'Client', 'Subscription', 'Topic']

pubsub/nox.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Copyright 2016 Google Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import nox
16+
17+
18+
@nox.session
19+
@nox.parametrize('python_version', ['2.7', '3.4', '3.5', '3.6'])
20+
def unit_tests(session, python_version):
21+
"""Run the unit test suite."""
22+
23+
# Run unit tests against all supported versions of Python.
24+
session.interpreter = 'python%s' % python_version
25+
26+
# Install all test dependencies, then install this package in-place.
27+
session.install('mock', 'pytest', 'pytest-cov', '../core/')
28+
session.install('-e', '.')
29+
30+
# Run py.test against the unit tests.
31+
session.run('py.test', '--quiet',
32+
'--cov=google.cloud.pubsub', '--cov=tests.unit', '--cov-append',
33+
'--cov-config=.coveragerc', '--cov-report=', '--cov-fail-under=97',
34+
'tests/unit',
35+
)
36+
37+
38+
@nox.session
39+
@nox.parametrize('python_version', ['2.7', '3.6'])
40+
def system_tests(session, python_version):
41+
"""Run the system test suite."""
42+
43+
# Run the system tests against latest Python 2 and Python 3 only.
44+
session.interpreter = 'python%s' % python_version
45+
46+
# Install all test dependencies, then install this package into the
47+
# virutalenv's dist-packages.
48+
session.install('mock', 'pytest',
49+
'../core/', '../test_utils/')
50+
session.install('.')
51+
52+
# Run py.test against the system tests.
53+
session.run('py.test', '--quiet', 'tests/system.py')
54+
55+
56+
@nox.session
57+
def lint(session):
58+
"""Run flake8.
59+
60+
Returns a failure if flake8 finds linting errors or sufficiently
61+
serious code quality issues.
62+
"""
63+
session.interpreter = 'python3.6'
64+
session.install('flake8')
65+
session.install('.')
66+
session.run('flake8', 'google/cloud/pubsub')
67+
68+
69+
@nox.session
70+
def cover(session):
71+
"""Run the final coverage report.
72+
73+
This outputs the coverage report aggregating coverage from the unit
74+
test runs (not system test runs), and then erases coverage data.
75+
"""
76+
session.interpreter = 'python3.6'
77+
session.install('coverage', 'pytest-cov')
78+
session.run('coverage', 'report', '--show-missing', '--fail-under=100')
79+
session.run('coverage', 'erase')

pubsub/tests/__init__.py

Whitespace-only changes.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
from google.cloud.environment_vars import PUBSUB_EMULATOR
2424
from google.cloud.pubsub import client
2525

26-
from retry import RetryInstanceState
27-
from retry import RetryResult
28-
from retry import RetryErrors
29-
from system_test_utils import EmulatorCreds
30-
from system_test_utils import unique_resource_id
26+
from test_utils.retry import RetryInstanceState
27+
from test_utils.retry import RetryResult
28+
from test_utils.retry import RetryErrors
29+
from test_utils.system import EmulatorCreds
30+
from test_utils.system import unique_resource_id
3131

3232

3333
def _unavailable(exc):

0 commit comments

Comments
 (0)