Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/pytest_cases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'__version__',
# the submodules
'case_funcs', 'case_parametrizer_new',
'common_mini_six', 'common_others', 'common_pytest', 'common_pytest_lazy_values', 'common_pytest_marks',
'common_others', 'common_pytest', 'common_pytest_lazy_values', 'common_pytest_marks',
'filters',
'fixture__creation', 'fixture_core1_unions', 'fixture_core2', 'fixture_parametrize_plus',

Expand Down
10 changes: 3 additions & 7 deletions src/pytest_cases/case_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@
except ImportError:
pass

from .common_mini_six import string_types
from .common_pytest import safe_isclass
from .common_pytest_marks import get_pytest_marks_on_function, markdecorators_as_tuple, markdecorators_to_markinfos

try:
from _pytest.mark.structures import MarkDecorator, Mark
except ImportError:
pass
from _pytest.mark.structures import MarkDecorator, Mark


# ------------------ API --------------
Expand All @@ -31,7 +27,7 @@
CASE_FIELD = '_pytestcase'


class _CaseInfo(object):
class _CaseInfo:
"""
Contains all information available about a case.
It is attached to a case function as an attribute.
Expand Down Expand Up @@ -84,7 +80,7 @@ def add_tags(self,
):
"""add the given tag or tags"""
if tags:
if isinstance(tags, string_types) or not isinstance(tags, (set, list, tuple)):
if isinstance(tags, str) or not isinstance(tags, (set, list, tuple)):
# a single tag, create a tuple around it
tags = (tags,)

Expand Down
26 changes: 7 additions & 19 deletions src/pytest_cases/case_parametrizer_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,15 @@

import functools
from importlib import import_module
from inspect import getmembers, ismodule
from inspect import getmembers, ismodule, signature
import re
from warnings import warn

try: # python 3.3+
from inspect import signature
except ImportError:
from funcsigs import signature # noqa

try:
from typing import Union, Callable, Iterable, Any, Type, List, Tuple # noqa
except ImportError:
pass

from .common_mini_six import string_types
from .common_others import get_code_first_line, AUTO, qname, funcopy, needs_binding, get_function_host, \
in_same_module, get_host_module, get_class_that_defined_method
from .common_pytest_marks import copy_pytest_marks, make_marked_parameter_value, remove_pytest_mark, filter_marks, \
Expand All @@ -41,12 +35,6 @@
from .fixture_parametrize_plus import fixture_ref, _parametrize_plus, FixtureParamAlternative, ParamAlternative, \
SingleParamAlternative, MultiParamAlternative, FixtureRefItem

try:
ModuleNotFoundError
except NameError:
# python < 3.6
ModuleNotFoundError = ImportError


THIS_MODULE = object()
"""Singleton that can be used instead of a module name to indicate that the module is the current one"""
Expand Down Expand Up @@ -240,7 +228,7 @@ def get_all_cases(parametrization_target=None, # type: Callable
needs to be selected.
"""
# Handle single elements
if isinstance(cases, string_types):
if isinstance(cases, str):
cases = (cases,)
else:
try:
Expand All @@ -255,7 +243,7 @@ def get_all_cases(parametrization_target=None, # type: Callable
# validate glob and filter and merge them in a single tuple of callables
filters = ()
if glob is not None:
if not isinstance(glob, string_types):
if not isinstance(glob, str):
raise TypeError("`glob` should be a string containing a glob-like pattern (not a regex).")

filters += (create_glob_name_filter(glob),)
Expand Down Expand Up @@ -355,7 +343,7 @@ def get_parametrize_args(host_class_or_module, # type: Union[Type, ModuleType
debug)]


class CaseParamValue(object):
class CaseParamValue:
"""Common class for lazy values and fixture refs created from cases"""
__slots__ = ()

Expand Down Expand Up @@ -821,7 +809,7 @@ def extract_cases_from_module(module, # type: Union[st
A list of case functions
"""
# optionally import module if passed as module name string
if isinstance(module, string_types):
if isinstance(module, str):
try:
module = import_module(module, package=package_name)
except ModuleNotFoundError as e:
Expand Down Expand Up @@ -1267,7 +1255,7 @@ def get_current_case_id(request_or_item,
warn("`get_current_case_id` is DEPRECATED - please use the `current_cases` fixture instead, or `get_current_cases`")

# process argnames
if isinstance(argnames, string_types):
if isinstance(argnames, str):
argnames = get_param_argnames_as_list(argnames)

# retrieve the correct id
Expand Down Expand Up @@ -1299,7 +1287,7 @@ def get_current_case_id(request_or_item,
# __module__ = "pytest_cases"
#
#
# class CasesModule(object):
# class CasesModule:
# """
# A collector for test cases
# This is a very lightweight version of `_pytest.python.Module`,the pytest collector for test functions and classes.
Expand Down
65 changes: 0 additions & 65 deletions src/pytest_cases/common_mini_six.py

This file was deleted.

Loading
Loading