Skip to content

Commit

Permalink
Merge pull request #98 from honzajavorek/honzajavorek/compat-3.9
Browse files Browse the repository at this point in the history
Enable compatibility with Python 3.9 (tested)
  • Loading branch information
tswast committed Mar 16, 2020
2 parents 75785fc + ecd939f commit 200b627
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ python:
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "pypy"
- "pypy3.3-5.2-alpha1"

Expand Down
7 changes: 6 additions & 1 deletion flask_frozen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@
from unicodedata import normalize
from threading import Lock
from contextlib import contextmanager
from collections import Mapping, namedtuple
from posixpath import relpath as posix_relpath

from collections import namedtuple
try:
from collections.abc import Mapping # Python 3
except ImportError:
from collections import Mapping # Python 2.7

try:
from urllib import unquote
from urlparse import urlsplit
Expand Down
10 changes: 10 additions & 0 deletions flask_frozen/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from contextlib import contextmanager
from unicodedata import normalize
from warnings import catch_warnings
import sys
import subprocess

from flask_frozen import (Freezer, walk_directory,
FrozenFlaskWarning, MissingURLGeneratorWarning, MimetypeMismatchWarning,
Expand Down Expand Up @@ -524,6 +526,14 @@ def view_post():
self.assertEqual(first_mtimes['epoch'],second_mtimes['epoch'])
self.assertNotEqual(first_mtimes['now'],second_mtimes['now'])

class TestPythonCompatibilityWarnings(unittest.TestCase):
def test_importing_collections(self):
ps = subprocess.check_output([sys.executable, 'flask_frozen/__init__.py'],
stderr=subprocess.STDOUT)
stderr = ps.decode('utf-8').lower()
assert 'deprecationwarning' not in stderr
assert 'using or importing the abcs' not in stderr

# with_no_argument_rules=False and with_static_files=False are
# not tested as they produces (expected!) warnings

Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
]
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py26, py27, py34, py35, py36, pypy, pypy3
envlist = py26, py27, py34, py35, py36, py37, py38, pypy, pypy3
[testenv]
commands=python -m flask_frozen.tests
changedir=docs

0 comments on commit 200b627

Please sign in to comment.