Browse Source

Merge "pep8: Turn on E305"

tags/2.25.0
Zuul 3 months ago
committed by Gerrit Code Review
parent
commit
a495f1e327
30 changed files with 32 additions and 2 deletions
  1. +1
    -0
      swift/common/linkat.py
  2. +2
    -0
      swift/common/splice.py
  3. +2
    -0
      swift/common/utils.py
  4. +1
    -0
      test/functional/__init__.py
  5. +1
    -0
      test/functional/s3api/test_multi_upload.py
  6. +1
    -0
      test/functional/s3api/test_service.py
  7. +1
    -0
      test/probe/test_empty_device_handoff.py
  8. +1
    -0
      test/unit/__init__.py
  9. +1
    -0
      test/unit/cli/test_form_signature.py
  10. +1
    -0
      test/unit/common/middleware/crypto/test_kms_keymaster.py
  11. +1
    -0
      test/unit/common/middleware/s3api/test_cfg.py
  12. +1
    -0
      test/unit/common/middleware/s3api/test_logging.py
  13. +1
    -0
      test/unit/common/middleware/s3api/test_multi_delete.py
  14. +1
    -0
      test/unit/common/middleware/s3api/test_s3_acl.py
  15. +1
    -0
      test/unit/common/middleware/s3api/test_service.py
  16. +1
    -0
      test/unit/common/middleware/s3api/test_subresource.py
  17. +1
    -0
      test/unit/common/middleware/s3api/test_utils.py
  18. +1
    -0
      test/unit/common/middleware/test_account_quotas.py
  19. +1
    -0
      test/unit/common/middleware/test_keystoneauth.py
  20. +1
    -0
      test/unit/common/middleware/test_name_check.py
  21. +1
    -0
      test/unit/common/middleware/test_quotas.py
  22. +1
    -0
      test/unit/common/middleware/test_tempauth.py
  23. +1
    -0
      test/unit/common/test_direct_client.py
  24. +1
    -0
      test/unit/common/test_exceptions.py
  25. +1
    -0
      test/unit/common/test_internal_client.py
  26. +1
    -0
      test/unit/common/test_manager.py
  27. +1
    -0
      test/unit/container/test_updater.py
  28. +1
    -0
      test/unit/obj/test_diskfile.py
  29. +1
    -0
      test/unit/obj/test_replicator.py
  30. +1
    -2
      tox.ini

+ 1
- 0
swift/common/linkat.py View File

@@ -79,5 +79,6 @@ class Linkat(object):

return self._c_linkat(olddirfd, oldpath, newdirfd, newpath, flags)


linkat = Linkat()
del Linkat

+ 2
- 0
swift/common/splice.py View File

@@ -98,6 +98,7 @@ class Tee(object):

return self._c_tee is not None


tee = Tee()
del Tee

@@ -195,5 +196,6 @@ class Splice(object):

return self._c_splice is not None


splice = Splice()
del Splice

+ 2
- 0
swift/common/utils.py View File

@@ -138,6 +138,7 @@ def NR_ioprio_set():
raise OSError("Swift doesn't support ionice priority for %s %s" %
(architecture, arch_bits))


