Skip to content

Commit

Permalink
Make tests work on Python 2
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayP13 committed Nov 9, 2018
1 parent 8c8794a commit 43c1a67
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Test Python 2:
- apt-get install python-pip -y
- pip2 install -U pip setuptools
- python2 setup.py install
- pip install gensim
- python2 -m tests.tests -- -v

Test Python 3:
Expand All @@ -61,7 +60,6 @@ Test Python 3:
- curl https://bootstrap.pypa.io/get-pip.py | python3.7
- python3.7 -m pip install -U wheel setuptools # TEMP: removing upgrading of pip here, because the newest one is broken for Python 3
- python3.7 setup.py install
- python3.7 -m pip install gensim
- python3.7 -m tests.tests -- -v

Deploy to PyPI:
Expand Down
16 changes: 15 additions & 1 deletion supersqlite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import tempfile
import threading
import time
import types
import uuid

from time import sleep
Expand Down Expand Up @@ -53,11 +54,24 @@
apsw = apsw


class SuperSQLite(apsw):
class SuperSQLite():
pass


class SuperSQLiteConnection(apsw.Connection):
pass


for prop in dir(apsw):
value = getattr(apsw, prop)
if prop.startswith('__') or isinstance(value, types.ModuleType):
continue
setattr(SuperSQLite, prop, value)
setattr(SuperSQLite, 'connect', SuperSQLiteConnection)

# KeyList helper class


class KeyList(object):
def __init__(self, ls, key):
self.ls = ls
Expand Down
3 changes: 2 additions & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def test_apsw(self):
self.assertTrue(apsw)

def test_ssqlite_subclass(self):
self.assertTrue(issubclass(SuperSQLite, apsw))
self.assertTrue(issubclass(SuperSQLite.Connection, apsw.Connection))
self.assertTrue(issubclass(SuperSQLite.connect, apsw.Connection))


if __name__ == '__main__':
Expand Down

0 comments on commit 43c1a67

Please sign in to comment.