From 5ea4903c4597d175a74b038c529c62b3b2217936 Mon Sep 17 00:00:00 2001 From: Staffan Malmgren Date: Sun, 10 Jun 2018 20:44:21 +0200 Subject: [PATCH] py27 compat --- ferenda/sources/legal/se/myndfskr.py | 5 ++++- requirements.py2.txt | 1 + test/testTOC.py | 4 ++-- test/testWSGI.py | 3 +-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ferenda/sources/legal/se/myndfskr.py b/ferenda/sources/legal/se/myndfskr.py index 989e447a..f90e4dd0 100644 --- a/ferenda/sources/legal/se/myndfskr.py +++ b/ferenda/sources/legal/se/myndfskr.py @@ -11,7 +11,10 @@ import re import json from collections import OrderedDict -from functools import lru_cache +try: + from functools import lru_cache +except ImportError: + from backports.functools_lru_cache import lru_cache from rdflib import URIRef, Literal, Namespace from bs4 import BeautifulSoup diff --git a/requirements.py2.txt b/requirements.py2.txt index 6959c89a..76001370 100644 --- a/requirements.py2.txt +++ b/requirements.py2.txt @@ -32,3 +32,4 @@ responses<0.6.0 # newer versions don't support 2.6 importlib langdetect bz2file # backport +backports.functools_lru_cache # another backport diff --git a/test/testTOC.py b/test/testTOC.py index 202354c9..86248674 100644 --- a/test/testTOC.py +++ b/test/testTOC.py @@ -174,8 +174,8 @@ def test_generate_page(self): # 2.2 JS links, relativized correctly? js = t.findall("body/script") - self.assertEqual(len(js), 5) # jquery, bootstrap, hammer, typeahead, ferenda - self.assertRegex(js[4].get('src'), '^../../../rsrc/js') + self.assertEqual(len(js), 4) # jquery, bootstrap, typeahead, ferenda + self.assertRegex(js[3].get('src'), '^../../../rsrc/js') # 2.3