# this syscall integer probably only works on x86_64 linux systems, you
# can check if it's correct on yours with something like this:
"""
@@ -169,6 +170,7 @@ IOPRIO_CLASS_SHIFT = 13
def IOPRIO_PRIO_VALUE(class_, data):
return (((class_) << IOPRIO_CLASS_SHIFT) | data)


# Used by hash_path to offer a bit more security when generating hashes for
# paths. It simply appends this value to all paths; guessing the hash a path
# will end up with would also require knowing this suffix.


+ 1
- 0
test/functional/__init__.py View File

@@ -725,6 +725,7 @@ def in_process_setup(the_object_server=object_server):
create_account('AUTH_test')
create_account('AUTH_test2')


cluster_info = {}




+ 1
- 0
test/functional/s3api/test_multi_upload.py View File

@@ -1105,5 +1105,6 @@ class TestS3ApiMultiUploadSigV4(TestS3ApiMultiUpload):
self.conn.make_request('DELETE', bucket)
self.assertEqual(status, 204) # sanity


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/functional/s3api/test_service.py View File

@@ -96,5 +96,6 @@ class TestS3ApiServiceSigV4(TestS3ApiService):
def setUp(self):
super(TestS3ApiServiceSigV4, self).setUp()


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/probe/test_empty_device_handoff.py View File

@@ -172,5 +172,6 @@ class TestEmptyDevice(ReplProbeTest):
else:
self.fail("Expected ClientException but didn't get it")


if __name__ == '__main__':
main()

+ 1
- 0
test/unit/__init__.py View File

@@ -64,6 +64,7 @@ import unittest
class SkipTest(unittest.SkipTest):
pass


EMPTY_ETAG = md5().hexdigest()

# try not to import this module from swift


+ 1
- 0
test/unit/cli/test_form_signature.py View File

@@ -111,5 +111,6 @@ class TestFormSignature(unittest.TestCase):
'-922337203685477580799999999999999', key])
self.assertNotEqual(exitcode, 0)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/crypto/test_kms_keymaster.py View File

@@ -89,6 +89,7 @@ def mock_keystone_password_side_effect(auth_url, username, password,
user_domain_id, trust_id, domain_id, domain_name,
project_id, project_domain_id, reauthenticate)


ERR_MESSAGE_SECRET_INCORRECTLY_SPECIFIED = 'Secret incorrectly specified.'
ERR_MESSAGE_KEY_UUID_NOT_FOUND = 'Key not found, uuid: '



+ 1
- 0
test/unit/common/middleware/s3api/test_cfg.py View File

@@ -40,5 +40,6 @@ class TestS3ApiCfg(unittest.TestCase):
self.assertEqual(conf['b'], 100)
self.assertEqual(conf['c'], False)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/s3api/test_logging.py View File

@@ -62,5 +62,6 @@ class TestS3ApiLogging(S3ApiTestCase):
status, headers, body = self.call_s3api(req)
self.assertEqual(self._get_error_code(body), 'NoLoggingStatusForKey')


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/s3api/test_multi_delete.py View File

@@ -531,5 +531,6 @@ class TestS3ApiMultiDelete(S3ApiTestCase):
self._test_no_body(use_transfer_encoding=True)
self._test_no_body(use_transfer_encoding=True, string_to_md5=b'test')


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/s3api/test_s3_acl.py View File

@@ -537,5 +537,6 @@ class TestS3ApiS3Acl(S3ApiTestCase):
self.assertRaises(TypeError, fake_class.s3acl_s3only_error)
self.assertIsNone(fake_class.s3acl_s3only_no_error())


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/s3api/test_service.py View File

@@ -233,5 +233,6 @@ class TestS3ApiService(S3ApiTestCase):
self.assertTrue(i[0] in names)
self.assertEqual(len(self.swift.calls_with_headers), 11)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/s3api/test_subresource.py View File

@@ -363,5 +363,6 @@ class TestS3ApiSubresource(unittest.TestCase):
func = lambda: '' in grantee
self.assertRaises(S3NotImplemented, func)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/s3api/test_utils.py View File

@@ -129,5 +129,6 @@ class TestS3ApiUtils(unittest.TestCase):
os.environ['TZ'] = orig_tz
time.tzset()


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/test_account_quotas.py View File

@@ -521,5 +521,6 @@ class AccountQuotaCopyingTestCases(unittest.TestCase):
res = req.get_response(self.copy_filter)
self.assertEqual(res.status_int, 412)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/test_keystoneauth.py View File

@@ -1609,5 +1609,6 @@ class PrefixAccount(unittest.TestCase):
self.assertFalse(test_auth._account_matches_tenant(
'PRE2_1234', '5678'))


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/test_name_check.py View File

@@ -147,5 +147,6 @@ class TestSwiftInfo(unittest.TestCase):
self.assertEqual(swift_info['name_check'].get('forbidden_regexp'),
r"/\./|/\.\./|/\.$")


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/test_quotas.py View File

@@ -356,5 +356,6 @@ class ContainerQuotaCopyingTestCases(unittest.TestCase):
res = req.get_response(self.copy_filter)
self.assertEqual(res.status_int, 200)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/middleware/test_tempauth.py View File

@@ -1828,5 +1828,6 @@ class TestUtilityMethods(unittest.TestCase):
req = Request({'PATH_INFO': '/'})
self.assertRaises(ValueError, auth_inst.account_acls, req)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/test_direct_client.py View File

@@ -922,5 +922,6 @@ class TestUTF8DirectClient(TestDirectClient):
self.container = self.container.encode('utf-8')
self.obj = self.obj.encode('utf-8')


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/test_exceptions.py View File

@@ -46,5 +46,6 @@ class TestExceptions(unittest.TestCase):
http_response_content='content')
self.assertEqual(str(exc), strerror)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/test_internal_client.py View File

@@ -1691,5 +1691,6 @@ class TestSimpleClient(unittest.TestCase):
# See above
self.assertEqual('https', args[0].type)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/common/test_manager.py View File

@@ -2279,5 +2279,6 @@ class TestManager(unittest.TestCase):
self.assertEqual(status, 0)
self.assertEqual(m.cmd_was_called, True)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/container/test_updater.py View File

@@ -528,5 +528,6 @@ class TestContainerUpdater(unittest.TestCase):
self.assertEqual(info['reported_object_count'], 0)
self.assertEqual(info['reported_bytes_used'], 0)


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/obj/test_diskfile.py View File

@@ -8388,5 +8388,6 @@ class TestHashesHelpers(unittest.TestCase):
result = diskfile.read_hashes(self.testdir)
self.assertFalse(result['valid'])


if __name__ == '__main__':
unittest.main()

+ 1
- 0
test/unit/obj/test_replicator.py View File

@@ -73,6 +73,7 @@ def mock_http_connect(status):
return
return lambda *args, **kwargs: FakeConn(status, *args, **kwargs)


process_errors = []




+ 1
- 2
tox.ini View File

@@ -129,13 +129,12 @@ commands = bandit -c bandit.yaml -r swift -n 5
# H501: Do not use self.__dict__ for string formatting
# Disabled with going to hacking 2.0, needs further investigation and
# changes to enable:
# E305 expected 2 blank lines after class or function definition, found 1
# E402: module level import not at top of file
# E731 do not assign a lambda expression, use a def
# Swift team needs to decide if they want to enable either of these:
# W503: line break before binary operator
# W504: line break after binary operator
ignore = H101,H202,H301,H306,H404,H405,H501,W503,W504,E305,E402,E731
ignore = H101,H202,H301,H306,H404,H405,H501,W503,W504,E402,E731
exclude = .venv,.tox,dist,*egg
filename = *.py,bin/*
show-source = True


Loading…
Cancel
Save