Browse Source

Merge "Switch to hacking 2.x"

tags/4.1.0^0
Zuul 4 months ago
committed by Gerrit Code Review
parent
commit
d03794b524
6 changed files with 18 additions and 15 deletions
  1. +1
    -1
      lower-constraints.txt
  2. +1
    -0
      oslo_log/log.py
  3. +1
    -0
      oslo_log/rate_limit.py
  4. +12
    -12
      oslo_log/tests/unit/test_log.py
  5. +1
    -1
      test-requirements.txt
  6. +2
    -1
      tox.ini

+ 1
- 1
lower-constraints.txt View File

@@ -13,7 +13,7 @@ fixtures==3.0.0
flake8==2.5.5
gitdb2==2.0.3
GitPython==2.1.8
hacking==0.12.0
hacking==2.0.0
idna==2.6
imagesize==1.0.0
iso8601==0.1.12


+ 1
- 0
oslo_log/log.py View File

@@ -455,6 +455,7 @@ def _setup_logging_from_conf(conf, project, version):
conf.rate_limit_interval,
conf.rate_limit_except)


_loggers = {}




+ 1
- 0
oslo_log/rate_limit.py View File

@@ -132,6 +132,7 @@ def install_filter(burst, interval, except_level='CRITICAL'):
for logger in _iter_loggers():
logger.addFilter(log_filter)


install_filter.log_filter = None
install_filter.logger_class = None



+ 12
- 12
oslo_log/tests/unit/test_log.py View File

@@ -396,9 +396,9 @@ class OSJournalHandlerTestCase(BaseTestCase):
log.setup(self.CONF, 'testing')

def test_emit(self):
l = log.getLogger('nova-test.foo')
logger = log.getLogger('nova-test.foo')
local_context = _fake_new_context()
l.info("Foo", context=local_context)
logger.info("Foo", context=local_context)
self.assertEqual(
mock.call(mock.ANY, CODE_FILE=mock.ANY, CODE_FUNC='test_emit',
CODE_LINE=mock.ANY, LOGGER_LEVEL='INFO',
@@ -421,12 +421,12 @@ class OSJournalHandlerTestCase(BaseTestCase):
self.assertIsInstance(arg, six.string_types + (six.binary_type,))

def test_emit_exception(self):
l = log.getLogger('nova-exception.foo')
logger = log.getLogger('nova-exception.foo')
local_context = _fake_new_context()
try:
raise Exception("Some exception")
except Exception:
l.exception("Foo", context=local_context)
logger.exception("Foo", context=local_context)
self.assertEqual(
mock.call(mock.ANY, CODE_FILE=mock.ANY,
CODE_FUNC='test_emit_exception',
@@ -485,12 +485,12 @@ class LogLevelTestCase(BaseTestCase):
self.assertEqual(log.TRACE, self.log_trace.logger.getEffectiveLevel())

def test_child_log_has_level_of_parent_flag(self):
l = log.getLogger('nova-test.foo')
self.assertEqual(logging.INFO, l.logger.getEffectiveLevel())
logger = log.getLogger('nova-test.foo')
self.assertEqual(logging.INFO, logger.logger.getEffectiveLevel())

def test_child_log_has_level_of_parent_flag_for_trace(self):
l = log.getLogger('nova-trace.foo')
self.assertEqual(log.TRACE, l.logger.getEffectiveLevel())
logger = log.getLogger('nova-trace.foo')
self.assertEqual(log.TRACE, logger.logger.getEffectiveLevel())

def test_get_loggers(self):
log._loggers['sentinel_log'] = mock.sentinel.sentinel_log
@@ -1940,14 +1940,14 @@ class LoggerNameTestCase(LoggerTestCase):

def test_oslo_dot(self):
logger_name = 'oslo.subname'
l = log.getLogger(logger_name)
self.assertEqual(logger_name, l.logger.name)
logger = log.getLogger(logger_name)
self.assertEqual(logger_name, logger.logger.name)

def test_oslo_underscore(self):
logger_name = 'oslo_subname'
expected = logger_name.replace('_', '.')
l = log.getLogger(logger_name)
self.assertEqual(expected, l.logger.name)
logger = log.getLogger(logger_name)
self.assertEqual(expected, logger.logger.name)


class IsDebugEnabledTestCase(test_base.BaseTestCase):


+ 1
- 1
test-requirements.txt View File

@@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.

hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=2.0.0,<2.1.0 # Apache-2.0

stestr>=2.0.0 # Apache-2.0
testtools>=2.3.0 # MIT


+ 2
- 1
tox.ini View File

@@ -62,8 +62,9 @@ deps =

[flake8]
# E123, E125 skipped as they are invalid PEP-8.
# W503, W504 skipped: https://www.python.org/dev/peps/pep-0008/#should-a-line-break-before-or-after-a-binary-operator
show-source = True
ignore = E123,E125,H405
ignore = E123,E125,H405,W503,W504
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,__init__.py

[hacking]


Loading…
Cancel
Save