Skip to content

Commit 063e54b

Browse files
committed
Merge pull request #17 from EvaSDK/unittest-cleanup
Unittest cleanup
2 parents 7d652d2 + fdd3ab5 commit 063e54b

File tree

11 files changed

+51
-30
lines changed

11 files changed

+51
-30
lines changed

.coveragerc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# http://nedbatchelder.com/code/coverage/config.html#config
2+
3+
[run]
4+
branch = True
5+
omit = */tests/*
6+
7+
[report]
8+
omit = */tests/*

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: python
2+
python:
3+
- "2.6"
4+
- "2.7"
5+
- "3.2"
6+
- "3.3"
7+
- "3.4"
8+
# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
9+
install:
10+
- "pip install --use-mirrors -e ."
11+
- "pip install coverage coveralls"
12+
script:
13+
- "python ./setup.py nosetests"
14+
after_success:
15+
- coveralls

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# A Python structured logger for Fluentd
22

3+
[![Build Status](https://travis-ci.org/EvaSDK/fluent-logger-python.svg?branch=master)](https://travis-ci.org/EvaSDK/fluent-logger-python)
4+
[![Coverage Status](https://coveralls.io/repos/EvaSDK/fluent-logger-python/badge.png)](https://coveralls.io/r/EvaSDK/fluent-logger-python)
35

46
Many web/mobile applications generate huge amount of event logs (c,f. login, logout, purchase, follow, etc). To analyze these event logs could be really valuable for improving the service. However, the challenge is collecting these logs easily and reliably.
57

fluent/handler.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55

66
try:
77
import simplejson as json
8-
except ImportError:
8+
except ImportError: # pragma: no cover
99
import json
1010

11+
try:
12+
basestring
13+
except NameError: # pragma: no cover
14+
basestring = (str, bytes)
15+
1116
from fluent import sender
1217

1318

@@ -75,4 +80,4 @@ def close(self):
7580
self.sender._close()
7681
logging.Handler.close(self)
7782
finally:
78-
self.release()
83+
self.release()

run_tests.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

setup.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[nosetests]
2+
match = ^test_
3+
cover-package = fluent
4+
with-coverage = 1
5+
cover-erase = 1
6+
cover-branches = 1
7+
cover-inclusive = 1
8+
cover-min-percentage = 70

tests/__init__.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +0,0 @@
1-
# -*- coding: utf-8 -*-
2-
3-
from tests.test_event import *
4-
from tests.test_handler import *
5-
from tests.test_sender import *
6-
from tests.test_unix_domain_socket_sender import *

tests/test_event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
class TestEvent(unittest.TestCase):
12-
def testLogging(self):
12+
def test_logging(self):
1313
# send event with tag app.follow
1414
event.Event('follow', {
1515
'from': 'userA',

tests/test_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ def test_simple(self):
4242
eq('app.follow', data[0][0])
4343
eq('userA', data[0][2]['from'])
4444
eq('userB', data[0][2]['to'])
45-
self.assert_(data[0][1])
46-
self.assert_(isinstance(data[0][1], int))
45+
self.assertTrue(data[0][1])
46+
self.assertTrue(isinstance(data[0][1], int))

tests/test_sender.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ def test_simple(self):
3232
eq(3, len(data[0]))
3333
eq('test.foo', data[0][0])
3434
eq({'bar': 'baz'}, data[0][2])
35-
self.assert_(data[0][1])
36-
self.assert_(isinstance(data[0][1], int))
35+
self.assertTrue(data[0][1])
36+
self.assertTrue(isinstance(data[0][1], int))

0 commit comments

Comments
 (0)