Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable compatibility with Python 3.9 (tested) #98

Merged
merged 5 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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