Skip to content

Commit 78e21aa

Browse files
authored
Increment version to v2.1.0 and add Python2.x deprecation warning (#458)
* Increment version and add Python2.x deprecation warning Change test to actually test no warnings when on python3 flake8 compliant * fix development status classifier
1 parent 1b565d3 commit 78e21aa

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

Diff for: setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def run_tests(self):
3737

3838
setup(
3939
name='vcrpy',
40-
version='2.0.1',
40+
version='2.1.0',
4141
description=(
4242
"Automatically mock your HTTP interactions to simplify and "
4343
"speed up testing"
@@ -52,7 +52,7 @@ def run_tests(self):
5252
license='MIT',
5353
tests_require=['pytest', 'mock', 'pytest-httpbin'],
5454
classifiers=[
55-
'Development Status :: 4 - Beta',
55+
'Development Status :: 5 - Production/Stable',
5656
'Environment :: Console',
5757
'Intended Audience :: Developers',
5858
'Programming Language :: Python',

Diff for: tests/unit/test_vcr_import.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import sys
2+
3+
4+
def test_vcr_import_deprecation(recwarn):
5+
6+
if 'vcr' in sys.modules:
7+
# Remove imported module entry if already loaded in another test
8+
del sys.modules['vcr']
9+
10+
import vcr # noqa: F401
11+
12+
if sys.version_info[0] == 2:
13+
assert len(recwarn) == 1
14+
assert issubclass(recwarn[0].category, DeprecationWarning)
15+
else:
16+
assert len(recwarn) == 0

Diff for: vcr/__init__.py

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import logging
2+
import warnings
3+
import sys
24
from .config import VCR
35

46
# Set default logging handler to avoid "No handler found" warnings.
@@ -9,6 +11,11 @@ class NullHandler(logging.Handler):
911
def emit(self, record):
1012
pass
1113

14+
if sys.version_info[0] == 2:
15+
warnings.warn(
16+
"Python 2.x support of vcrpy is deprecated and will be removed in an upcoming major release.",
17+
DeprecationWarning
18+
)
1219

1320
logging.getLogger(__name__).addHandler(NullHandler())
1421

0 commit comments

Comments
 (0)