From e7a9f4dcc8db115f2a3838fb4208ac1643fac2b7 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Wed, 8 Jun 2016 23:12:03 -0400 Subject: [PATCH] Marks warnings in tests as errors. --- tests/__init__.py | 8 ++++++++ tests/test_filtering.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/__init__.py b/tests/__init__.py index fc99f6b6..b1eda0cb 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -23,3 +23,11 @@ ``python setup.py test``). """ +import sys +import warnings + +# Convert Python warnings into errors on tests, but only if Python +# version 2.7 or greater; on Python 2.6, unittest2 gives a +# RuntimeWarning when trying to skip a test. +if sys.version_info >= (2, 7): + warnings.simplefilter('error') diff --git a/tests/test_filtering.py b/tests/test_filtering.py index 0c3efe59..ecc6170b 100644 --- a/tests/test_filtering.py +++ b/tests/test_filtering.py @@ -949,7 +949,7 @@ def test_to_many_filter_by_relation(self): self.session.add(article) for i in range(1, 3): comment = self.Comment(id=i) - tag = self.Tag(name=str(i)) + tag = self.Tag(name=u'{0}'.format(i)) comment.article = article comment.tag = tag self.session.add_all([comment, tag])