Skip to content

Commit 2246fc5

Browse files
author
Jon Wayne Parrott
authored
Re-enable lint for tests, remove usage of pylint (#4921)
1 parent 64c38dc commit 2246fc5

File tree

7 files changed

+16
-18
lines changed

7 files changed

+16
-18
lines changed

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
[flake8]
22
exclude =
3+
# Exclude generated code.
4+
**/proto/**
5+
**/gapic/**
6+
*_pb2.py
7+
8+
# Standard linting exemptions.
39
__pycache__,
410
.git,
511
*.pyc,

nox.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,9 @@ def lint(session):
124124
serious code quality issues.
125125
"""
126126
session.interpreter = 'python3.6'
127-
session.install('flake8', 'pylint', 'gcp-devrel-py-tools', *LOCAL_DEPS)
127+
session.install('flake8')
128128
session.install('.')
129-
session.run('flake8', 'google/cloud/logging')
130-
session.run(
131-
'gcp-devrel-py-tools', 'run-pylint',
132-
'--config', 'pylint.config.py',
133-
'--library-filesets', 'google',
134-
'--test-filesets', 'tests',
135-
# Temporarily allow this to fail.
136-
success_codes=range(0, 100))
129+
session.run('flake8', 'google', 'tests')
137130

138131

139132
@nox.session

tests/unit/handlers/test__helpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def get(self):
8080
self.response.out.write(json.dumps(trace_id))
8181

8282

83-
8483
@unittest.skipIf(six.PY3, 'webapp2 is Python 2 only')
8584
class Test_get_trace_id_from_webapp2(unittest.TestCase):
8685

tests/unit/handlers/test_app_engine.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ def test_constructor(self):
3333
from google.cloud.logging.handlers.app_engine import _GAE_PROJECT_ENV
3434
from google.cloud.logging.handlers.app_engine import _GAE_SERVICE_ENV
3535
from google.cloud.logging.handlers.app_engine import _GAE_VERSION_ENV
36-
from google.cloud.logging.handlers.app_engine import _TRACE_ID_LABEL
3736

3837
client = mock.Mock(project=self.PROJECT, spec=['project'])
3938

tests/unit/handlers/test_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def test_emit(self):
3838
from google.cloud.logging.logger import _GLOBAL_RESOURCE
3939

4040
client = _Client(self.PROJECT)
41-
handler = self._make_one(client, transport=_Transport, resource=_GLOBAL_RESOURCE)
41+
handler = self._make_one(
42+
client, transport=_Transport, resource=_GLOBAL_RESOURCE)
4243
logname = 'loggername'
4344
message = 'hello world'
4445
record = logging.LogRecord(logname, logging, None, None, message,

tests/unit/handlers/transports/test_background_thread.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ def __init__(self):
380380
self.commit_called = False
381381
self.commit_count = None
382382

383-
def log_struct(self, info, severity=logging.INFO, resource=None, labels=None):
383+
def log_struct(
384+
self, info, severity=logging.INFO, resource=None, labels=None):
384385
from google.cloud.logging.logger import _GLOBAL_RESOURCE
385386

386387
assert resource is None

tests/unit/test_logger.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,9 @@ def test_log_text_explicit(self):
573573
type='gae_app',
574574
labels={
575575
'module_id': 'default',
576-
'version_id': 'test',
577-
})
576+
'version_id': 'test'
577+
}
578+
)
578579

579580
client = _Client(project=self.PROJECT, connection=_make_credentials())
580581
logger = _Logger()
@@ -632,7 +633,7 @@ def test_log_struct_explicit(self):
632633
timestamp=TIMESTAMP, resource=RESOURCE)
633634
self.assertEqual(
634635
batch.entries,
635-
[('struct', STRUCT, LABELS, IID, SEVERITY, REQUEST, TIMESTAMP ,
636+
[('struct', STRUCT, LABELS, IID, SEVERITY, REQUEST, TIMESTAMP,
636637
RESOURCE)])
637638

638639
def test_log_proto_defaults(self):
@@ -732,7 +733,6 @@ def test_commit_w_bound_client(self):
732733
from google.cloud._helpers import _datetime_to_rfc3339
733734
from google.cloud.logging.logger import _GLOBAL_RESOURCE
734735

735-
736736
TEXT = 'This is the entry text'
737737
STRUCT = {'message': TEXT, 'weather': 'partly cloudy'}
738738
message = Struct(fields={'foo': Value(bool_value=True)})
@@ -825,7 +825,6 @@ def test_context_mgr_success(self):
825825
from google.cloud.logging.logger import Logger
826826
from google.cloud.logging.logger import _GLOBAL_RESOURCE
827827

828-
829828
TEXT = 'This is the entry text'
830829
STRUCT = {'message': TEXT, 'weather': 'partly cloudy'}
831830
message = Struct(fields={'foo': Value(bool_value=True)})

0 commit comments

Comments
 (0)