Skip to content

Commit

Permalink
Fix test script mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
fossilet committed Oct 1, 2013
1 parent 019aff9 commit e24d20e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
language: python
python:
- "2.7"
script: test/test.py
# Prevent traceback printing for doctest to correctly run.
script: test/test.py 2>/dev/null
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# exception-notifier
# exception-notifier [![Build Status](https://travis-ci.org/fossilet/exception-notifier.png?branch=master)](https://travis-ci.org/fossilet/exception-notifier)


Notify uncaught exceptions in your Python code.

Expand Down
10 changes: 8 additions & 2 deletions test/test.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#! /usr/bin/env python

"""Test script.
Expand All @@ -11,6 +13,8 @@

import sys

# Must run from the project root.
sys.path.insert(0, '.')
import exception_notifier


Expand All @@ -26,7 +30,9 @@ def exc_handler_ret():
"""An exception handler that returns something other than None."""
return 'DIV_BY_ZERO'

@exception_notifier.mail_exception(callback=exc_handler, both=True)
# Email sending is not tested since it is impossible to send email on Travis
# server.
@exception_notifier.mail_exception(callback=exc_handler)
def f(x, y):
return x / y

Expand All @@ -43,4 +49,4 @@ def g(x, y):
assert g(1, 0) == 'DIV_BY_ZERO'

import doctest
doctest.testmod()
doctest.testmod(raise_on_error=True)

0 comments on commit e24d20e

Please sign in to comment.