Initial pass of removing Python 2 support

This commit removes Six as a dependency for Pelican, replacing the
relevant aliases with the proper Python 3 imports. It also removes
references to Python 2 logic that did not require Six.
This commit is contained in:
Kevin Yap 2019-11-05 23:17:19 -08:00
commit 1e0e541b57
43 changed files with 126 additions and 459 deletions

View file

@ -1,10 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import os
import six
from pelican import readers
from pelican.tests.support import get_settings, unittest
from pelican.utils import SafeDatetime
@ -64,8 +61,7 @@ class TestAssertDictHasSubset(ReaderTest):
self.assertDictHasSubset(self.dictionary, self.dictionary)
def test_fail_not_set(self):
six.assertRaisesRegex(
self,
self.assertRaisesRegex(
AssertionError,
r'Expected.*key-c.*to have value.*val-c.*but was not in Dict',
self.assertDictHasSubset,
@ -73,8 +69,7 @@ class TestAssertDictHasSubset(ReaderTest):
{'key-c': 'val-c'})
def test_fail_wrong_val(self):
six.assertRaisesRegex(
self,
self.assertRaisesRegex(
AssertionError,
r'Expected .*key-a.* to have value .*val-b.* but was .*val-a.*',
self.assertDictHasSubset,
@ -445,7 +440,7 @@ class RstReaderTest(ReaderTest):
def test_parse_error(self):
# Verify that it raises an Exception, not nothing and not SystemExit or
# some such
with six.assertRaisesRegex(self, Exception, "underline too short"):
with self.assertRaisesRegex(Exception, "underline too short"):
self.read_file(path='../parse_error/parse_error.rst')