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

Drop support for Python 2.6 and 3.3 #30

Merged
merged 3 commits into from
Oct 3, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@ matrix:
include:
- python: 2.7
env: TOXENV=py27-test
- python: 3.4
env: TOXENV=py34-test
- python: 3.5
env: TOXENV=py35-test
- python: 3.6
env: TOXENV=py36-test
- python: 3.7
env: TOXENV=py37-test
# 3.7 requires sudo: https://github.com/travis-ci/travis-ci/issues/9831
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting.

sudo: required
dist: xenial
- python: 3.6
env: TOXENV=py36-docs
- python: 3.6
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog
Next Release
------------

MockupDB no longer supports Python 2.6 or Python 3.3.

New method ``MockupDB.append_responder`` to add an autoresponder of last resort.

Fix a bug in ``interactive_server`` with ``all_ok=True``. It had returned an
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Before you submit a pull request, check that it meets these guidelines:
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 2.6, 2.7, 3.3, and 3.4. Check that
3. The pull request should work for Python 2.7 and 3.4+. Check that
tests pass in all versions with `tox`.

Tips
Expand Down
5 changes: 1 addition & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@
default_role = 'py:obj'

doctest_global_setup = """
try:
from collections import OrderedDict
except:
from ordereddict import OrderedDict # Python 2.6, "pip install ordereddict"
from collections import OrderedDict
from mockupdb import *
"""

Expand Down
10 changes: 2 additions & 8 deletions mockupdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import weakref
import sys
from codecs import utf_8_decode as _utf_8_decode
from collections import OrderedDict

try:
from queue import Queue, Empty
Expand All @@ -51,11 +52,6 @@
except:
from collections import Mapping

try:
from collections import OrderedDict
except:
from ordereddict import OrderedDict # Python 2.6, "pip install ordereddict"

try:
from io import StringIO
except ImportError:
Expand Down Expand Up @@ -204,9 +200,7 @@ def __init__(self):
self._event = threading.Event()

def result(self, timeout=None):
self._event.wait(timeout)
# wait() always returns None in Python 2.6.
if not self._event.is_set():
if not self._event.wait(timeout):
raise AssertionError('timed out waiting for Future')
return self._result

Expand Down
25 changes: 11 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,15 @@
except ImportError:
from distutils.core import setup

if sys.version_info[:2] < (2, 7):
raise RuntimeError("Python version >= 2.7 required.")

with open('README.rst') as readme_file:
readme = readme_file.read()

with open('CHANGELOG.rst') as changelog_file:
changelog = changelog_file.read().replace('.. :changelog:', '')

requirements = ['pymongo>=3']
test_requirements = []

if sys.version_info[:2] == (2, 6):
requirements.append('ordereddict')
test_requirements.append('unittest2')

setup(
name='mockupdb',
version='1.8.0.dev0',
Expand All @@ -33,22 +28,24 @@
packages=['mockupdb'],
package_dir={'mockupdb': 'mockupdb'},
include_package_data=True,
install_requires=requirements,
install_requires=['pymongo>=3'],
license="Apache License, Version 2.0",
zip_safe=False,
keywords=["mongo", "mongodb", "wire protocol", "mockupdb", "mock"],
python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
"License :: OSI Approved :: Apache Software License",
'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
],
test_suite='tests',
tests_require=test_requirements
tests_require=[]
)
7 changes: 0 additions & 7 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
# -*- coding: utf-8 -*-

import unittest

try:
import unittest2 as unittest
except ImportError:
pass
2 changes: 1 addition & 1 deletion tests/test_mockupdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import ssl
import sys
import tempfile
import unittest
from struct import Struct

if sys.version_info[0] < 3:
Expand All @@ -29,7 +30,6 @@
from mockupdb import (go, going, Command, CommandBase, Matcher, MockupDB,
Request, OpInsert, OP_MSG_FLAGS, OpMsg, OpQuery,
QUERY_FLAGS)
from tests import unittest # unittest2 on Python 2.6.


@contextlib.contextmanager
Expand Down
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tox]
envlist =
{py26,py27,py33,py34}-test,
py34-docs
py34-doctest
{py27,py34,py35,py36,py37}-test,
py36-docs
py36-doctest

[testenv]
setenv =
Expand All @@ -11,7 +11,7 @@ commands =
python setup.py test


[testenv:py34-docs]
[testenv:py36-docs]
changedir =
docs
commands =
Expand All @@ -20,7 +20,7 @@ commands =
deps =
sphinx

[testenv:py34-doctest]
[testenv:py36-doctest]
changedir =
docs
commands =
Expand Down