Hello community,

here is the log from the commit of package python-rethinkdb for 
openSUSE:Leap:15.2 checked in at 2020-03-21 16:46:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-rethinkdb (Old)
 and      /work/SRC/openSUSE:Leap:15.2/.python-rethinkdb.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-rethinkdb"

Sat Mar 21 16:46:47 2020 rev:2 rq:786976 version:2.4.5

Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/python-rethinkdb/python-rethinkdb.changes      
2020-02-11 23:25:09.201261774 +0100
+++ 
/work/SRC/openSUSE:Leap:15.2/.python-rethinkdb.new.3160/python-rethinkdb.changes
    2020-03-21 16:48:07.149688363 +0100
@@ -1,0 +2,6 @@
+Thu Mar 19 04:32:11 UTC 2020 - Steve Kowalik <steven.kowa...@suse.com>
+
+- Update to 2.4.5:
+  * No upstream changelog.
+
+-------------------------------------------------------------------

Old:
----
  rethinkdb-2.4.3.post1.tar.gz

New:
----
  rethinkdb-2.4.5.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-rethinkdb.spec ++++++
--- /var/tmp/diff_new_pack.PadA0c/_old  2020-03-21 16:48:07.553688619 +0100
+++ /var/tmp/diff_new_pack.PadA0c/_new  2020-03-21 16:48:07.557688622 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-rethinkdb
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-rethinkdb
-Version:        2.4.3.post1
+Version:        2.4.5
 Release:        0
 Summary:        Python driver library for the RethinkDB database server
 License:        Apache-2.0

++++++ rethinkdb-2.4.3.post1.tar.gz -> rethinkdb-2.4.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/.github/FUNDING.yml 
new/rethinkdb-python-2.4.5/.github/FUNDING.yml
--- old/rethinkdb-python-2.4.3.post1/.github/FUNDING.yml        1970-01-01 
01:00:00.000000000 +0100
+++ new/rethinkdb-python-2.4.5/.github/FUNDING.yml      2020-03-02 
07:22:47.000000000 +0100
@@ -0,0 +1,12 @@
+# These are supported funding model platforms
+
+github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, 
user2]
+patreon: # Replace with a single Patreon username
+open_collective: # Replace with a single Open Collective username
+ko_fi: # Replace with a single Ko-fi username
+tidelift: # Replace with a single Tidelift platform-name/package-name e.g., 
npm/babel
+community_bridge: rethinkdb
+liberapay: # Replace with a single Liberapay username
+issuehunt: # Replace with a single IssueHunt username
+otechie: # Replace with a single Otechie username
+custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/.travis.yml 
new/rethinkdb-python-2.4.5/.travis.yml
--- old/rethinkdb-python-2.4.3.post1/.travis.yml        2019-09-04 
07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/.travis.yml      2020-03-02 07:22:47.000000000 
+0100
@@ -8,14 +8,14 @@
     - "3.5"
     - "3.6"
     - "3.7"
-    - "3.7-dev"
-    - "3.8-dev"
+    - "3.8"
 
 allow_failure:
-    - python: "3.8-dev"
+    - python: "3.8"
 
 install:
     - pip install -r requirements.txt
+    - pip freeze
 
 before_script:
     - make prepare
@@ -31,7 +31,7 @@
     provider: script
     script: make upload-pypi
     on:
-        python: 3.7
+        python: 3.8
         tags: true
 
 notifications:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/MANIFEST.in 
new/rethinkdb-python-2.4.5/MANIFEST.in
--- old/rethinkdb-python-2.4.3.post1/MANIFEST.in        1970-01-01 
01:00:00.000000000 +0100
+++ new/rethinkdb-python-2.4.5/MANIFEST.in      2020-03-02 07:22:47.000000000 
+0100
@@ -0,0 +1,8 @@
+include LICENSE
+include *.txt
+include Makefile
+include pytest.ini
+include .coveragerc
+recursive-include scripts *.py
+recursive-include scripts *.sh
+recursive-include tests *.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/Makefile 
new/rethinkdb-python-2.4.5/Makefile
--- old/rethinkdb-python-2.4.3.post1/Makefile   2019-09-04 07:28:13.000000000 
+0200
+++ new/rethinkdb-python-2.4.5/Makefile 2020-03-02 07:22:47.000000000 +0100
@@ -32,27 +32,28 @@
 help:
        @echo "Usage:"
        @echo
-       @echo " make help                               Print this help message"
-       @echo " make test-unit                  Run unit tests"
-       @echo " make test-integration   Run integration tests"
-       @echo " make test-remote                Run tests on digital ocean"
-       @echo " make upload-coverage    Upload unit test coverage"
-       @echo " make upload-pypi                Release ${PACKAGE_NAME} package 
to PyPi"
-       @echo " make clean                              Cleanup source 
directory"
-       @echo " make prepare                    Prepare ${PACKAGE_NAME} for 
build"
+       @echo " make help                                   Print this help 
message"
+       @echo " make test-unit                      Run unit tests"
+       @echo " make test-integration       Run integration tests"
+       @echo " make test-integration-2.4       Run integration tests"
+       @echo " make test-remote                    Run tests on digital ocean"
+       @echo " make upload-coverage        Upload unit test coverage"
+       @echo " make upload-pypi                    Release ${PACKAGE_NAME} 
package to PyPi"
+       @echo " make clean                                  Cleanup source 
directory"
+       @echo " make prepare                        Prepare ${PACKAGE_NAME} for 
build"
 
 test-unit:
        pytest -v -m unit
 
 test-integration:
