blob: 438ff41c5851c85be2974b199e8cc2ef387ebdcd [file] [log] [blame]
Bu Sun Kimf706cfd2020-04-20 14:05:05 -07001
2# Copyright 2020 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16import nox
17
18test_dependencies = [
19 "google-auth",
20 "google-auth-httplib2",
21 "mox",
22 "pyopenssl",
23 "pytest",
24 "pytest-cov",
25 "webtest",
26 "coverage",
27 "unittest2",
28 "mock",
29]
30
31
32@nox.session(python=["3.7"])
33def lint(session):
34 session.install("flake8")
35 session.run(
36 "flake8",
37 "googleapiclient",
38 "tests",
39 "--count",
40 "--select=E9,F63,F7,F82",
41 "--show-source",
42 "--statistics",
43 )
44
45
46@nox.parametrize(
47 "oauth2client",
48 [
49 "oauth2client<2dev",
50 "oauth2client>=2,<=3dev",
51 "oauth2client>=3,<=4dev",
52 "oauth2client>=4,<=5dev",
53 ],
54)
55@nox.session(python=["2.7", "3.5", "3.6", "3.7"])
56def unit(session, oauth2client):
57 session.install(*test_dependencies)
58 session.install(oauth2client)
59 if session.python < "3.0":
60 session.install("django<2.0.0")
61 else:
62 session.install("django>=2.0.0")
63
64 session.install('.')
65
66 # Run py.test against the unit tests.
67 session.run(
68 "py.test",
69 "--quiet",
70 "--cov=googleapiclient",
71 "--cov=tests",
72 "--cov-append",
73 "--cov-config=.coveragerc",
74 "--cov-report=",
75 "--cov-fail-under=85",
76 "tests",
77 *session.posargs,
78 )