From 6ed23fec7dc1c907b9dcc3eb3d08eca61c1bb9b5 Mon Sep 17 00:00:00 2001 From: Honza Javorek Date: Wed, 25 Sep 2013 16:31:23 +0200 Subject: [PATCH] Tuned the tests so they are PY3 compilant. --- pelican/tests/test_contents.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py index 2e44253a..437d0228 100644 --- a/pelican/tests/test_contents.py +++ b/pelican/tests/test_contents.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import six from datetime import datetime from sys import platform @@ -205,7 +206,10 @@ class TestPage(unittest.TestCase): 'link')) def test_intrasite_link(self): - article = type(b'_DummyArticle', (object,), {'url': 'article.html'}) + # type does not take unicode in PY2 and bytes in PY3, which in + # combination with unicode literals leads to following insane line: + cls_name = '_DummyArticle' if six.PY3 else b'_DummyArticle' + article = type(cls_name, (object,), {'url': 'article.html'}) args = self.page_kwargs.copy() args['settings'] = get_settings()