diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c8f431c..dc20c70 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,11 +26,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install "setuptools<72" + python -m pip install setuptools 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/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 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 deleted file mode 100644 index f9d64df..0000000 --- a/sample_generator.py +++ /dev/null @@ -1,75 +0,0 @@ -from __future__ import absolute_import -from __future__ import unicode_literals -import random -import six -from six.moves import range - - -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 - 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 - diff --git a/setup.py b/setup.py index 8eb836d..5e5f71f 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', 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)) diff --git a/tox.ini b/tox.ini deleted file mode 100644 index e5e0390..0000000 --- a/tox.ini +++ /dev/null @@ -1,7 +0,0 @@ -[tox] -envlist = py37,py38,py39,py310,py311,py312 -[testenv] -deps = - unittest2 -commands=python setup.py test -