blob: d5bc2b307439fc2f41b0c446d086010cccf03e80 [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",
arithmetic1728981eadf2020-06-02 10:20:10 -070022 "parameterized",
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070023 "pyopenssl",
24 "pytest",
25 "pytest-cov",
26 "webtest",
27 "coverage",
28 "unittest2",
29 "mock",
30]
31
32
33@nox.session(python=["3.7"])
34def lint(session):
35 session.install("flake8")
36 session.run(
37 "flake8",
38 "googleapiclient",
39 "tests",
40 "--count",
41 "--select=E9,F63,F7,F82",
42 "--show-source",
43 "--statistics",
44 )
45
46
Bu Sun Kim4ed7d3f2020-05-27 12:20:54 -070047@nox.session(python=["2.7", "3.5", "3.6", "3.7"])
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070048@nox.parametrize(
49 "oauth2client",
50 [
51 "oauth2client<2dev",
52 "oauth2client>=2,<=3dev",
53 "oauth2client>=3,<=4dev",
54 "oauth2client>=4,<=5dev",
55 ],
56)
Bu Sun Kimf706cfd2020-04-20 14:05:05 -070057def unit(session, oauth2client):
58 session.install(*test_dependencies)
59 session.install(oauth2client)
60 if session.python < "3.0":
61 session.install("django<2.0.0")
62 else:
63 session.install("django>=2.0.0")
64
65 session.install('.')
66
67 # Run py.test against the unit tests.
68 session.run(
69 "py.test",
70 "--quiet",
71 "--cov=googleapiclient",
72 "--cov=tests",
73 "--cov-append",
74 "--cov-config=.coveragerc",
75 "--cov-report=",
76 "--cov-fail-under=85",
77 "tests",
78 *session.posargs,
arithmetic1728981eadf2020-06-02 10:20:10 -070079 )