test_config.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:ozelot 作者: trycs 项目源码 文件源码
def test_value_override(self):
        """Test overriding a default value

        The project config of the logging module sets the log level to 'DEBUG' and defines some other testing values.
        """
        # reload the config module to make sure we get a fresh instance (nose shares module state between tests)
        imp.reload(config)

        self.assertEquals(config.LOG_LEVEL, logging.DEBUG)
        # noinspection PyUnresolvedReferences
        self.assertEquals(config.LOG_LEVEL_DEFAULT, logging.INFO)

        # this variable does not exist originally and does not have a backup of the default value
        # noinspection PyUnresolvedReferences
        self.assertEquals(config.TESTING_VARIABLE, 123)

        # # we could test for 'TESTING_VARIABLE_DEFAULT' not being set; however, the 'reload' statement
        # # above causes the testing variable to also be copied to 'TESTING_VARIABLE_DEFAULT'
        # self.assertIsNone(getattr(config, 'TESTING_VARIABLE_DEFAULT', None))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号