File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,19 +68,41 @@ def cover(session):
6868 session .run ("coverage" , "erase" )
6969
7070
71+ def run_black (session , use_check = False ):
72+ args = ["black" ]
73+ if use_check :
74+ args .append ("--check" )
75+
76+ args .extend (
77+ [
78+ "--line-length=79" ,
79+ get_path ("docs" ),
80+ get_path ("noxfile.py" ),
81+ get_path ("src" ),
82+ get_path ("tests" ),
83+ ]
84+ )
85+
86+ session .run (* args )
87+
88+
89+ @nox .session (py = DEFAULT_INTERPRETER )
90+ def lint (session ):
91+ """Run linters.
92+ Returns a failure if the linters find linting errors or sufficiently
93+ serious code quality issues.
94+ """
95+ session .install ("flake8" , "black" )
96+ run_black (session , use_check = True )
97+ session .run ("flake8" , "google" , "tests" )
98+
99+
71100@nox .session (py = DEFAULT_INTERPRETER )
72101def blacken (session ):
73102 # Install all dependencies.
74103 session .install ("black" )
75104 # Run ``black``.
76- session .run (
77- "black" ,
78- "--line-length=79" ,
79- get_path ("docs" ),
80- get_path ("noxfile.py" ),
81- get_path ("src" ),
82- get_path ("tests" ),
83- )
105+ run_black (session )
84106
85107
86108@nox .session (py = DEFAULT_INTERPRETER )
Original file line number Diff line number Diff line change @@ -1370,7 +1370,7 @@ def test_compare_valid():
13701370 def test_compare_invalid ():
13711371 prop = model .ModelKey ()
13721372 with pytest .raises (exceptions .BadValueError ):
1373- prop == None
1373+ prop == None # noqa: E711
13741374
13751375 @staticmethod
13761376 def test__validate ():
Original file line number Diff line number Diff line change @@ -51,13 +51,13 @@ class TestParameterizedThing:
5151 def test___eq__ ():
5252 thing = query .ParameterizedThing ()
5353 with pytest .raises (NotImplementedError ):
54- thing == None
54+ thing == unittest . mock . sentinel . other
5555
5656 @staticmethod
5757 def test___ne__ ():
5858 thing = query .ParameterizedThing ()
5959 with pytest .raises (NotImplementedError ):
60- thing != None
60+ thing != unittest . mock . sentinel . other
6161
6262
6363class TestParameter :
@@ -143,12 +143,12 @@ def _make_one():
143143 def test___eq__ (self ):
144144 node = self ._make_one ()
145145 with pytest .raises (NotImplementedError ):
146- node == None
146+ node == unittest . mock . sentinel . other
147147
148148 def test___ne__ (self ):
149149 node = self ._make_one ()
150150 with pytest .raises (NotImplementedError ):
151- node != None
151+ node != unittest . mock . sentinel . other
152152
153153 def test___le__ (self ):
154154 node = self ._make_one ()
Original file line number Diff line number Diff line change 1717import pytest
1818
1919from google .cloud .ndb import utils
20- import tests .unit .utils
2120
2221
2322def test___all__ ():
You can’t perform that action at this time.
0 commit comments