mirror of
https://github.com/datafolklabs/cement.git
synced 2026-02-06 11:16:46 +00:00
Add Python version to run-tests
This commit is contained in:
parent
fbe52efa34
commit
47242c1652
@ -29,6 +29,10 @@ Features:
|
||||
* :issue:`194` - Added pre_argument_parsing/post_argument_parsing hooks
|
||||
* :issue:`196` - Added utils.misc.wrap
|
||||
|
||||
Incompatible:
|
||||
|
||||
* :issue:`173` - Deprecated 'has_key()' from configparser extension
|
||||
|
||||
|
||||
2.1.2 - Thu Nov 1st, 2012 (DEVELOPMENT)
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
@ -8,7 +8,6 @@ def config_validator(klass, obj):
|
||||
members = [
|
||||
'_setup',
|
||||
'keys',
|
||||
'has_key',
|
||||
'get_sections',
|
||||
'get_section_dict',
|
||||
'get',
|
||||
|
||||
@ -98,38 +98,6 @@ class ConfigParserConfigHandler(config.CementConfigHandler, RawConfigParser):
|
||||
"""
|
||||
return self.options(section)
|
||||
|
||||
def has_key(self, section, key):
|
||||
"""
|
||||
Return whether or not a 'section' has the given 'key'.
|
||||
|
||||
:param section: The section of the configuration.
|
||||
I.e. [block_section].
|
||||
:param key: The key within 'section'.
|
||||
:returns: True if the config `section` has `key`.
|
||||
:rtype: boolean
|
||||
|
||||
*This function is deprecated as of Cement 2.1.1, and will be removed
|
||||
in future versions. Use `if 'key' in config.keys('section')`
|
||||
instead.*
|
||||
"""
|
||||
if self.app._meta.ignore_deprecation_warnings:
|
||||
LOG.debug("ConfigParserConfigHandler.has_key() is " +
|
||||
"deprecated as of Cement 2.1.1. Please use " +
|
||||
"`if key in app.config.keys(section)` " +
|
||||
"instead.")
|
||||
else:
|
||||
LOG.warn("ConfigParserConfigHandler.has_key() is " +
|
||||
"deprecated as of Cement 2.1.1. Please use " +
|
||||
"`if key in app.config.keys(section)` " +
|
||||
"instead. You can disable this warning by setting " +
|
||||
"`ignore_deprecation_warnings = true` under the " +
|
||||
"applications primary config section.")
|
||||
|
||||
if key in self.keys(section):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def get_sections(self):
|
||||
"""
|
||||
Return a list of configuration sections or [blocks].
|
||||
|
||||
@ -88,6 +88,8 @@ class CementDevtoolsController(CementBaseController):
|
||||
|
||||
@expose(help='run all unit tests')
|
||||
def run_tests(self):
|
||||
print('')
|
||||
print('Python Version: %s' % sys.version)
|
||||
print('')
|
||||
print("Running Tests for Cement Version %s" % VERSION)
|
||||
print('-' * 77)
|
||||
|
||||
@ -3,18 +3,4 @@ from cement.utils import test
|
||||
from cement.utils.misc import init_defaults
|
||||
|
||||
class ConfigParserConfigHandlerTestCase(test.CementTestCase):
|
||||
def test_has_key(self):
|
||||
defaults = init_defaults('test')
|
||||
defaults['test']['foo'] = 'bar'
|
||||
app = self.make_app(config_defaults=defaults)
|
||||
app.setup()
|
||||
self.eq(app.config.has_key('test', 'bogus'), False)
|
||||
self.eq(app.config.has_key('test', 'foo'), True)
|
||||
|
||||
# same thing but ignore deprecation warning
|
||||
app = self.make_app(
|
||||
config_defaults=defaults,
|
||||
ignore_deprecation_warnings=True
|
||||
)
|
||||
app.setup()
|
||||
self.eq(app.config.has_key('test', 'bogus'), False)
|
||||
pass
|
||||
Loading…
Reference in New Issue
Block a user