From 7562655cf4bf28a1ebd6c458334da0c166f34e61 Mon Sep 17 00:00:00 2001 From: efkin Date: Mon, 13 Mar 2017 21:17:18 +0100 Subject: [refactor] Improve python3 compatibility With this commit all tests on py34 tox environment are collected. --- testing/test_soledad/u1db_tests/__init__.py | 11 +++++------ testing/test_soledad/util.py | 11 +++++------ testing/tests/sqlcipher/test_backend.py | 12 +++++++----- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'testing') diff --git a/testing/test_soledad/u1db_tests/__init__.py b/testing/test_soledad/u1db_tests/__init__.py index 36db548d..1575b859 100644 --- a/testing/test_soledad/u1db_tests/__init__.py +++ b/testing/test_soledad/u1db_tests/__init__.py @@ -28,12 +28,6 @@ import sys from six import StringIO from wsgiref import simple_server - -if sys.version_info[0] < 3: - from pysqlcipher import dbapi2 -else: - from pysqlcipher3 import dbapi2 - import testscenarios from twisted.trial import unittest from twisted.web.server import Site @@ -48,6 +42,11 @@ from leap.soledad.common.l2db.remote import server_state from leap.soledad.common.l2db.remote import http_app from leap.soledad.common.l2db.remote import http_target +if sys.version_info[0] < 3: + from pysqlcipher import dbapi2 +else: + from pysqlcipher3 import dbapi2 + class TestCase(unittest.TestCase): diff --git a/testing/test_soledad/util.py b/testing/test_soledad/util.py index 91291faf..6ffb60b6 100644 --- a/testing/test_soledad/util.py +++ b/testing/test_soledad/util.py @@ -31,11 +31,6 @@ from six import StringIO from uuid import uuid4 from mock import Mock -if sys.version_info[0] < 3: - from pysqlcipher import dbapi2 -else: - from pysqlcipher3 import dbapi2 - from twisted.trial import unittest from leap.common.testing.basetest import BaseLeapTest @@ -48,7 +43,6 @@ from leap.soledad.common.document import SoledadDocument from leap.soledad.common.couch import CouchDatabase from leap.soledad.common.couch.state import CouchServerState - from leap.soledad.client import Soledad from leap.soledad.client import http_target from leap.soledad.client import auth @@ -58,6 +52,11 @@ from leap.soledad.client._crypto import is_symmetrically_encrypted from leap.soledad.server import SoledadApp +if sys.version_info[0] < 3: + from pysqlcipher import dbapi2 +else: + from pysqlcipher3 import dbapi2 + PASSWORD = '123456' ADDRESS = 'user-1234' diff --git a/testing/tests/sqlcipher/test_backend.py b/testing/tests/sqlcipher/test_backend.py index 643fa041..6e9595db 100644 --- a/testing/tests/sqlcipher/test_backend.py +++ b/testing/tests/sqlcipher/test_backend.py @@ -22,11 +22,6 @@ import pytest import time import threading import sys -if sys.version_info[0] < 3: - from pysqlcipher import dbapi2 -else: - from pysqlcipher3 import dbapi2 -from testscenarios import TestWithScenarios # l2db stuff. from leap.soledad.common.l2db import errors @@ -48,6 +43,13 @@ from test_soledad.util import SQLCIPHER_SCENARIOS from test_soledad.util import PASSWORD from test_soledad.util import BaseSoledadTest +from testscenarios import TestWithScenarios + +if sys.version_info[0] < 3: + from pysqlcipher import dbapi2 +else: + from pysqlcipher3 import dbapi2 + def sqlcipher_open(path, passphrase, create=True, document_factory=None): return SQLCipherDatabase( -- cgit v1.2.3