diff --git a/setup.py b/setup.py index 547c642..7f19c11 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ if sys.version_info[0] == 2: setup( name='vcrpy', - version='2.0.1', + version='2.1.0', description=( "Automatically mock your HTTP interactions to simplify and " "speed up testing" @@ -52,7 +52,7 @@ setup( license='MIT', tests_require=['pytest', 'mock', 'pytest-httpbin'], classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Intended Audience :: Developers', 'Programming Language :: Python', diff --git a/tests/unit/test_vcr_import.py b/tests/unit/test_vcr_import.py new file mode 100644 index 0000000..f81fa08 --- /dev/null +++ b/tests/unit/test_vcr_import.py @@ -0,0 +1,16 @@ +import sys + + +def test_vcr_import_deprecation(recwarn): + + if 'vcr' in sys.modules: + # Remove imported module entry if already loaded in another test + del sys.modules['vcr'] + + import vcr # noqa: F401 + + if sys.version_info[0] == 2: + assert len(recwarn) == 1 + assert issubclass(recwarn[0].category, DeprecationWarning) + else: + assert len(recwarn) == 0 diff --git a/vcr/__init__.py b/vcr/__init__.py index 60af690..52bb89b 100644 --- a/vcr/__init__.py +++ b/vcr/__init__.py @@ -1,4 +1,6 @@ import logging +import warnings +import sys from .config import VCR # Set default logging handler to avoid "No handler found" warnings. @@ -9,6 +11,11 @@ except ImportError: def emit(self, record): pass +if sys.version_info[0] == 2: + warnings.warn( + "Python 2.x support of vcrpy is deprecated and will be removed in an upcoming major release.", + DeprecationWarning + ) logging.getLogger(__name__).addHandler(NullHandler())