-       @rebirthdb&
+       @rethinkdb&
        pytest -v -m integration
-       @killall rebirthdb
+       @killall rethinkdb
 
 test-ci:
-       @rebirthdb&
+       @rethinkdb&
        pytest -v --cov rethinkdb --cov-report xml
-       @killall rebirthdb
+       @killall rethinkdb
 
 test-remote:
        python ${REMOTE_TEST_SETUP_NAME} pytest -m integration
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/README.md 
new/rethinkdb-python-2.4.5/README.md
--- old/rethinkdb-python-2.4.3.post1/README.md  2019-09-04 07:28:13.000000000 
+0200
+++ new/rethinkdb-python-2.4.5/README.md        2020-03-02 07:22:47.000000000 
+0100
@@ -16,9 +16,8 @@
 The main difference with the previous driver (except the name of the package) 
is we are **not** importing RethinkDB as `r`. If you would like to use 
`RethinkDB`'s python driver as a drop in replacement, you should do the 
following:
 
 ```python
-from rethinkdb import RethinkDB
+from rethinkdb import r
 
-r = RethinkDB()
 connection = r.connect(db='test')
 ```
 
@@ -40,9 +39,8 @@
 document.
 
 ```python
-from rethinkdb import RethinkDB
+from rethinkdb import r
 
-r = RethinkDB()
 connection = r.connect(db='test')
 
 r.table_create('marvel').run(connection)
@@ -64,13 +62,12 @@
 
 ```python
 import asyncio
-from rethinkdb import RethinkDB
+from rethinkdb import r
 
 # Native coroutines are supported in Python ≥ 3.5. In Python 3.4, you should
 # use the @asyncio.couroutine decorator instead of "async def", and "yield 
from"
 # instead of "await".
 async def main():
-    r = RethinkDB()
     r.set_loop_type('asyncio')
     connection = await r.connect(db='test')
 
@@ -96,10 +93,9 @@
 
 ```python
 import gevent
-from rethinkdb import RethinkDB
+from rethinkdb import r
 
 def main():
-    r = RethinkDB()
     r.set_loop_type('gevent')
     connection = r.connect(db='test')
 
@@ -122,13 +118,12 @@
 Tornado mode is compatible with Tornado < 5.0.0. Tornado 5 is not supported.
 
 ```python
-from rethinkdb import RethinkDB
+from rethinkdb import r
 from tornado import gen
 from tornado.ioloop import IOLoop
 
 @gen.coroutine
 def main():
-    r = RethinkDB()
     r.set_loop_type('tornado')
     connection = yield r.connect(db='test')
 
@@ -152,11 +147,10 @@
 ### Trio mode
 
 ```python
-from rethinkdb import RethinkDB
+from rethinkdb import r
 import trio
 
 async def main():
-    r = RethinkDB()
     r.set_loop_type('trio')
     async with trio.open_nursery() as nursery:
         async with r.open(db='test', nursery=nursery) as conn:
@@ -191,12 +185,11 @@
 ### Twisted mode
 
 ```python
-from rethinkdb import RethinkDB
+from rethinkdb import r
 from twisted.internet import reactor, defer
 
 @defer.inlineCallbacks
 def main():
-    r = RethinkDB()
     r.set_loop_type('twisted')
     connection = yield r.connect(db='test')
 
