Skip to content

Commit

Permalink
Removed Python 2.6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbean-bremen committed Nov 13, 2017
1 parent 46197ea commit a8e4002
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 99 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ language: python

matrix:
include:
- python: 2.6
env: PYTHON=py26
- python: 2.7
env: PYTHON=py27
- python: 3.3
Expand Down
4 changes: 0 additions & 4 deletions .travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
eval "$(pyenv init -)"

case "${PYTHON}" in
py26)
pyenv install 2.6.6
pyenv global 2.6.6
;;
py27)
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ must use pyfakefs 3.3 or earlier.
#### New Features

#### Infrastructure
* Removed Python 2.6 support [#293](../../issues/293)

#### Fixes

Expand Down
5 changes: 1 addition & 4 deletions dynamic_patch_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
Tests for patching modules loaded after `setupPyfakefs()`.
"""
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import unittest

from pyfakefs import fake_filesystem_unittest

Expand Down
7 changes: 2 additions & 5 deletions example_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@
import io
import os
import sys

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import unittest

from pyfakefs import fake_filesystem_unittest

# The module under test is pyfakefs/example
import example

Expand Down
8 changes: 1 addition & 7 deletions fake_filesystem_glob_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@

"""Test for glob using fake_filesystem."""

import doctest
import glob
import os
import sys

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import unittest

from pyfakefs import fake_filesystem_unittest

Expand Down
8 changes: 1 addition & 7 deletions fake_filesystem_shutil_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,11 @@
import os
import shutil
import sys

import time
import unittest

from fake_filesystem_test import RealFsTestMixin
from pyfakefs import fake_filesystem_unittest

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class RealFsTestCase(fake_filesystem_unittest.TestCase, RealFsTestMixin):
def __init__(self, methodName='runTest'):
Expand Down
25 changes: 5 additions & 20 deletions fake_filesystem_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,17 @@
import errno
import io
import locale
import platform
import os
import platform
import shutil
import stat
import sys
import tempfile
import time

import shutil

from pyfakefs.fake_filesystem import FakeFileOpen

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import unittest

from pyfakefs import fake_filesystem
from pyfakefs.fake_filesystem import FakeFileOpen


class _DummyTime(object):
Expand Down Expand Up @@ -5165,12 +5159,7 @@ def testRelpath(self):
path_other = '!some!where!else'
self.assertRaises(ValueError, self.path.relpath, None)
self.assertRaises(ValueError, self.path.relpath, '')
if sys.version_info < (2, 7):
# The real Python 2.6 os.path.relpath('!path!to!foo') actually does
# return '..!path!to!foo' instead of 'path!to!foo'
self.assertEqual('..!path!to!foo', self.path.relpath(path_foo))
else:
self.assertEqual('path!to!foo', self.path.relpath(path_foo))
self.assertEqual('path!to!foo', self.path.relpath(path_foo))
self.assertEqual('..!foo',
self.path.relpath(path_foo, path_bar))
self.assertEqual('..!..!..%s' % path_other,
Expand Down Expand Up @@ -6219,8 +6208,6 @@ def testTellFlushesInPython3(self):
expected = 0 if sys.version_info < (3,) else 4
self.assertEqual(expected, self.os.path.getsize(file_path))

@unittest.skipIf(sys.version_info < (2, 7),
'Python 2.6 behaves differently')
def testReadFlushesUnderPosix(self):
# Regression test for #278
self.checkPosixOnly()
Expand Down Expand Up @@ -6432,8 +6419,6 @@ def testOpenWithWplus(self):
def testOpenWithAppendFlag(self):
# FIXME: under Windows, line endings are not handled correctly
self.skipRealFsFailure(skipPosix=False)
if self.useRealFs() and sys.version_info < (2, 7):
raise unittest.SkipTest('Python 2.6 behaving differently here')
contents = [
u'Калинка,\n',
u'калинка,\n',
Expand Down
22 changes: 10 additions & 12 deletions fake_filesystem_unittest_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import glob
import shutil
import sys
import unittest
from unittest import TestCase

from import_as_example import check_if_exists
Expand All @@ -33,11 +34,6 @@
if sys.version_info >= (3, 4):
import pathlib

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest


class TestPatcher(TestCase):
def testContextManager(self):
Expand Down Expand Up @@ -204,16 +200,18 @@ def test_own_path_module(self):
self.assertEqual(2, path.floor(2.5))


@unittest.skipIf(sys.version_info < (2, 7), "No byte strings in Python 2.6")
class TestCopyOrAddRealFile(TestPyfakefsUnittestBase):
"""Tests the `fake_filesystem_unittest.TestCase.copyRealFile()` method.
Note that `copyRealFile()` is deprecated in favor of `FakeFilesystem.add_real_file()`.
Note that `copyRealFile()` is deprecated in favor of
`FakeFilesystem.add_real_file()`.
"""
with open(__file__) as f:
real_string_contents = f.read()
with open(__file__, 'rb') as f:
real_byte_contents = f.read()
real_stat = os.stat(__file__)
@classmethod
def setUpClass(cls):
with open(__file__) as f:
cls.real_string_contents = f.read()
with open(__file__, 'rb') as f:
cls.real_byte_contents = f.read()
cls.real_stat = os.stat(__file__)

@unittest.skipIf(sys.platform == 'darwin', 'Different copy behavior')
def testCopyRealFile(self):
Expand Down
11 changes: 3 additions & 8 deletions fake_filesystem_vs_real_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@

# pylint: disable-all

import os # @UnusedImport
import os.path
import os
import shutil
import sys
import tempfile
import time
import sys

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import unittest

from pyfakefs import fake_filesystem

Expand Down
7 changes: 1 addition & 6 deletions fake_tempfile_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@
import os
import stat
import sys

import tempfile

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import unittest

from pyfakefs import fake_filesystem_unittest

Expand Down
8 changes: 1 addition & 7 deletions mox3_stubout_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,9 @@
import datetime
import math
import os
import unittest
from os import path

import sys

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest

import mox3_stubout_example
from pyfakefs import mox3_stubout

Expand Down
9 changes: 2 additions & 7 deletions pyfakefs/fake_filesystem_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@
if sys.version_info >= (3, 4):
from pyfakefs import fake_pathlib

if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
import unittest

if sys.version_info < (3,):
import __builtin__ as builtins # pylint: disable=import-error
Expand Down Expand Up @@ -260,8 +257,6 @@ class Patcher(object):
HAS_PATHLIB = sys.version_info >= (3, 4)
IS_WINDOWS = sys.platform in ('win32', 'cygwin')

# To add py.test support per issue https://github.com/jmcgeheeiv/pyfakefs/issues/43,
# it appears that adding 'py', 'pytest', '_pytest' to SKIPNAMES will help
SKIPNAMES = set(['os', 'path', 'io', 'genericpath'])
if HAS_PATHLIB:
SKIPNAMES.add('pathlib')
Expand Down Expand Up @@ -380,7 +375,7 @@ def _patch_tempfile(self):
Shall be replaced by a more generic mechanism.
"""
if 'unlink' in tempfile._TemporaryFileWrapper.__dict__:
# Python 2.6 to 3.2: unlink is a class method of _TemporaryFileWrapper
# Python 2.7 to 3.2: unlink is a class method of _TemporaryFileWrapper
tempfile._TemporaryFileWrapper.unlink = self.fake_os.unlink

# Python 3.0 to 3.2 (and PyPy3 based on Python 3.2):
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
unittest2; python_version < '2.7'
importlib; python_version < '2.7'
pytest>=2.8.6
8 changes: 1 addition & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Copyright 2009 Google Inc. All Rights Reserved.
# Copyright 2014 Altera Corporation. All Rights Reserved.
# Copyright 2014-2015 John McGehee
# Copyright 2014-2017 John McGehee
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -19,8 +19,6 @@

from pyfakefs.fake_filesystem import __version__

import os

NAME = 'pyfakefs'
REQUIRES = []
DESCRIPTION = 'pyfakefs implements a fake file system that mocks the Python file system modules.'
Expand All @@ -41,7 +39,6 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
Expand Down Expand Up @@ -91,8 +88,5 @@
from setuptools import setup
except ImportError:
from distutils.core import setup
else:
params['tests_require'] = ['unittest2']
params['test_suite'] = 'unittest2.collector'

setup(**params) # pylint: disable = W0142
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,py33,py34,py35,py36,py37,pypy
envlist=py27,py33,py34,py35,py36,py37,pypy

[testenv]
deps = -rrequirements.txt
Expand Down

0 comments on commit a8e4002

Please sign in to comment.