Remove Python 2 support

This commit is contained in:
Guillaume Ayoub
2016-03-31 19:57:40 +02:00
parent fa4eaef08e
commit 434cb533e9
34 changed files with 71 additions and 187 deletions

View File

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
#
# This file is part of Radicale Server - Calendar Server
# Copyright © 2012-2013 Guillaume Ayoub
# Copyright © 2012-2016 Guillaume Ayoub
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -30,8 +28,6 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
os.environ["RADICALE_CONFIG"] = os.path.join(os.path.dirname(
os.path.dirname(__file__)), "config")
from .helpers import get_file_content
class BaseTest(object):
"""Base class for tests."""
@ -46,8 +42,7 @@ class BaseTest(object):
args["REQUEST_METHOD"] = method.upper()
args["PATH_INFO"] = path
if data:
if sys.version_info[0] >= 3:
data = data.encode("utf-8")
data = data.encode("utf-8")
args["wsgi.input"] = BytesIO(data)
args["CONTENT_LENGTH"] = str(len(data))
self.application._answer = self.application(args, self.start_response)

View File

@ -1 +0,0 @@
# coding=utf-8

View File

@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Radicale Server - Calendar Server
# Copyright © 2008 Nicolas Kandel
# Copyright © 2008 Pascal Halter
# Copyright © 2008-2013 Guillaume Ayoub
# Copyright © 2008-2016 Guillaume Ayoub
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
#
# This file is part of Radicale Server - Calendar Server
# Copyright © 2012-2013 Guillaume Ayoub
# Copyright © 2012-2016 Guillaume Ayoub
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
#
# This file is part of Radicale Server - Calendar Server
# Copyright © 2008 Nicolas Kandel
# Copyright © 2008 Pascal Halter
# Copyright © 2008-2013 Guillaume Ayoub
# Copyright © 2008-2016 Guillaume Ayoub
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,8 +1,6 @@
# -*- coding: utf-8 -*-
#
# This file is part of Radicale Server - Calendar Server
# Copyright © 2012-2013 Guillaume Ayoub
# Copyright © 2012-2013 Jean-Marc Martins
# Copyright © 2012-2016 Jean-Marc Martins
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -27,9 +25,11 @@ import hashlib
import os
import radicale
import tempfile
from radicale import config
from radicale.auth import htpasswd
from tests import BaseTest
from . import BaseTest
class TestBaseAuthRequests(BaseTest):

View File

@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
#
# This file is part of Radicale Server - Calendar Server
# Copyright © 2012-2013 Guillaume Ayoub
# Copyright © 2012-2016 Guillaume Ayoub
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -120,7 +118,7 @@ class TestDataBaseSystem(BaseRequests, BaseTest):
storage_type = "database"
def setup(self):
super(TestDataBaseSystem, self).setup()
super().setup()
radicale.config.set("storage", "database_url", "sqlite://")
from radicale.storage import database
database.Session = sessionmaker()
@ -134,7 +132,7 @@ class TestDataBaseSystem(BaseRequests, BaseTest):
class TestGitFileSystem(TestFileSystem):
"""Base class for filesystem tests using Git"""
def setup(self):
super(TestGitFileSystem, self).setup()
super().setup()
Repo.init(self.colpath)
from radicale.storage import filesystem
filesystem.GIT_REPOSITORY = Repo(self.colpath)
@ -150,7 +148,7 @@ class TestCustomStorageSystem(BaseRequests, BaseTest):
def setup(self):
"""Setup function for each test."""
super(TestCustomStorageSystem, self).setup()
super().setup()
self.colpath = tempfile.mkdtemp()
radicale.config.set(
"storage", "custom_handler", "tests.custom.storage")