blob: 71467382eff6f717c95836d5daca6308cb204529 [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 = [
Bu Sun Kim8325d242020-12-09 12:04:05 -070021 "django>=2.0.0",
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070022 "google-auth",
23 "google-auth-httplib2",
24 "mox",
arithmetic1728981eadf2020-06-02 10:20:10 -070025 "parameterized",
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070026 "pyopenssl",
27 "pytest",
28 "pytest-cov",
29 "webtest",
30 "coverage",
31 "unittest2",
32 "mock",
33]
34
35
36@nox.session(python=["3.7"])
37def lint(session):
38 session.install("flake8")
39 session.run(
40 "flake8",
41 "googleapiclient",
42 "tests",
43 "--count",
44 "--select=E9,F63,F7,F82",
45 "--show-source",
46 "--statistics",
47 )
48
49
Bu Sun Kim8325d242020-12-09 12:04:05 -070050@nox.session(python=["3.6", "3.7", "3.8", "3.9"])
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070051@nox.parametrize(
52 "oauth2client",
53 [
54 "oauth2client<2dev",
55 "oauth2client>=2,<=3dev",
56 "oauth2client>=3,<=4dev",
57 "oauth2client>=4,<=5dev",
58 ],
59)
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070060def unit(session, oauth2client):
61 session.install(*test_dependencies)
62 session.install(oauth2client)
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070063 session.install('.')
64
65 # Run py.test against the unit tests.
66 session.run(
67 "py.test",
68 "--quiet",
69 "--cov=googleapiclient",
70 "--cov=tests",
71 "--cov-append",
72 "--cov-config=.coveragerc",
73 "--cov-report=",
74 "--cov-fail-under=85",
75 "tests",
76 *session.posargs,
arithmetic1728981eadf2020-06-02 10:20:10 -070077 )
Bu Sun Kim673ec5c2020-11-16 11:05:03 -070078
79
80@nox.session(python="3.6")
81def docs(session):
82 session.install('.')
83 session.run("python", "describe.py")