Skip to content

Commit 81591e4

Browse files
author
Nick Groenen
committed
Quiet tests
This disables the console logger on the test backend so that tests which pass do not spew their output. As nose captures logging already, you'll only see the relevant logging for tests which fail, making it a lot easier to find what is wrong.
1 parent b629316 commit 81591e4

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

errbot/backends/test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ def setUpClass(cls, extra_test_file=None):
122122
file = logging.FileHandler(config_module.BOT_LOG_FILE, encoding='utf-8')
123123
logger = logging.getLogger('')
124124
logger.setLevel(logging.DEBUG)
125-
logger.addHandler(console)
126125
logger.addHandler(file)
127126
if extra_test_file:
128127
import config
@@ -144,4 +143,4 @@ def assertCommand(self, command, response, timeout=5):
144143

145144
def assertCommandFound(self, command, timeout=5):
146145
pushMessage(command)
147-
self.assertNotIn('not found', popMessage(), timeout)
146+
self.assertNotIn('not found', popMessage(), timeout)

run_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
if not PY3: # hack the path system to take the python 2 converted sources
1818
print('Changing root to ' + py2_root)
1919
print('Sys path ' + ', '.join(sys.path))
20-
if nose.run('tests', argv=['-v', '-w', py2_root]):
20+
if nose.run('tests', argv=['-w', py2_root]):
2121
exit(0) # no error
2222
else:
2323
if nose.run('tests'):

tests/webhooks_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
from errbot.backends.test import FullStackTest, pushMessage, popMessage
22
import requests
33
from errbot import PY2
4+
from time import sleep
45

56

67
class TestWebhooks(FullStackTest):
78
@classmethod
89
def setUpClass(cls, extra_test_file=None):
910
super(TestWebhooks, cls).setUpClass()
11+
# Give the rocket webserver just a fraction of extra time to initialize
12+
# Was getting 50/50 chance of test failures (Connection refused) without this delay
13+
sleep(0.1)
1014
pushMessage("!config Webserver {'HOST': 'localhost', 'PORT': 3141, 'SSL': None}")
1115
popMessage()
1216

0 commit comments

Comments
 (0)