@@ -219,7 +212,7 @@
 ```
 
 ## Misc
-Although we recommend to use the import used in the examples, to help the 
migration from rethinkdb<2.4 we introduced a shortcut which can easily replace 
the old `import rethinkdb as r` import with `from rethinkdb import r`. 
+To help the migration from rethinkdb<2.4 we introduced a shortcut which can 
easily replace the old `import rethinkdb as r` import with `from rethinkdb 
import r`.
 
 ## Run tests
 In the `Makefile` you can find three different test commands: `test-unit`, 
`test-integration` and `test-remote`. As RethinkDB has dropped the support of 
Windows, we would like to ensure that those of us who are using Windows for 
development can still contribute. Because of this, we support running 
integration tests against Digital Ocean Droplets as well.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/pytest.ini 
new/rethinkdb-python-2.4.5/pytest.ini
--- old/rethinkdb-python-2.4.3.post1/pytest.ini 2019-09-04 07:28:13.000000000 
+0200
+++ new/rethinkdb-python-2.4.5/pytest.ini       2020-03-02 07:22:47.000000000 
+0100
@@ -3,4 +3,6 @@
 markers =
     unit: Run unit tests
     integration: Run integration tests
-    asyncio: Run asyncio relates tests
\ No newline at end of file
+    trio: Run trio related tests
+    tornado: Run tornado related tests
+    asyncio: Run asyncio related tests
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/requirements.txt 
new/rethinkdb-python-2.4.5/requirements.txt
--- old/rethinkdb-python-2.4.3.post1/requirements.txt   2019-09-04 
07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/requirements.txt 2020-03-02 07:22:47.000000000 
+0100
@@ -1,10 +1,14 @@
 async-generator==1.10; python_version>="3.6"
 codacy-coverage==1.3.11
 mock==3.0.5
-pytest-cov==2.7.1
-pytest-tornasync; python_version >= '3.5'
+pytest-cov==2.8.1
+pytest-tornasync==0.6.0.post2; python_version >= '3.5'
 pytest-trio==0.5.2; python_version>="3.6"
-pytest==4.5.0
-six==1.12.0
-tornado>=5.0
-trio==0.12.1; python_version>="3.6"
+pytest==4.6.6; python_version<"3.5"
+pytest==5.3.5; python_version>="3.5"
+six==1.14.0
+tornado==5.1.1; python_version<"3.6"
+tornado==6.0.3; python_version>="3.6"
+trio==0.13.0; python_version>="3.6"
+outcome==1.0.1; python_version>="3.5"
+attrs==19.3.0; python_version>="3.5"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/rethinkdb/_import.py 
new/rethinkdb-python-2.4.5/rethinkdb/_import.py
--- old/rethinkdb-python-2.4.3.post1/rethinkdb/_import.py       2019-09-04 
07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/rethinkdb/_import.py     2020-03-02 
07:22:47.000000000 +0100
@@ -146,7 +146,11 @@
         self.write_hook = write_hook or []
 
         # options
-        self.source_options = source_options or {}
+        self.source_options = source_options or {
+            "create_args": {
+                "primary_key": self.primary_key
+            }
+        }
 
         # name
         if hasattr(self._source, 'name') and self._source.name:
@@ -249,7 +253,7 @@
             ast.expr([self.table]).set_difference(
                 query.db(self.db).table_list()
             ).for_each(query.db(self.db).table_create(
-                query.row, **self.source_options.create_args if 'create_args' 
in self.source_options else {})
+                query.row, **self.source_options["create_args"] if 
'create_args' in self.source_options else {})
             )
         )
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/rethinkdb/net.py 
new/rethinkdb-python-2.4.5/rethinkdb/net.py
--- old/rethinkdb-python-2.4.3.post1/rethinkdb/net.py   2019-09-04 
07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/rethinkdb/net.py 2020-03-02 07:22:47.000000000 
+0100
@@ -25,6 +25,11 @@
 import struct
 import time
 
+try:
+    from urllib.parse import urlparse, parse_qs
+except ImportError:
+    from urlparse import urlparse, parse_qs
+
 from rethinkdb import ql2_pb2
 from rethinkdb.ast import DB, ReQLDecoder, ReQLEncoder, Repl, expr
 from rethinkdb.errors import (
@@ -703,9 +708,6 @@
         Connection.__init__(self, ConnectionInstance, *args, **kwargs)
 
 
-
-
-
 def make_connection(
         connection_type,
         host=None,
@@ -716,20 +718,40 @@
         password=None,
         timeout=20,
         ssl=None,
+        url=None,
         _handshake_version=10,
         **kwargs):
-    if host is None:
-        host = 'localhost'
-    if port is None:
-        port = DEFAULT_PORT
-    if user is None:
-        user = 'admin'
-    if timeout is None:
-        timeout = 20
-    if ssl is None:
-        ssl = dict()
-    if _handshake_version is None:
-        _handshake_version = 10
+    if url:
+        connection_string = urlparse(url)
+        query_string = parse_qs(connection_string.query)
+
+        user = connection_string.username
+        password = connection_string.password
+        host = connection_string.hostname
+        port = connection_string.port
+
+        db = connection_string.path.replace("/", "") or None
+        auth_key = query_string.get("auth_key")
+        timeout = query_string.get("timeout")
+
+        if auth_key:
+            auth_key = auth_key[0]
+
+        if timeout:
+            timeout = int(timeout[0])
+
+
+    host = host or 'localhost'
+    port = port or DEFAULT_PORT
+    user = user or 'admin'
+    timeout = timeout or 20
+    ssl = ssl or dict()
+    _handshake_version = _handshake_version or 10
+
+    # The internal APIs will wait for none to deal with auth_key and password
+    # TODO: refactor when we drop python2
+    if not password and not password is None:
+        password = None
 
     conn = connection_type(host, port, db, auth_key, user, password, timeout, 
ssl, _handshake_version, **kwargs)
     return conn.reconnect(timeout=timeout)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/scripts/install-db.sh 
new/rethinkdb-python-2.4.5/scripts/install-db.sh
--- old/rethinkdb-python-2.4.3.post1/scripts/install-db.sh      2019-09-04 
07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/scripts/install-db.sh    2020-03-02 
07:22:47.000000000 +0100
@@ -5,10 +5,8 @@
 
 export DISTRIB_CODENAME=$(lsb_release -sc)
 
-# echo "This currently will not work for rethinkdb. It is in the process of 
being fixed."
-# exit 1
-echo "deb https://dl.bintray.com/rebirthdb/apt $DISTRIB_CODENAME main" | sudo 
tee /etc/apt/sources.list.d/rebirthdb.list
-wget -qO- https://dl.bintray.com/rebirthdb/keys/pubkey.gpg | sudo apt-key add -
+echo "deb https://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo 
tee /etc/apt/sources.list.d/rethinkdb.list
+wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
 
 sudo apt-get update --option Acquire::Retries=100 --option 
Acquire::http::Timeout="300"
-sudo apt-get --allow-unauthenticated install rebirthdb --option 
Acquire::Retries=100 --option Acquire::http::Timeout="300"
+sudo apt-get install -y --option Acquire::Retries=100 --option 
Acquire::http::Timeout="300" rethinkdb
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/rethinkdb-python-2.4.3.post1/scripts/prepare_remote_test.py 
new/rethinkdb-python-2.4.5/scripts/prepare_remote_test.py
--- old/rethinkdb-python-2.4.3.post1/scripts/prepare_remote_test.py     
2019-09-04 07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/scripts/prepare_remote_test.py   2020-03-02 
07:22:47.000000000 +0100
@@ -75,9 +75,6 @@
         std_in, _, std_err = self.ssh_client.exec_command(command)
         std_in.close()
 
-        #for line in std_out.readlines():
-        #    print(line.replace('\n', ''))
-
         has_err = False
         for line in std_err.readlines():
             has_err = True
@@ -134,22 +131,23 @@
             return self.__enter__()
         return self
 
-    def install_rebirthdb(self):
-        self._print_info('getting rebirthdb')
-        self._execute_command('source /etc/lsb-release && echo "deb 
https://dl.bintray.com/{username}/apt $DISTRIB_CODENAME main" | tee 
/etc/apt/sources.list.d/rebirthdb.list'.format(username=BINTRAY_USERNAME))
-        self._execute_command('wget -qO- 
https://dl.bintray.com/{username}/keys/pubkey.gpg | apt-key add 
-'.format(username=BINTRAY_USERNAME))
-
-        self._print_info('installing rebirthdb')
-        self._execute_command('apt-get update && 
DEBIAN_FRONTEND=noninteractive apt-get install -y rebirthdb')
-        self._execute_command('echo "bind=all" > 
/etc/rebirthdb/instances.d/default.conf')
-
-    def start_rebirthdb(self):
-        self._print_info('restarting rebirthdb')
-        self._execute_command('/etc/init.d/rebirthdb restart')
+    def install_rethinkdb(self):
+        self._print_info('getting rethinkdb')
+        
+        self._execute_command('source /etc/lsb-release && echo "deb 
https://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee 
/etc/apt/sources.list.d/rethinkdb.list')
+        self._execute_command('wget -qO- 
https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -')
+
+        self._print_info('installing rethinkdb')
+        self._execute_command('apt-get update && 
DEBIAN_FRONTEND=noninteractive apt-get install --allow-unauthenticated -y 
rethinkdb')
+        self._execute_command('echo "bind=all" > 
/etc/rethinkdb/instances.d/default.conf')
+
+    def start_rethinkdb(self):
+        self._print_info('restarting rethinkdb')
+        self._execute_command('/etc/init.d/rethinkdb restart')
 
     def run_script(self, script, script_arguments):
         self._print_info('executing script')
-        os.environ["REBIRTHDB_HOST"] = self.droplet.ip_address
+        os.environ["RETHINKDB_HOST"] = self.droplet.ip_address
         check_call([script, ' '.join(script_arguments)])
 
     def __exit__(self, *args):
@@ -176,8 +174,8 @@
     setup.create_droplet()
 
     with setup:
-        setup.install_rebirthdb()
-        setup.start_rebirthdb()
+        setup.install_rethinkdb()
+        setup.start_rethinkdb()
         setup.run_script(script, script_arguments)
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/tests/helpers.py 
new/rethinkdb-python-2.4.5/tests/helpers.py
--- old/rethinkdb-python-2.4.3.post1/tests/helpers.py   2019-09-04 
07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/tests/helpers.py 2020-03-02 07:22:47.000000000 
+0100
@@ -1,28 +1,26 @@
 import os
-from rethinkdb import RethinkDB
+from rethinkdb import r
 
 
 INTEGRATION_TEST_DB = 'integration_test'
 
 
 class IntegrationTestCaseBase(object):
-    r = RethinkDB()
-    conn = None
+    def _create_database(self, conn):
+        if INTEGRATION_TEST_DB not in self.r.db_list().run(conn):
+            self.r.db_create(INTEGRATION_TEST_DB).run(conn)
 
-    def connect(self):
-        self.conn = self.r.connect(
-            host=self.rethinkdb_host
-        )
+        conn.use(INTEGRATION_TEST_DB)
 
     def setup_method(self):
-        self.rethinkdb_host=os.getenv('RETHINKDB_HOST')
-
-        self.connect()
+        self.r = r
+        self.rethinkdb_host = os.getenv('RETHINKDB_HOST', '127.0.0.1')
 
-        if INTEGRATION_TEST_DB not in self.r.db_list().run(self.conn):
-            self.r.db_create(INTEGRATION_TEST_DB).run(self.conn)
+        self.conn = self.r.connect(
+            host=self.rethinkdb_host
+        )
 
-        self.conn.use(INTEGRATION_TEST_DB)
+        self._create_database(self.conn)
 
     def teardown_method(self):
         self.r.db_drop(INTEGRATION_TEST_DB).run(self.conn)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/rethinkdb-python-2.4.3.post1/tests/integration/test_asyncio.py 
new/rethinkdb-python-2.4.5/tests/integration/test_asyncio.py
--- old/rethinkdb-python-2.4.3.post1/tests/integration/test_asyncio.py  
2019-09-04 07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/tests/integration/test_asyncio.py        
2020-03-02 07:22:47.000000000 +0100
@@ -1,48 +1,43 @@
-import os
 import sys
-from collections import namedtuple
 import pytest
-from rethinkdb import RethinkDB
-from rethinkdb.errors import ReqlRuntimeError
 
-Helper = namedtuple("Helper", "r connection")
-
-INTEGRATION_TEST_DB = 'integration_test'
+from asyncio import coroutine
+from tests.helpers import INTEGRATION_TEST_DB, IntegrationTestCaseBase
 
 
 @pytest.mark.asyncio
 @pytest.mark.integration
-@pytest.mark.skipif(sys.version_info < (3, 6),
-                    reason="requires python3.6 or higher")
-async def test_flow():
-    """
-    Test the flow for 3.6 and up, async generators are
-    not supported in 3.5.
-    """
-
-    r = RethinkDB()
-    r.set_loop_type("asyncio")
-
-    connection = await r.connect(os.getenv("REBIRTHDB_HOST"))
-
-    try:
-        await r.db_create(INTEGRATION_TEST_DB).run(connection)
-    except ReqlRuntimeError:
-        pass
-
-    connection.use(INTEGRATION_TEST_DB)
-
-    await r.table_create("marvel").run(connection)
-
-    marvel_heroes = r.table('marvel')
-    await marvel_heroes.insert({
-        'id': 1,
-        'name': 'Iron Man',
-        'first_appearance': 'Tales of Suspense #39'
-    }).run(connection)
-
-    cursor = await marvel_heroes.run(connection)
-    async for hero in cursor:
-        assert hero['name'] == 'Iron Man'
+@pytest.mark.skipif(
+    sys.version_info == (3, 4) or sys.version_info == (3, 5),
+    reason="requires python3.4 or python3.5"
+)
+class TestAsyncio(IntegrationTestCaseBase):
+    def setup_method(self):
+        super(TestAsyncio, self).setup_method()
+        self.table_name = 'test_asyncio'
+        self.r.set_loop_type('asyncio')
+
+    def teardown_method(self):
+        super(TestAsyncio, self).teardown_method()
+        self.r.set_loop_type(None)
+
+    @coroutine
+    def test_flow_coroutine_paradigm(self):
+        connection = yield from self.conn
+
+        yield from self.r.table_create(self.table_name).run(connection)
+
+        table = self.r.table(self.table_name)
+        yield from table.insert({
+            'id': 1,
+            'name': 'Iron Man',
+            'first_appearance': 'Tales of Suspense #39'
+        }).run(connection)
+
+        cursor = yield from table.run(connection)
+
+        while (yield from cursor.fetch_next()):
+            hero = yield from cursor.__anext__()
+            assert hero['name'] == 'Iron Man'
 
-    await connection.close()
\ No newline at end of file
+        yield from connection.close()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/rethinkdb-python-2.4.3.post1/tests/integration/test_asyncio_coroutine.py 
new/rethinkdb-python-2.4.5/tests/integration/test_asyncio_coroutine.py
--- 
old/rethinkdb-python-2.4.3.post1/tests/integration/test_asyncio_coroutine.py    
    2019-09-04 07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/tests/integration/test_asyncio_coroutine.py      
1970-01-01 01:00:00.000000000 +0100
@@ -1,45 +0,0 @@
-import os
-import sys
-from asyncio import coroutine
-import pytest
-from rethinkdb import RethinkDB
-from rethinkdb.errors import ReqlRuntimeError
-
-
-INTEGRATION_TEST_DB = 'integration_test'
-
-
-@pytest.mark.integration
-@pytest.mark.skipif(sys.version_info == (3, 4) or sys.version_info == (3, 5),
-                    reason="requires python3.4 or python3.5")
-@coroutine
-def test_flow_couroutine_paradigm():
-
-    r = RethinkDB()
-    r.set_loop_type("asyncio")
-
-    connection = yield from r.connect(os.getenv("REBIRTHDB_HOST"))
-
-    try:
-        yield from r.db_create(INTEGRATION_TEST_DB).run(connection)
-    except ReqlRuntimeError:
-        pass
-
-    connection.use(INTEGRATION_TEST_DB)
-
-    yield from r.table_create("marvel").run(connection)
-
-    marvel_heroes = r.table('marvel')
-    yield from marvel_heroes.insert({
-        'id': 1,
-        'name': 'Iron Man',
-        'first_appearance': 'Tales of Suspense #39'
-    }).run(connection)
-
-    cursor = yield from marvel_heroes.run(connection)
-
-    while (yield from cursor.fetch_next()):
-        hero = yield from cursor.__anext__()
-        assert hero['name'] == 'Iron Man'
-
-    yield from connection.close()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/rethinkdb-python-2.4.3.post1/tests/integration/test_connect.py 
new/rethinkdb-python-2.4.5/tests/integration/test_connect.py
--- old/rethinkdb-python-2.4.3.post1/tests/integration/test_connect.py  
1970-01-01 01:00:00.000000000 +0100
+++ new/rethinkdb-python-2.4.5/tests/integration/test_connect.py        
2020-03-02 07:22:47.000000000 +0100
@@ -0,0 +1,29 @@
+import os
+import pytest
+
+from rethinkdb import r
+from tests.helpers import IntegrationTestCaseBase, INTEGRATION_TEST_DB
+
+
+@pytest.mark.integration
+class TestConnect(IntegrationTestCaseBase):
+    def setup_method(self):
+        super(TestConnect, self).setup_method()
+
+    def test_connect(self):
+        db_url = "rethinkdb://{host}".format(host=self.rethinkdb_host)
+
+        assert self.r.connect(url=db_url) is not None
+
+    def test_connect_with_username(self):
+        db_url = "rethinkdb://admin@{host}".format(host=self.rethinkdb_host)
+
+        assert self.r.connect(url=db_url) is not None
+
+    def test_connect_to_db(self):
+        db_url = "rethinkdb://{host}/{database}".format(
+            host=self.rethinkdb_host,
+            database=INTEGRATION_TEST_DB
+        )
+
+        assert self.r.connect(url=db_url) is not None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/rethinkdb-python-2.4.3.post1/tests/integration/test_ping.py 
new/rethinkdb-python-2.4.5/tests/integration/test_ping.py
--- old/rethinkdb-python-2.4.3.post1/tests/integration/test_ping.py     
2019-09-04 07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/tests/integration/test_ping.py   2020-03-02 
07:22:47.000000000 +0100
@@ -33,7 +33,7 @@
                 'replaced': 0,
                 'skipped': 0,
                 'unchanged': 0}
-            curr = self.r.db("rethinkdb").grant(new_user, {"read": 
True}).run(conn)
+            curr = self.r.grant(new_user, {"read": True}).run(conn)
             assert curr == {
                 'granted': 1,
                 'permissions_changes': [
@@ -41,9 +41,12 @@
                         'new_val': {'read': True},
                         'old_val': None}]}
         with self.r.connect(user=new_user, password=BAD_PASSWORD, 
host=self.rethinkdb_host) as conn:
-            curr = self.r.db("rethinkdb").table("users").get("admin").run(conn)
-            assert curr == {'id': 'admin', 'password': False}
             with pytest.raises(self.r.ReqlPermissionError):
+                # Only administrators may access system tables
+                curr = 
self.r.db("rethinkdb").table("users").get("admin").run(conn)
+            
+            with pytest.raises(self.r.ReqlPermissionError):
+                # No permission for write. Only for read.
                 self.r.db("rethinkdb").table("users").insert(
                     {"id": "bob", "password": ""}
                 ).run(conn)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/rethinkdb-python-2.4.3.post1/tests/integration/test_tornado.py 
new/rethinkdb-python-2.4.5/tests/integration/test_tornado.py
--- old/rethinkdb-python-2.4.3.post1/tests/integration/test_tornado.py  
2019-09-04 07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/tests/integration/test_tornado.py        
2020-03-02 07:22:47.000000000 +0100
@@ -1,27 +1,27 @@
-import os
 import sys
-from collections import namedtuple
 import pytest
-from rethinkdb import RethinkDB
-from rethinkdb.errors import ReqlRuntimeError
-
-Helper = namedtuple("Helper", "r connection")
-
-INTEGRATION_TEST_DB = 'integration_test'
+from tests.helpers import IntegrationTestCaseBase
 
 
+@pytest.mark.tornado
 @pytest.mark.integration
 @pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python3.6 or 
higher")
-async def test_tornado_connect(io_loop):
-    """
-    Test the flow for 3.6 and up, async generators are
-    not supported in 3.5.
-    """
-
-    r = RethinkDB()
-    r.set_loop_type("tornado")
+class TestTornado(IntegrationTestCaseBase):
+    def setup_method(self):
+        super(TestTornado, self).setup_method()
+        self.table_name = 'test_tornado'
+        self.r.set_loop_type('tornado')
+        self.r.table_create(self.table_name).run(self.conn)
+
+    def teardown_method(self):
+        super(TestTornado, self).teardown_method()
+        self.r.set_loop_type(None)
+
+    async def test_tornado_list_tables(self):
+        """
+        Test the flow for 3.6 and up, async generators are
+        not supported in 3.5.
+        """
 
-    connection = await r.connect(os.getenv("REBIRTHDB_HOST"))
-    dbs = await r.db_list().run(connection)
-    assert isinstance(dbs, list)
-    await connection.close()
+        tables = self.r.table_list().run(self.conn)
+        assert isinstance(tables, list)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/rethinkdb-python-2.4.3.post1/tests/integration/test_trio.py 
new/rethinkdb-python-2.4.5/tests/integration/test_trio.py
--- old/rethinkdb-python-2.4.3.post1/tests/integration/test_trio.py     
2019-09-04 07:28:13.000000000 +0200
+++ new/rethinkdb-python-2.4.5/tests/integration/test_trio.py   2020-03-02 
07:22:47.000000000 +0100
@@ -1,53 +1,33 @@
-from collections import namedtuple
-import os
-import sys
-
-from async_generator import async_generator, yield_
 import pytest
-from rethinkdb import RethinkDB
-from rethinkdb.errors import ReqlRuntimeError
-import trio
-
-
-INTEGRATION_TEST_DB = 'integration_test'
-r = RethinkDB()
-r.set_loop_type('trio')
-
-
-@pytest.fixture
-@async_generator
-async def integration_db(nursery):
-    async with r.open(db='test', nursery=nursery) as conn:
-        try:
-            await r.db_create(INTEGRATION_TEST_DB).run(conn)
-        except ReqlRuntimeError:
-            pass
-    await yield_(r.db(INTEGRATION_TEST_DB))
-
-
-@pytest.fixture
-@async_generator
-async def marvel_table(integration_db, nursery):
-    async with r.open(db='test', nursery=nursery) as conn:
-        await r.table_create('marvel').run(conn)
-        await yield_(r.table('marvel'))
-        await r.table_drop('marvel').run(conn)
+from tests.helpers import INTEGRATION_TEST_DB, IntegrationTestCaseBase
 
 
 @pytest.mark.trio
 @pytest.mark.integration
-async def test_trio(marvel_table, nursery):
-    """
-    Test the flow for 3.6 and up, async generators are
-    not supported in 3.5.
-    """
-    async with r.open(db='test', nursery=nursery) as conn:
-        await marvel_table.insert({
-            'id': 1,
-            'name': 'Iron Man',
-            'first_appearance': 'Tales of Suspense #39'
-        }).run(conn)
-
-        cursor = await marvel_table.run(conn)
-        async for hero in cursor:
-            hero['name'] == 'Iron Man'
+class TestTrio(IntegrationTestCaseBase):
+    def setup_method(self):
+        super(TestTrio, self).setup_method()
+        self.table_name = 'test_trio'
+        self.r.set_loop_type('trio')
+        self.r.table_create(self.table_name).run(self.conn)
+
+    def teardown_method(self):
+        super(TestTrio, self).teardown_method()
+        self.r.set_loop_type(None)
+    
+    async def test_trio(self, nursery):
+        """
+        Test the flow for 3.6 and up, async generators are
+        not supported in 3.5.
+        """
+
+        async with self.r.open(db=INTEGRATION_TEST_DB, nursery=nursery) as 
conn:
+            await self.r.table(self.table_name).insert({
+                'id': 1,
+                'name': 'Iron Man',
+                'first_appearance': 'Tales of Suspense #39'
+            }).run(conn)
+
+            cursor = await self.r.table(self.table_name).run(conn)
+            async for hero in cursor:
+                hero['name'] == 'Iron Man'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/rethinkdb-python-2.4.3.post1/tests/integration/test_write_hooks.py 
new/rethinkdb-python-2.4.5/tests/integration/test_write_hooks.py
--- old/rethinkdb-python-2.4.3.post1/tests/integration/test_write_hooks.py      
1970-01-01 01:00:00.000000000 +0100
+++ new/rethinkdb-python-2.4.5/tests/integration/test_write_hooks.py    
2020-03-02 07:22:47.000000000 +0100
@@ -0,0 +1,51 @@
+import pytest
+
+from tests.helpers import IntegrationTestCaseBase
+
+@pytest.mark.integration
+class TestWriteHooks(IntegrationTestCaseBase):
+    def setup_method(self):
+        super(TestWriteHooks, self).setup_method()
+
+        self.table_name = 'test_write_hooks'
+        self.documents = [
+            {'id': 1, 'name': 'Testing write hooks 1'},
+        ]
+
+        self.r.table_create(self.table_name).run(self.conn)
+        self.r.table(self.table_name).insert(self.documents).run(self.conn)
+
+    def test_set_write_hook(self):
+        response = self.r.table(self.table_name).set_write_hook(lambda 
context, old_val, new_val:
+            new_val.merge({
+                'modified_at': context['timestamp']
+            })
+        ).run(self.conn)
+
+        assert response == {'created': 1}
+
+    def test_write_hook_add_extra_data(self):
+        self.r.table(self.table_name).set_write_hook(lambda context, old_val, 
new_val:
+            new_val.merge({
+                'modified_at': context['timestamp']
+            })
+        ).run(self.conn)
+
+        self.r.table(self.table_name).insert({
+            'id': 2, 'name': 'Testing write hooks 1'
+        }).run(self.conn)
+
+        document = self.r.table(self.table_name).get(2).run(self.conn)
+
+        assert document.get('modified_at') != None
+
+    def test_get_write_hook(self):
+        self.r.table(self.table_name).set_write_hook(lambda context, old_val, 
new_val:
+            new_val.merge({
+                'modified_at': context['timestamp']
+            })
+        ).run(self.conn)
+
+        hook = self.r.table(self.table_name).get_write_hook().run(self.conn)
+
+        assert list(sorted(hook.keys())) == ['function', 'query']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/rethinkdb-python-2.4.3.post1/tests/test_net.py 
new/rethinkdb-python-2.4.5/tests/test_net.py
--- old/rethinkdb-python-2.4.3.post1/tests/test_net.py  1970-01-01 
01:00:00.000000000 +0100
+++ new/rethinkdb-python-2.4.5/tests/test_net.py        2020-03-02 
07:22:47.000000000 +0100
@@ -0,0 +1,200 @@
+import pytest
+from mock import Mock, ANY
+from rethinkdb.net import make_connection, DefaultConnection, DEFAULT_PORT
+
+
+@pytest.mark.unit
+class TestMakeConnection(object):
+    def setup_method(self):
+        self.reconnect = Mock()
+        self.conn_type = Mock()
+        self.conn_type.return_value.reconnect.return_value = self.reconnect
+
+        self.host = "myhost"
+        self.port = 1234
+        self.db = "mydb"
+        self.auth_key = None
+        self.user = "gabor"
+        self.password = "strongpass"
+        self.timeout = 20
+
+
+    def test_make_connection(self):
+        ssl = dict()
+        _handshake_version = 10
+
+        conn = make_connection(
+            self.conn_type,
+            host=self.host,
+            port=self.port,
+            db=self.db,
+            auth_key=self.auth_key,
+            user=self.user,
+            password=self.password,
+            timeout=self.timeout,
+        )
+
+        assert conn == self.reconnect
+        self.conn_type.assert_called_once_with(
+            self.host,
+            self.port,
+            self.db,
+            self.auth_key,
+            self.user,
+            self.password,
+            self.timeout,
+            ssl,
+            _handshake_version
+        )
+
+
+    def test_make_connection_db_url(self):
+        url = 
"rethinkdb://gabor:strongpass@myhost:1234/mydb?auth_key=mykey&timeout=30"
+        ssl = dict()
+        _handshake_version = 10
+
+        conn = make_connection(self.conn_type, url=url)
+
+        assert conn == self.reconnect
+        self.conn_type.assert_called_once_with(
+            self.host,
+            self.port,
+            self.db,
+            "mykey",
+            self.user,
+            self.password,
+            30,
+            ssl,
+            _handshake_version
+        )
+
+
+    def test_make_connection_no_host(self):
+        conn = make_connection(
+            self.conn_type,
+            port=self.port,
+            db=self.db,
+            auth_key=self.auth_key,
+            user=self.user,
+            password=self.password,
+            timeout=self.timeout,
+        )
+
+        assert conn == self.reconnect
+        self.conn_type.assert_called_once_with(
+            "localhost",
+            self.port,
+            self.db,
+            self.auth_key,
+            self.user,
+            self.password,
+            self.timeout,
+            ANY,
+            ANY
+        )
+
+
+    def test_make_connection_no_port(self):
+        conn = make_connection(
+            self.conn_type,
+            host=self.host,
+            db=self.db,
+            auth_key=self.auth_key,
+            user=self.user,
+            password=self.password,
+            timeout=self.timeout,
+        )
+
+        assert conn == self.reconnect
+        self.conn_type.assert_called_once_with(
+            self.host,
+            DEFAULT_PORT,
+            self.db,
+            self.auth_key,
+            self.user,
+            self.password,
+            self.timeout,
+            ANY,
+            ANY
+        )
+
+
+    def test_make_connection_no_user(self):
+        conn = make_connection(
+            self.conn_type,
+            host=self.host,
+            port=self.port,
+            db=self.db,
+            auth_key=self.auth_key,
+            password=self.password,
+            timeout=self.timeout,
+        )
+
+        assert conn == self.reconnect
+        self.conn_type.assert_called_once_with(
+            self.host,
+            self.port,
+            self.db,
+            self.auth_key,
+            "admin",
+            self.password,
+            self.timeout,
+            ANY,
+            ANY
+        )
+
+
+    def test_make_connection_with_ssl(self):
+        ssl = dict()
+
+        conn = make_connection(
+            self.conn_type,
+            host=self.host,
+            port=self.port,
+            db=self.db,
+            auth_key=self.auth_key,
+            user=self.user,
+            password=self.password,
+            timeout=self.timeout,
+            ssl=ssl,
+        )
+
+        assert conn == self.reconnect
+        self.conn_type.assert_called_once_with(
+            self.host,
+            self.port,
+            self.db,
+            self.auth_key,
+            self.user,
+            self.password,
+            self.timeout,
+            ssl,
+            ANY
+        )
+
+
+    def test_make_connection_different_handshake_version(self):
+        conn = make_connection(
+            self.conn_type,
+            host=self.host,
+            port=self.port,
+            db=self.db,
+            auth_key=self.auth_key,
+            user=self.user,
+            password=self.password,
+            timeout=self.timeout,
+            _handshake_version=20,
+        )
+
+        assert conn == self.reconnect
+        self.conn_type.assert_called_once_with(
+            self.host,
+            self.port,
+            self.db,
+            self.auth_key,
+            self.user,
+            self.password,
+            self.timeout,
+            ANY,
+            20
+        )


Reply via email to