From 4f2d3d783a37ea2fffc988c42e8c67e36a6bfeef Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 1 Oct 2015 15:08:46 -0400 Subject: [PATCH] TEST: Template in module name. Fixes failures when tests are invoked from different paths. --- tests/utils/test_preprocess.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/utils/test_preprocess.py b/tests/utils/test_preprocess.py index 2e39e3c0..b76538e9 100644 --- a/tests/utils/test_preprocess.py +++ b/tests/utils/test_preprocess.py @@ -175,8 +175,9 @@ class PreprocessTestCase(TestCase): foo(not_int(1), 2, 3) self.assertEqual( e.exception.args[0], - "tests.utils.test_preprocess.foo() expected a value of type " + "{modname}.foo() expected a value of type " "int for argument 'a', but got {t} instead.".format( + modname=foo.__module__, t=not_int.__name__, ) ) @@ -197,9 +198,9 @@ class PreprocessTestCase(TestCase): foo('1') expected_message = ( - "tests.utils.test_preprocess.foo() expected a value of " + "{modname}.foo() expected a value of " "type int or float for argument 'a', but got str instead." - ) + ).format(modname=foo.__module__) self.assertEqual(e.exception.args[0], expected_message) def test_expect_optional_types(self): @@ -219,7 +220,7 @@ class PreprocessTestCase(TestCase): foo('1') expected_message = ( - "tests.utils.test_preprocess.foo() expected a value of " + "{modname}.foo() expected a value of " "type int or NoneType for argument 'a', but got str instead." - ) + ).format(modname=foo.__module__) self.assertEqual(e.exception.args[0], expected_message)