Hello community, here is the log from the commit of package python-sqlitedict for openSUSE:Factory checked in at 2019-04-11 12:17:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-sqlitedict (Old) and /work/SRC/openSUSE:Factory/.python-sqlitedict.new.27019 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-sqlitedict" Thu Apr 11 12:17:36 2019 rev:4 rq:693000 version:1.6.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-sqlitedict/python-sqlitedict.changes 2018-12-24 11:44:40.785277256 +0100 +++ /work/SRC/openSUSE:Factory/.python-sqlitedict.new.27019/python-sqlitedict.changes 2019-04-11 12:17:38.628945828 +0200 @@ -1,0 +2,7 @@ +Wed Apr 10 18:49:46 UTC 2019 - [email protected] + +- version update to 1.6.0 + * Add `get_tablenames` method (@transfluxus, #72) + * Add license files to dist (@toddrme2178, #79) + +------------------------------------------------------------------- Old: ---- sqlitedict-1.5.0.tar.gz New: ---- sqlitedict-1.6.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-sqlitedict.spec ++++++ --- /var/tmp/diff_new_pack.7Ly3RY/_old 2019-04-11 12:17:39.528946282 +0200 +++ /var/tmp/diff_new_pack.7Ly3RY/_new 2019-04-11 12:17:39.528946282 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-sqlitedict # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # 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-sqlitedict -Version: 1.5.0 +Version: 1.6.0 Release: 0 Summary: Persistent dict in Python backed by sqlite3 License: Apache-2.0 @@ -51,13 +51,15 @@ %python_expand %fdupes %{buildroot}%{$python_sitearch} %check -%{python_expand mkdir -p tests/db -nosetests-%{$python_bin_suffix} +%{python_expand rm -rf tests/db +mkdir -p tests/db +nosetests-%{$python_bin_suffix} } %files %{python_files} %defattr(-,root,root,-) +%license LICENSE.apache %doc README.rst %{python_sitelib}/* ++++++ sqlitedict-1.5.0.tar.gz -> sqlitedict-1.6.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/LICENSE.apache new/sqlitedict-1.6.0/LICENSE.apache --- old/sqlitedict-1.5.0/LICENSE.apache 1970-01-01 01:00:00.000000000 +0100 +++ new/sqlitedict-1.6.0/LICENSE.apache 2018-09-18 07:58:20.000000000 +0200 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2011-now `Radim Řehůřek <http://radimrehurek.com>`_ and contributors. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/LICENSE.rst new/sqlitedict-1.6.0/LICENSE.rst --- old/sqlitedict-1.5.0/LICENSE.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/sqlitedict-1.6.0/LICENSE.rst 2018-09-18 07:58:20.000000000 +0200 @@ -0,0 +1,2 @@ +``sqlitedict`` is open source software released under the `Apache 2.0 license <http://opensource.org/licenses/apache2.0.php>`_. +Copyright (c) 2011-now `Radim Řehůřek <http://radimrehurek.com>`_ and contributors. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/MANIFEST.in new/sqlitedict-1.6.0/MANIFEST.in --- old/sqlitedict-1.5.0/MANIFEST.in 2017-02-14 01:11:09.000000000 +0100 +++ new/sqlitedict-1.6.0/MANIFEST.in 2018-09-18 07:58:20.000000000 +0200 @@ -2,4 +2,6 @@ include setup.py include sqlitedict.py include Makefile +include LICENSE.apache +include LICENSE.rst recursive-include tests * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/PKG-INFO new/sqlitedict-1.6.0/PKG-INFO --- old/sqlitedict-1.5.0/PKG-INFO 2017-02-14 01:17:16.000000000 +0100 +++ new/sqlitedict-1.6.0/PKG-INFO 2018-09-18 08:39:37.000000000 +0200 @@ -1,10 +1,12 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: sqlitedict -Version: 1.5.0 +Version: 1.6.0 Summary: Persistent dict in Python, backed up by sqlite3 and pickle, multithread-safe. Home-page: https://github.com/piskvorky/sqlitedict -Author: Radim Rehurek +Author: Radim Rehurek, Victor R. Escobar, Andrey Usov, Prasanna Swaminathan, Jeff Quast Author-email: [email protected] +Maintainer: Radim Rehurek +Maintainer-email: [email protected] License: Apache 2.0 Download-URL: http://pypi.python.org/pypi/sqlitedict Description: ================================================================= @@ -14,7 +16,7 @@ |Travis|_ |License|_ - .. |Travis| image:: https://img.shields.io/travis/RaRe-Technologies/sqlitedict.svg + .. |Travis| image:: https://travis-ci.org/RaRe-Technologies/sqlitedict.svg?branch=master .. |Downloads| image:: https://img.shields.io/pypi/dm/sqlitedict.svg .. |License| image:: https://img.shields.io/pypi/l/sqlitedict.svg .. _Travis: https://travis-ci.org/RaRe-Technologies/sqlitedict @@ -90,7 +92,7 @@ Install or upgrade with:: - easy_install -U sqlitedict + pip install -U sqlitedict or from the `source tar.gz <http://pypi.python.org/pypi/sqlitedict>`_:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/README.rst new/sqlitedict-1.6.0/README.rst --- old/sqlitedict-1.5.0/README.rst 2017-02-14 01:11:09.000000000 +0100 +++ new/sqlitedict-1.6.0/README.rst 2018-09-18 07:58:20.000000000 +0200 @@ -5,7 +5,7 @@ |Travis|_ |License|_ -.. |Travis| image:: https://img.shields.io/travis/RaRe-Technologies/sqlitedict.svg +.. |Travis| image:: https://travis-ci.org/RaRe-Technologies/sqlitedict.svg?branch=master .. |Downloads| image:: https://img.shields.io/pypi/dm/sqlitedict.svg .. |License| image:: https://img.shields.io/pypi/l/sqlitedict.svg .. _Travis: https://travis-ci.org/RaRe-Technologies/sqlitedict @@ -81,7 +81,7 @@ Install or upgrade with:: - easy_install -U sqlitedict + pip install -U sqlitedict or from the `source tar.gz <http://pypi.python.org/pypi/sqlitedict>`_:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/setup.cfg new/sqlitedict-1.6.0/setup.cfg --- old/sqlitedict-1.5.0/setup.cfg 2017-02-14 01:17:16.000000000 +0100 +++ new/sqlitedict-1.6.0/setup.cfg 2018-09-18 08:39:37.000000000 +0200 @@ -1,5 +1,4 @@ [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/setup.py new/sqlitedict-1.6.0/setup.py --- old/sqlitedict-1.5.0/setup.py 2017-02-14 01:11:09.000000000 +0100 +++ new/sqlitedict-1.6.0/setup.py 2018-09-18 08:39:04.000000000 +0200 @@ -46,7 +46,7 @@ setup( name='sqlitedict', - version='1.5.0', + version='1.6.0', description='Persistent dict in Python, backed up by sqlite3 and pickle, multithread-safe.', long_description=read('README.rst'), @@ -55,7 +55,7 @@ # there is a bug in python2.5, preventing distutils from using any non-ascii characters :( # http://bugs.python.org/issue2562 author='Radim Rehurek, Victor R. Escobar, Andrey Usov, Prasanna Swaminathan, Jeff Quast', - author_email="various", + author_email="[email protected]", maintainer='Radim Rehurek', maintainer_email='[email protected]', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/sqlitedict.egg-info/PKG-INFO new/sqlitedict-1.6.0/sqlitedict.egg-info/PKG-INFO --- old/sqlitedict-1.5.0/sqlitedict.egg-info/PKG-INFO 2017-02-14 01:17:13.000000000 +0100 +++ new/sqlitedict-1.6.0/sqlitedict.egg-info/PKG-INFO 2018-09-18 08:39:37.000000000 +0200 @@ -1,10 +1,12 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: sqlitedict -Version: 1.5.0 +Version: 1.6.0 Summary: Persistent dict in Python, backed up by sqlite3 and pickle, multithread-safe. Home-page: https://github.com/piskvorky/sqlitedict -Author: Radim Rehurek +Author: Radim Rehurek, Victor R. Escobar, Andrey Usov, Prasanna Swaminathan, Jeff Quast Author-email: [email protected] +Maintainer: Radim Rehurek +Maintainer-email: [email protected] License: Apache 2.0 Download-URL: http://pypi.python.org/pypi/sqlitedict Description: ================================================================= @@ -14,7 +16,7 @@ |Travis|_ |License|_ - .. |Travis| image:: https://img.shields.io/travis/RaRe-Technologies/sqlitedict.svg + .. |Travis| image:: https://travis-ci.org/RaRe-Technologies/sqlitedict.svg?branch=master .. |Downloads| image:: https://img.shields.io/pypi/dm/sqlitedict.svg .. |License| image:: https://img.shields.io/pypi/l/sqlitedict.svg .. _Travis: https://travis-ci.org/RaRe-Technologies/sqlitedict @@ -90,7 +92,7 @@ Install or upgrade with:: - easy_install -U sqlitedict + pip install -U sqlitedict or from the `source tar.gz <http://pypi.python.org/pypi/sqlitedict>`_:: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/sqlitedict.egg-info/SOURCES.txt new/sqlitedict-1.6.0/sqlitedict.egg-info/SOURCES.txt --- old/sqlitedict-1.5.0/sqlitedict.egg-info/SOURCES.txt 2017-02-14 01:17:14.000000000 +0100 +++ new/sqlitedict-1.6.0/sqlitedict.egg-info/SOURCES.txt 2018-09-18 08:39:37.000000000 +0200 @@ -1,3 +1,5 @@ +LICENSE.apache +LICENSE.rst MANIFEST.in Makefile README.rst @@ -18,4 +20,6 @@ tests/test_temp_db.py tests/test_temp_db.pyc tests/db/sqlitedict-override-test.sqlite -tests/db/sqlitedict-with-def.sqlite \ No newline at end of file +tests/db/sqlitedict-with-def.sqlite +tests/db/tablenames-test-1.sqlite +tests/db/tablenames-test-2.sqlite \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/sqlitedict.py new/sqlitedict-1.6.0/sqlitedict.py --- old/sqlitedict-1.5.0/sqlitedict.py 2017-02-14 01:11:09.000000000 +0100 +++ new/sqlitedict-1.6.0/sqlitedict.py 2018-09-18 07:58:20.000000000 +0200 @@ -288,6 +288,18 @@ self.conn.execute(CLEAR_ALL) self.conn.commit() + @staticmethod + def get_tablenames(filename): + """get the names of the tables in an sqlite db as a list""" + if not os.path.isfile(filename): + raise IOError('file %s does not exist' % (filename)) + GET_TABLENAMES = 'SELECT name FROM sqlite_master WHERE type="table"' + with sqlite3.connect(filename) as conn: + cursor = conn.execute(GET_TABLENAMES) + res = cursor.fetchall() + + return [name[0] for name in res] + def commit(self, blocking=True): """ Persist all data to disk. Binary files old/sqlitedict-1.5.0/tests/accessories.pyc and new/sqlitedict-1.6.0/tests/accessories.pyc differ Binary files old/sqlitedict-1.5.0/tests/db/sqlitedict-override-test.sqlite and new/sqlitedict-1.6.0/tests/db/sqlitedict-override-test.sqlite differ Binary files old/sqlitedict-1.5.0/tests/db/sqlitedict-with-def.sqlite and new/sqlitedict-1.6.0/tests/db/sqlitedict-with-def.sqlite differ Binary files old/sqlitedict-1.5.0/tests/db/tablenames-test-1.sqlite and new/sqlitedict-1.6.0/tests/db/tablenames-test-1.sqlite differ Binary files old/sqlitedict-1.5.0/tests/db/tablenames-test-2.sqlite and new/sqlitedict-1.6.0/tests/db/tablenames-test-2.sqlite differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/tests/test_core.py new/sqlitedict-1.6.0/tests/test_core.py --- old/sqlitedict-1.5.0/tests/test_core.py 2017-02-14 01:11:09.000000000 +0100 +++ new/sqlitedict-1.6.0/tests/test_core.py 2018-09-18 07:58:20.000000000 +0200 @@ -7,6 +7,7 @@ # local import sqlitedict +from sqlitedict import SqliteDict from test_temp_db import TempSqliteDictTest from accessories import norm_file, TestCaseBackport @@ -15,8 +16,8 @@ def test_with_statement(self): """Verify using sqlitedict as a contextmanager . """ - with sqlitedict.SqliteDict() as d: - self.assertTrue(isinstance(d, sqlitedict.SqliteDict)) + with SqliteDict() as d: + self.assertTrue(isinstance(d, SqliteDict)) self.assertEqual(dict(d), {}) self.assertEqual(list(d), []) self.assertEqual(len(d), 0) @@ -24,7 +25,7 @@ def test_reopen_conn(self): """Verify using a contextmanager that a connection can be reopened.""" fname = norm_file('tests/db/sqlitedict-override-test.sqlite') - db = sqlitedict.SqliteDict(filename=fname) + db = SqliteDict(filename=fname) with db: db['key'] = 'value' db.commit() @@ -35,7 +36,7 @@ def test_as_str(self): """Verify SqliteDict.__str__().""" # given, - db = sqlitedict.SqliteDict() + db = SqliteDict() # exercise db.__str__() # test when db closed @@ -45,7 +46,7 @@ def test_as_repr(self): """Verify SqliteDict.__repr__().""" # given, - db = sqlitedict.SqliteDict() + db = SqliteDict() # exercise db.__repr__() @@ -56,12 +57,12 @@ os.rmdir(folder) # exercise, with self.assertRaises(RuntimeError): - sqlitedict.SqliteDict(filename=os.path.join(folder, 'nonexistent')) + SqliteDict(filename=os.path.join(folder, 'nonexistent')) def test_commit_nonblocking(self): """Coverage for non-blocking commit.""" # given, - with sqlitedict.SqliteDict(autocommit=True) as d: + with SqliteDict(autocommit=True) as d: # exercise: the implicit commit is nonblocking d['key'] = 'value' d.commit(blocking=False) @@ -74,12 +75,12 @@ """Re-opening of a database does not destroy it.""" # given, fname = norm_file('tests/db/sqlitedict-override-test.sqlite') - orig_db = sqlitedict.SqliteDict(filename=fname) + orig_db = SqliteDict(filename=fname) orig_db['key'] = 'value' orig_db.commit() orig_db.close() - next_db = sqlitedict.SqliteDict(filename=fname) + next_db = SqliteDict(filename=fname) self.assertIn('key', next_db.keys()) self.assertEqual(next_db['key'], 'value') @@ -87,33 +88,33 @@ """Re-opening of a database with flag='c' destroys it all.""" # given, fname = norm_file('tests/db/sqlitedict-override-test.sqlite') - orig_db = sqlitedict.SqliteDict(filename=fname, tablename='sometable') + orig_db = SqliteDict(filename=fname, tablename='sometable') orig_db['key'] = 'value' orig_db.commit() orig_db.close() # verify, - next_db = sqlitedict.SqliteDict(filename=fname, tablename='sometable', flag='n') + next_db = SqliteDict(filename=fname, tablename='sometable', flag='n') self.assertNotIn('key', next_db.keys()) def test_unrecognized_flag(self): def build_with_bad_flag(): fname = norm_file('tests/db/sqlitedict-override-test.sqlite') - orig_db = sqlitedict.SqliteDict(filename=fname, flag = 'FOO') + orig_db = SqliteDict(filename=fname, flag = 'FOO') with self.assertRaises(RuntimeError): build_with_bad_flag() def test_readonly(self): fname = norm_file('tests/db/sqlitedict-override-test.sqlite') - orig_db = sqlitedict.SqliteDict(filename=fname) + orig_db = SqliteDict(filename=fname) orig_db['key'] = 'value' orig_db['key_two'] = 2 orig_db.commit() orig_db.close() - readonly_db = sqlitedict.SqliteDict(filename=fname, flag = 'r') + readonly_db = SqliteDict(filename=fname, flag = 'r') self.assertTrue(readonly_db['key'] == 'value') self.assertTrue(readonly_db['key_two'] == 2) @@ -144,31 +145,31 @@ def test_irregular_tablenames(self): """Irregular table names need to be quoted""" - db = sqlitedict.SqliteDict(':memory:', tablename='9nine') + db = SqliteDict(':memory:', tablename='9nine') db['key'] = 'value' db.commit() self.assertEqual(db['key'], 'value') db.close() - db = sqlitedict.SqliteDict(':memory:', tablename='outer space') + db = SqliteDict(':memory:', tablename='outer space') db['key'] = 'value' db.commit() self.assertEqual(db['key'], 'value') db.close() with self.assertRaisesRegexp(ValueError, r'^Invalid tablename '): - sqlitedict.SqliteDict(':memory:', '"') + SqliteDict(':memory:', '"') def test_overwrite_using_flag_w(self): """Re-opening of a database with flag='w' destroys only the target table.""" # given, fname = norm_file('tests/db/sqlitedict-override-test.sqlite') - orig_db_1 = sqlitedict.SqliteDict(filename=fname, tablename='one') + orig_db_1 = SqliteDict(filename=fname, tablename='one') orig_db_1['key'] = 'value' orig_db_1.commit() orig_db_1.close() - orig_db_2 = sqlitedict.SqliteDict(filename=fname, tablename='two') + orig_db_2 = SqliteDict(filename=fname, tablename='two') orig_db_2['key'] = 'value' orig_db_2.commit() orig_db_2.close() @@ -176,10 +177,10 @@ # verify, when re-opening table space 'one' with flag='2', we destroy # its contents. However, when re-opening table space 'two' with # default flag='r', its contents remain. - next_db_1 = sqlitedict.SqliteDict(filename=fname, tablename='one', flag='w') + next_db_1 = SqliteDict(filename=fname, tablename='one', flag='w') self.assertNotIn('key', next_db_1.keys()) - next_db_2 = sqlitedict.SqliteDict(filename=fname, tablename='two') + next_db_2 = SqliteDict(filename=fname, tablename='two') self.assertIn('key', next_db_2.keys()) class SqliteDictTerminateTest(unittest.TestCase): @@ -199,7 +200,7 @@ def setUp(self): self.fname = norm_file('tests/db-permdenied/sqlitedict.sqlite') - self.db = sqlitedict.SqliteDict(filename=self.fname) + self.db = SqliteDict(filename=self.fname) os.chmod(self.fname, 0o000) os.chmod(os.path.dirname(self.fname), 0o000) @@ -221,7 +222,7 @@ class SqliteDictJsonSerializationTest(unittest.TestCase): def setUp(self): self.fname = norm_file('tests/db-json/sqlitedict.sqlite') - self.db = sqlitedict.SqliteDict( + self.db = SqliteDict( filename=self.fname, tablename='test', encode=json.dumps, decode=json.loads ) @@ -262,3 +263,20 @@ self.db['test'] = test_value assert self.db['test'] == test_value assert self.get_json('test') == json.dumps(test_value) + + +class TablenamesTest(TestCaseBackport): + + def test_tablenames(self): + fname = norm_file('tests/db/tablenames-test-1.sqlite') + SqliteDict(fname) + self.assertEqual(SqliteDict.get_tablenames(fname), ['unnamed']) + + fname = norm_file('tests/db/tablenames-test-2.sqlite') + with SqliteDict(fname,tablename='table1') as db1: + self.assertEqual(SqliteDict.get_tablenames(fname), ['table1']) + with SqliteDict(fname,tablename='table2') as db2: + self.assertEqual(SqliteDict.get_tablenames(fname), ['table1','table2']) + + tablenames = SqliteDict.get_tablenames('tests/db/tablenames-test-2.sqlite') + self.assertEqual(tablenames, ['table1','table2']) \ No newline at end of file Binary files old/sqlitedict-1.5.0/tests/test_core.pyc and new/sqlitedict-1.6.0/tests/test_core.pyc differ Binary files old/sqlitedict-1.5.0/tests/test_named_db.pyc and new/sqlitedict-1.6.0/tests/test_named_db.pyc differ Binary files old/sqlitedict-1.5.0/tests/test_onimport.pyc and new/sqlitedict-1.6.0/tests/test_onimport.pyc differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/sqlitedict-1.5.0/tests/test_temp_db.py new/sqlitedict-1.6.0/tests/test_temp_db.py --- old/sqlitedict-1.5.0/tests/test_temp_db.py 2017-02-14 01:11:09.000000000 +0100 +++ new/sqlitedict-1.6.0/tests/test_temp_db.py 2018-09-18 07:58:20.000000000 +0200 @@ -11,7 +11,7 @@ from sys import version_info major_version = version_info[0] - +from accessories import norm_file class TempSqliteDictTest(TestCaseBackport): Binary files old/sqlitedict-1.5.0/tests/test_temp_db.pyc and new/sqlitedict-1.6.0/tests/test_temp_db.pyc differ
