Commit 1e851838 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Remove 'six' package dependency

parent ea9d667c
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -33,8 +33,4 @@ setup(
	name = unittest_extra.__name__,
	version = unittest_extra.__version__,
	packages = find_packages(),

	install_requires = [
		'six~=1.9',
	],
)
+32 −0
Original line number Diff line number Diff line
#
# This file is part of 'py-unittest-extra'
# Copyright (C) 2016  Dom Sekotill
#
# Permission is hereby granted, free of charge, to any person obtaining a copy 
# of this software and associated documentation files (the "Software"), to deal 
# in the Software without restriction, including without limitation the rights 
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
# copies of the Software, and to permit persons to whom the Software is 
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in 
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
# SOFTWARE.
#

"""
Cross-Python compatability module.
"""

import sys


PY2 = sys.version_info.major == 2:
STRING_TYPES = (str, unicode) if PY2 else (str,)
+5 −5
Original line number Diff line number Diff line
#
# This file is part of 'py-unittest-extra'
# Copyright (C) 2015  Dom Sekotill
# Copyright (C) 2015, 2016  Dom Sekotill
#
# Permission is hereby granted, free of charge, to any person obtaining a copy 
# of this software and associated documentation files (the "Software"), to deal 
@@ -25,11 +25,11 @@
A module to produce coverage reports for testing.
"""

from six import string_types, PY3
from itertools import product
from functools import wraps
from fnmatch import fnmatch
from pkg_resources import working_set, normalize_path
from .compat import STRING_TYPES, PY2
import contextlib
import importlib
import itertools
@@ -42,7 +42,7 @@ import io
def _import_module(module, exclude):
	if module not in sys.modules:
		loader = pkgutil.get_loader(module)
		if isinstance(exclude, string_types):
		if isinstance(exclude, STRING_TYPES):
			if fnmatch(loader.get_filename(), exclude):
				return
		elif exclude:
@@ -74,7 +74,7 @@ def coverage_report(modules, include=None, exclude=None, file=None):

	old_modules = sys.modules.copy()
	modules = {
		_import_module(m, exclude) if isinstance(m, string_types) else m
		_import_module(m, exclude) if isinstance(m, STRING_TYPES) else m
		for m in modules
	}

@@ -102,7 +102,7 @@ def coverage_report(modules, include=None, exclude=None, file=None):
		cover.stop()
		cover.save()

		mode = 'w' if PY3 else 'wb'
		mode = 'wb' if PY2 else 'w'
		with file or io.open(sys.stdout.fileno(), mode, closefd=False) as file:
			if file.isatty():
				file.write("\nCoverage Report:\n================\n")
+4 −4
Original line number Diff line number Diff line
#
# This file is part of 'py-unittest-extra'
# Copyright (C) 2015  Dom Sekotill
# Copyright (C) 2015, 2016  Dom Sekotill
#
# Permission is hereby granted, free of charge, to any person obtaining a copy 
# of this software and associated documentation files (the "Software"), to deal 
@@ -28,9 +28,9 @@ A module to increase test re-use, by running tests with multiple argument sets.
import unittest
from collections import Iterable, Callable
from functools import wraps
from six import string_types
from .compat import STRING_TYPES

NON_ARG_TYPES = tuple({str, bytes, bytearray, dict} | set(string_types))
NON_ARG_TYPES = tuple({str, bytes, bytearray, dict} | set(STRING_TYPES))


class test_generator(object):
@@ -134,7 +134,7 @@ class test_generator(object):
			wrap = self._make_wrap(tuple(), dict())
			self._attach_test(testcase_class, wrap)
			return
		elif isinstance(self.values, string_types):
		elif isinstance(self.values, STRING_TYPES):
			values = getattr(testcase_class, self.values)
			if values is None:
				# ignore; a subclasses will make use of this test generator.