mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Merge pull request #324 from untitaker/issue219-warn-on-py2
Warn when running under Python 2
This commit is contained in:
commit
4212797531
3 changed files with 20 additions and 1 deletions
|
|
@ -14,6 +14,11 @@ def setup_logging():
|
|||
click_log.basic_config('vdirsyncer').setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def suppress_py2_warning(monkeypatch):
|
||||
monkeypatch.setattr('vdirsyncer.cli._check_python2', lambda: None)
|
||||
|
||||
|
||||
try:
|
||||
import pytest_benchmark
|
||||
except ImportError:
|
||||
|
|
|
|||
|
|
@ -34,7 +34,11 @@ class DavStorageTests(ServerMixin, StorageTests):
|
|||
|
||||
monkeypatch.setattr('requests.sessions.Session.request', breakdown)
|
||||
|
||||
assert list(s.get_multi([])) == []
|
||||
try:
|
||||
assert list(s.get_multi([])) == []
|
||||
finally:
|
||||
# Make sure monkeypatch doesn't interfere with DAV server teardown
|
||||
monkeypatch.undo()
|
||||
|
||||
def test_dav_unicode_href(self, s, get_item, monkeypatch):
|
||||
if self.dav_server != 'radicale':
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import click
|
|||
import click_log
|
||||
|
||||
from .. import __version__, log
|
||||
from ..utils.compat import PY2
|
||||
|
||||
|
||||
cli_logger = log.get(__name__)
|
||||
|
|
@ -61,6 +62,14 @@ def validate_verbosity(ctx, param, value):
|
|||
return x
|
||||
|
||||
|
||||
def _check_python2():
|
||||
if PY2:
|
||||
cli_logger.warning('Python 2 support will be dropped. Please switch '
|
||||
'to at least Python 3.3 as soon as possible. See '
|
||||
'https://github.com/untitaker/vdirsyncer/issues/219'
|
||||
' for more information.')
|
||||
|
||||
|
||||
@click.group()
|
||||
@click_log.init('vdirsyncer')
|
||||
@click_log.simple_verbosity_option()
|
||||
|
|
@ -71,6 +80,7 @@ def app(ctx):
|
|||
'''
|
||||
vdirsyncer -- synchronize calendars and contacts
|
||||
'''
|
||||
_check_python2()
|
||||
from .config import load_config
|
||||
|
||||
if not ctx.config:
|
||||
|
|
|
|||
Loading…
Reference in a new issue