|
33 | 33 | 'webob', |
34 | 34 | ) |
35 | 35 |
|
| 36 | +@nox.session(python="3.7") |
| 37 | +def blacken(session): |
| 38 | + """Run black. |
| 39 | +
|
| 40 | + Format code to uniform standard. |
| 41 | + """ |
| 42 | + session.install("black") |
| 43 | + session.run( |
| 44 | + "black", |
| 45 | + "google", |
| 46 | + "tests", |
| 47 | + "docs", |
| 48 | + "--exclude", |
| 49 | + ".*/proto/.*|.*/gapic/.*|.*/.*_pb2.py", |
| 50 | + ) |
| 51 | + |
| 52 | + |
| 53 | +@nox.session(python="3.7") |
| 54 | +def lint(session): |
| 55 | + """Run linters. |
| 56 | +
|
| 57 | + Returns a failure if the linters find linting errors or sufficiently |
| 58 | + serious code quality issues. |
| 59 | + """ |
| 60 | + session.install("flake8", "black", *LOCAL_DEPS) |
| 61 | + session.run( |
| 62 | + "black", |
| 63 | + "--check", |
| 64 | + "google", |
| 65 | + "tests", |
| 66 | + "docs", |
| 67 | + "--exclude", |
| 68 | + ".*/proto/.*|.*/gapic/.*|.*/.*_pb2.py", |
| 69 | + ) |
| 70 | + session.run("flake8", "google", "tests") |
| 71 | + |
| 72 | + |
| 73 | +@nox.session(python="3.7") |
| 74 | +def lint_setup_py(session): |
| 75 | + """Verify that setup.py is valid (including RST check).""" |
| 76 | + session.install("docutils", "pygments") |
| 77 | + session.run("python", "setup.py", "check", "--restructuredtext", "--strict") |
| 78 | + |
36 | 79 |
|
37 | 80 | def default(session, django_dep=('django',)): |
38 | 81 | """Default unit test session. |
39 | 82 | """ |
40 | | - |
| 83 | + |
41 | 84 | # Install all test dependencies, then install this package in-place. |
42 | 85 | deps = UNIT_TEST_DEPS |
43 | 86 | deps += django_dep |
@@ -114,34 +157,14 @@ def system(session): |
114 | 157 | *session.posargs) |
115 | 158 |
|
116 | 159 |
|
117 | | -@nox.session(python='3.6') |
118 | | -def lint(session): |
119 | | - """Run linters. |
120 | | -
|
121 | | - Returns a failure if the linters find linting errors or sufficiently |
122 | | - serious code quality issues. |
123 | | - """ |
124 | | - session.install('flake8', *LOCAL_DEPS) |
125 | | - session.install('.') |
126 | | - session.run('flake8', 'google', 'tests') |
127 | | - |
128 | | - |
129 | | -@nox.session(python='3.6') |
130 | | -def lint_setup_py(session): |
131 | | - """Verify that setup.py is valid (including RST check).""" |
132 | | - |
133 | | - session.install('docutils', 'Pygments') |
134 | | - session.run( |
135 | | - 'python', 'setup.py', 'check', '--restructuredtext', '--strict') |
136 | | - |
137 | | - |
138 | | -@nox.session(python='3.6') |
| 160 | +@nox.session(python="3.7") |
139 | 161 | def cover(session): |
140 | 162 | """Run the final coverage report. |
141 | 163 |
|
142 | 164 | This outputs the coverage report aggregating coverage from the unit |
143 | 165 | test runs (not system test runs), and then erases coverage data. |
144 | 166 | """ |
145 | | - session.install('coverage', 'pytest-cov') |
146 | | - session.run('coverage', 'report', '--show-missing', '--fail-under=100') |
147 | | - session.run('coverage', 'erase') |
| 167 | + session.install("coverage", "pytest-cov") |
| 168 | + session.run("coverage", "report", "--show-missing", "--fail-under=100") |
| 169 | + |
| 170 | + session.run("coverage", "erase") |
0 commit comments