2323
2424LOCAL_DEPS = (os .path .join (".." , "api_core" ), os .path .join (".." , "core" ))
2525
26+ BLACK_PATHS = ["docs" , "google" , "tests" , "noxfile.py" , "setup.py" ]
27+
28+ if os .path .exists ("samples" ):
29+ BLACK_PATHS .append ("samples" )
30+
31+
2632@nox .session (python = "3.7" )
2733def lint (session ):
2834 """Run linters.
@@ -31,13 +37,7 @@ def lint(session):
3137 serious code quality issues.
3238 """
3339 session .install ("flake8" , "black" , * LOCAL_DEPS )
34- session .run (
35- "black" ,
36- "--check" ,
37- "google" ,
38- "tests" ,
39- "docs" ,
40- )
40+ session .run ("black" , "--check" , * BLACK_PATHS )
4141 session .run ("flake8" , "google" , "tests" )
4242
4343
@@ -46,18 +46,13 @@ def blacken(session):
4646 """Run black.
4747
4848 Format code to uniform standard.
49-
49+
5050 This currently uses Python 3.6 due to the automated Kokoro run of synthtool.
5151 That run uses an image that doesn't have 3.6 installed. Before updating this
5252 check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
5353 """
5454 session .install ("black" )
55- session .run (
56- "black" ,
57- "google" ,
58- "tests" ,
59- "docs" ,
60- )
55+ session .run ("black" , * BLACK_PATHS )
6156
6257
6358@nox .session (python = "3.7" )
@@ -83,7 +78,7 @@ def default(session):
8378 "--cov-append" ,
8479 "--cov-config=.coveragerc" ,
8580 "--cov-report=" ,
86- "--cov-fail-under=100 " ,
81+ "--cov-fail-under=0 " ,
8782 os .path .join ("tests" , "unit" ),
8883 * session .posargs ,
8984 )
@@ -140,21 +135,24 @@ def cover(session):
140135
141136 session .run ("coverage" , "erase" )
142137
138+
143139@nox .session (python = "3.7" )
144140def docs (session ):
145141 """Build the docs for this library."""
146142
147- session .install ('-e' , '.' )
148- session .install (' sphinx' , ' alabaster' , ' recommonmark' )
143+ session .install ("-e" , "." )
144+ session .install (" sphinx" , " alabaster" , " recommonmark" )
149145
150- shutil .rmtree (os .path .join (' docs' , ' _build' ), ignore_errors = True )
146+ shutil .rmtree (os .path .join (" docs" , " _build" ), ignore_errors = True )
151147 session .run (
152- 'sphinx-build' ,
153- '-W' , # warnings as errors
154- '-T' , # show full traceback on exception
155- '-N' , # no colors
156- '-b' , 'html' ,
157- '-d' , os .path .join ('docs' , '_build' , 'doctrees' , '' ),
158- os .path .join ('docs' , '' ),
159- os .path .join ('docs' , '_build' , 'html' , '' ),
148+ "sphinx-build" ,
149+ "-W" , # warnings as errors
150+ "-T" , # show full traceback on exception
151+ "-N" , # no colors
152+ "-b" ,
153+ "html" ,
154+ "-d" ,
155+ os .path .join ("docs" , "_build" , "doctrees" , "" ),
156+ os .path .join ("docs" , "" ),
157+ os .path .join ("docs" , "_build" , "html" , "" ),
160158 )
0 commit comments