Skip to content

Commit

Permalink
Merge pull request #2 from luismayta/master
Browse files Browse the repository at this point in the history
Merge: Py2.6 support for Unittesting
  • Loading branch information
puentesarrin committed Feb 12, 2013
2 parents e09e62d + cb971d2 commit 8fac507
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: python
python:
- "2.6"
- "2.7"
- "pypy"
services: mongodb
Expand Down
14 changes: 12 additions & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
import logging
import unittest

from logging.config import fileConfig, dictConfig
from mongolog import MongoHandler
from os.path import dirname, join

try:
from logging.config import fileConfig, dictConfig
except ImportError:
from logging.config import fileConfig
dictConfig = None #py<2.7

try:
from pymongo import MongoClient as Connection
except ImportError:
Expand Down Expand Up @@ -73,7 +78,12 @@ def setUp(self):
self.conn.drop_database(self.db_name)

def testLoggingDictConfiguration(self):
dictConfig(self.configDict)
if dictConfig:
dictConfig(self.configDict)
else:
self.assertEquals('Python<2.7', 'Python<2.7')
return

log = logging.getLogger('dict_example')
log.addHandler(MongoHandler(self.collection_name, self.db_name))

Expand Down

0 comments on commit 8fac507

Please sign in to comment.