From 0a0308be6cac8f5f030eb1c87207e740f3d1de81 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Wed, 4 Sep 2024 12:03:33 -0400 Subject: [PATCH 1/8] Remove couchdbkit_shim --- couchdbkit_shim/__init__.py | 25 ------------------------- couchdbkit_shim/requirements.txt | 1 - sample_generator.py | 11 +++-------- 3 files changed, 3 insertions(+), 34 deletions(-) delete mode 100644 couchdbkit_shim/__init__.py delete mode 100644 couchdbkit_shim/requirements.txt diff --git a/couchdbkit_shim/__init__.py b/couchdbkit_shim/__init__.py deleted file mode 100644 index 4334e47..0000000 --- a/couchdbkit_shim/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -from __future__ import absolute_import -from __future__ import unicode_literals -import six -__all__ = ['StringProperty', 'IntegerProperty', 'ObjectProperty', 'JsonObject', 'ListProperty'] - -from couchdbkit import ( - StringProperty, - IntegerProperty, - SchemaProperty as ObjectProperty, - DocumentSchema as JsonObject, -) - - -def ListProperty(obj_type): - if issubclass(obj_type, JsonObject): - from couchdbkit import SchemaListProperty - return SchemaListProperty - elif obj_type is int: - from couchdbkit import ListProperty - return ListProperty - elif issubclass(obj_type, six.string_types): - from couchdbkit import StringListProperty - return StringListProperty - else: - raise TypeError(obj_type) diff --git a/couchdbkit_shim/requirements.txt b/couchdbkit_shim/requirements.txt deleted file mode 100644 index 4142500..0000000 --- a/couchdbkit_shim/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -couchdbkit==0.5.7 \ No newline at end of file diff --git a/sample_generator.py b/sample_generator.py index f9d64df..11f7b14 100644 --- a/sample_generator.py +++ b/sample_generator.py @@ -4,14 +4,10 @@ import six from six.moves import range +from . import jsonobject as jo -def generate_object_type(jo=None): - """ - jo can be either jsonobject (default) - or couchdbkit_shim for comparison with couchdbkit - """ - if jo is None: - from . import jsonobject as jo + +def generate_object_type(): WORDS = 'dog cat elephant river candle stripe pin plum'.split() leaf_types = { jo.StringProperty: six.text_type, @@ -72,4 +68,3 @@ def generate_list_type(words=None): return random.choice(list(leaf_types.values())) return generate_object_type(), object_types - From ad025b67c6a9d06b54bd82b9c1401a16da642f51 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Wed, 4 Sep 2024 12:03:44 -0400 Subject: [PATCH 2/8] Remove tox.ini --- tox.ini | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 tox.ini diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 6d05b20..0000000 --- a/tox.ini +++ /dev/null @@ -1,7 +0,0 @@ -[tox] -envlist = py37,py38,py39,py310,py311 -[testenv] -deps = - unittest2 -commands=python setup.py test - From 5bab9ced01e41a27e560b24be76a699cb637d24e Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Wed, 4 Sep 2024 12:13:47 -0400 Subject: [PATCH 3/8] Remove redundant testcouchdbkit.py file --- testcouchdbkit.py | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 testcouchdbkit.py diff --git a/testcouchdbkit.py b/testcouchdbkit.py deleted file mode 100644 index 3e5e41c..0000000 --- a/testcouchdbkit.py +++ /dev/null @@ -1,11 +0,0 @@ -from __future__ import absolute_import -from __future__ import unicode_literals -from test.couchdbkit.application import Application -import os -import json -from io import open - -if __name__ == '__main__': - name = 'large' - with open(os.path.join('test', 'couchdbkit', 'data', '{0}.json'.format(name)), encoding='utf-8') as f: - Application.wrap(json.load(f)) From 2a0185755b27f5fcba7369f2bfe33bfc6e8d4b75 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Wed, 4 Sep 2024 12:15:33 -0400 Subject: [PATCH 4/8] Use built-in unittest --- LIFECYCLE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LIFECYCLE.md b/LIFECYCLE.md index f4ce5bf..0024119 100644 --- a/LIFECYCLE.md +++ b/LIFECYCLE.md @@ -3,7 +3,7 @@ You must rebuild C files for the tests to pick up your changes. Try this for iterating: ``` -$ python setup.py build_ext --inplace && python setup.py test +$ python setup.py build_ext --inplace && python -m unittest ``` # Maintaining built C files From 00c92f82a4f98d4fb59874c6b2b548b21e655ba3 Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Wed, 4 Sep 2024 12:20:42 -0400 Subject: [PATCH 5/8] Don't run tests with setup.py --- .github/workflows/tests.yml | 2 +- setup.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3d2fe57..1fe3570 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,7 +29,7 @@ jobs: python -m pip install -e . - name: Run tests run: | - python setup.py test + python -m unittest - name: Test cython files run: | scripts/install_cython.sh diff --git a/setup.py b/setup.py index 6df6128..929c322 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,6 @@ setup_requires=CYTHON_REQUIRES, install_requires=['six'], ext_modules=extensions, - test_suite='test', classifiers=( 'Programming Language :: Python', 'Programming Language :: Python :: 3', From eb4d2ddd9fcbe145c32ef9d3638d7c8a4f54a38f Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Wed, 4 Sep 2024 13:23:29 -0400 Subject: [PATCH 6/8] Remove unused sample_generator.py --- sample_generator.py | 70 --------------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 sample_generator.py diff --git a/sample_generator.py b/sample_generator.py deleted file mode 100644 index 11f7b14..0000000 --- a/sample_generator.py +++ /dev/null @@ -1,70 +0,0 @@ -from __future__ import absolute_import -from __future__ import unicode_literals -import random -import six -from six.moves import range - -from . import jsonobject as jo - - -def generate_object_type(): - WORDS = 'dog cat elephant river candle stripe pin plum'.split() - leaf_types = { - jo.StringProperty: six.text_type, - jo.IntegerProperty: int, - } - used_phrases = set() - - def get_phrase(n=2): - phrase = tuple(random.sample(WORDS, n)) - if phrase in used_phrases or len(set(phrase)) < n: - phrase = get_phrase() - else: - used_phrases.add(phrase) - return phrase - - def generate_class_name(words=None): - words = words or get_phrase() - return ''.join([s.title() for s in words]) - - def generate_property_name(words=None): - words = words or get_phrase() - return '_'.join(words) - - def generate_list_name(words=None): - words = words or get_phrase() - return generate_property_name(words) + 's' - - object_types = [] - - def generate_object_type(words=None): - class_name = generate_class_name(words) - n_properties = random.choice(list(range(5))) - dct = {} - for _ in range(n_properties): - words = get_phrase() - - property_type = random.choice([ - jo.ObjectProperty, - jo.ListProperty, - Ellipsis - ]) - if property_type is jo.ObjectProperty: - property_name = generate_property_name(words) - dct[property_name] = jo.ObjectProperty(generate_object_type(words)) - elif property_type is jo.ListProperty: - property_name = generate_list_name(words) - dct[property_name] = jo.ListProperty(generate_list_type(words)) - - object_type = type(jo.JsonObject)(class_name, (jo.JsonObject,), dct) - object_types.append(object_type) - return object_type - - def generate_list_type(words=None): - property_type = random.choice([jo.ObjectProperty, Ellipsis]) - if property_type is jo.ObjectProperty: - return generate_object_type(words) - else: - return random.choice(list(leaf_types.values())) - - return generate_object_type(), object_types From b825043df845218a200cb5c1a48384f5eb8cd6ff Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Fri, 6 Sep 2024 10:22:23 -0400 Subject: [PATCH 7/8] Remove setuptools dependency for tests --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f407e4a..0664c77 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,7 +26,6 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install "setuptools<72" python -m pip install -e . - name: Run tests run: | From 226864910c7a139ff264041d4b23c37d0eb617bb Mon Sep 17 00:00:00 2001 From: Graham Herceg Date: Fri, 6 Sep 2024 10:28:34 -0400 Subject: [PATCH 8/8] Install any version of setuptools --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0664c77..dc20c70 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,6 +26,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + python -m pip install setuptools python -m pip install -e . - name: Run tests run: |