blob: 9f448fb18110b20597ced0088a886af4896e6f3e [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
Bu Sun Kim673ec5c2020-11-16 11:05:03 -070016import sys
17
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070018import nox
19
20test_dependencies = [
21 "google-auth",
22 "google-auth-httplib2",
23 "mox",
arithmetic1728981eadf2020-06-02 10:20:10 -070024 "parameterized",
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070025 "pyopenssl",
26 "pytest",
27 "pytest-cov",
28 "webtest",
29 "coverage",
30 "unittest2",
31 "mock",
32]
33
34
35@nox.session(python=["3.7"])
36def lint(session):
37 session.install("flake8")
38 session.run(
39 "flake8",
40 "googleapiclient",
41 "tests",
42 "--count",
43 "--select=E9,F63,F7,F82",
44 "--show-source",
45 "--statistics",
46 )
47
48
Bu Sun Kim790e7022020-09-11 20:18:06 -060049@nox.session(python=["2.7", "3.5", "3.6", "3.7", "3.8"])
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070050@nox.parametrize(
51 "oauth2client",
52 [
53 "oauth2client<2dev",
54 "oauth2client>=2,<=3dev",
55 "oauth2client>=3,<=4dev",
56 "oauth2client>=4,<=5dev",
57 ],
58)
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070059def unit(session, oauth2client):
60 session.install(*test_dependencies)
61 session.install(oauth2client)
62 if session.python < "3.0":
63 session.install("django<2.0.0")
64 else:
65 session.install("django>=2.0.0")
66
67 session.install('.')
68
69 # Run py.test against the unit tests.
70 session.run(
71 "py.test",
72 "--quiet",
73 "--cov=googleapiclient",
74 "--cov=tests",
75 "--cov-append",
76 "--cov-config=.coveragerc",
77 "--cov-report=",
78 "--cov-fail-under=85",
79 "tests",
80 *session.posargs,
arithmetic1728981eadf2020-06-02 10:20:10 -070081 )
Bu Sun Kim673ec5c2020-11-16 11:05:03 -070082
83
84@nox.session(python="3.6")
85def docs(session):
86 session.install('.')
87 session.run("python", "describe.py")