diff options
| author | jason | 2019-10-22 11:47:54 -0600 |
|---|---|---|
| committer | jason | 2019-10-24 17:09:58 -0600 |
| commit | 5a303146ffe9289fccaf3411fd0a9ec4e807244c (patch) | |
| tree | 638134576c1b87fa40c8809541d3b28849d95fe9 | |
| parent | 5d27e9a6cabecf357b26216b7afb0880bbaf36ef (diff) | |
| download | eventmq-5a303146ffe9289fccaf3411fd0a9ec4e807244c.tar.gz eventmq-5a303146ffe9289fccaf3411fd0a9ec4e807244c.zip | |
Fix CircleCI testsupdate-circleci-tests
- updates circleci config to better support multiple python versions
- remove unused dateutil library
- remove unused nose library for testing
- fixes unicode() function for py3
- remove metadata claiming support for py26 and py34
- remove unfinished test (causes problems with py2's unittest
discovery)
- fix reload() function for py3 support
| -rw-r--r-- | .circleci/config.yml | 43 | ||||
| -rw-r--r-- | circle.yml | 88 | ||||
| -rw-r--r-- | eventmq/tests/test_utils.py | 5 | ||||
| -rw-r--r-- | eventmq/utils/classes.py | 3 | ||||
| -rw-r--r-- | eventmq/utils/functions.py | 6 | ||||
| -rw-r--r-- | setup.py | 18 |
6 files changed, 58 insertions, 105 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..46dab22 --- /dev/null +++ b/.circleci/config.yml | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | version: 2.1 | ||
| 2 | |||
| 3 | executors: | ||
| 4 | python: | ||
| 5 | parameters: | ||
| 6 | version: | ||
| 7 | type: string | ||
| 8 | default: "3.8" | ||
| 9 | docker: | ||
| 10 | - image: circleci/python:<< parameters.version >> | ||
| 11 | |||
| 12 | commands: | ||
| 13 | setup: | ||
| 14 | description: install dependencies | ||
| 15 | steps: | ||
| 16 | - run: sudo apt-get update && sudo apt-get -y dist-upgrade | ||
| 17 | - run: sudo pip install -e .[testing] | ||
| 18 | |||
| 19 | jobs: | ||
| 20 | test: | ||
| 21 | parameters: | ||
| 22 | version: | ||
| 23 | type: string | ||
| 24 | default: "2.7" | ||
| 25 | executor: | ||
| 26 | name: python | ||
| 27 | version: << parameters.version >> | ||
| 28 | steps: | ||
| 29 | - checkout | ||
| 30 | - setup | ||
| 31 | - run: python --version | ||
| 32 | - run: python -m unittest discover | ||
| 33 | - run: find . -name \*.py -print | xargs flake8 --show-source --statistics | ||
| 34 | |||
| 35 | workflows: | ||
| 36 | test: | ||
| 37 | jobs: | ||
| 38 | - test: | ||
| 39 | name: "python 2.7" | ||
| 40 | version: "2.7" | ||
| 41 | - test: | ||
| 42 | name: "python 3.5" | ||
| 43 | version: "3.5" | ||
diff --git a/circle.yml b/circle.yml deleted file mode 100644 index fade121..0000000 --- a/circle.yml +++ /dev/null | |||
| @@ -1,88 +0,0 @@ | |||
| 1 | version: 2 | ||
| 2 | jobs: | ||
| 3 | build: | ||
| 4 | working_directory: ~/eventmq/eventmq | ||
| 5 | parallelism: 1 | ||
| 6 | shell: /bin/bash --login | ||
| 7 | # CircleCI 2.0 does not support environment variables that refer to each other the same way as 1.0 did. | ||
| 8 | # If any of these refer to each other, rewrite them so that they don't or see https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables . | ||
| 9 | environment: | ||
| 10 | CIRCLE_ARTIFACTS: /tmp/circleci-artifacts | ||
| 11 | CIRCLE_TEST_REPORTS: /tmp/circleci-test-results | ||
| 12 | # In CircleCI 1.0 we used a pre-configured image with a large number of languages and other packages. | ||
| 13 | # In CircleCI 2.0 you can now specify your own image, or use one of our pre-configured images. | ||
| 14 | # The following configuration line tells CircleCI to use the specified docker image as the runtime environment for you job. | ||
| 15 | # We have selected a pre-built image that mirrors the build environment we use on | ||
| 16 | # the 1.0 platform, but we recommend you choose an image more tailored to the needs | ||
| 17 | # of each job. For more information on choosing an image (or alternatively using a | ||
| 18 | # VM instead of a container) see https://circleci.com/docs/2.0/executor-types/ | ||
| 19 | # To see the list of pre-built images that CircleCI provides for most common languages see | ||
| 20 | # https://circleci.com/docs/2.0/circleci-images/ | ||
| 21 | docker: | ||
| 22 | - image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37 | ||
| 23 | command: /sbin/init | ||
| 24 | steps: | ||
| 25 | # Machine Setup | ||
| 26 | # If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each | ||
| 27 | # The following `checkout` command checks out your code to your working directory. In 1.0 we did this implicitly. In 2.0 you can choose where in the course of a job your code should be checked out. | ||
| 28 | - checkout | ||
| 29 | # Prepare for artifact and test results collection equivalent to how it was done on 1.0. | ||
| 30 | # In many cases you can simplify this from what is generated here. | ||
| 31 | # 'See docs on artifact collection here https://circleci.com/docs/2.0/artifacts/' | ||
| 32 | - run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS | ||
| 33 | # This is based on your 1.0 configuration file or project settings | ||
| 34 | - run: | ||
| 35 | working_directory: ~/eventmq/eventmq | ||
| 36 | command: 'sudo redis-cli ping >/dev/null 2>&1 || sudo service redis-server | ||
| 37 | start; ' | ||
| 38 | # This is based on your 1.0 configuration file or project settings | ||
| 39 | - run: | ||
| 40 | working_directory: ~/eventmq/eventmq | ||
| 41 | command: pyenv global 2.7.11 3.5.2 | ||
| 42 | # Dependencies | ||
| 43 | # This would typically go in either a build or a build-and-test job when using workflows | ||
| 44 | # Restore the dependency cache | ||
| 45 | - restore_cache: | ||
| 46 | keys: | ||
| 47 | # This branch if available | ||
| 48 | - v1-dep-{{ .Branch }}- | ||
| 49 | # Default branch if not | ||
| 50 | - v1-dep-master- | ||
| 51 | # Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly | ||
| 52 | - v1-dep- | ||
| 53 | # This is based on your 1.0 configuration file or project settings | ||
| 54 | - run: pip install -e .[testing] | ||
| 55 | - run: pip install python-coveralls | ||
| 56 | - run: pip3.5 install -e .[testing] | ||
| 57 | # Save dependency cache | ||
| 58 | - save_cache: | ||
| 59 | key: v1-dep-{{ .Branch }}-{{ epoch }} | ||
| 60 | paths: | ||
| 61 | # This is a broad list of cache paths to include many possible development environments | ||
| 62 | # You can probably delete some of these entries | ||
| 63 | - vendor/bundle | ||
| 64 | - ~/virtualenvs | ||
| 65 | - ~/.m2 | ||
| 66 | - ~/.ivy2 | ||
| 67 | - ~/.bundle | ||
| 68 | - ~/.go_workspace | ||
| 69 | - ~/.gradle | ||
| 70 | - ~/.cache/bower | ||
| 71 | # Test | ||
| 72 | # This would typically be a build job when using workflows, possibly combined with build | ||
| 73 | # This is based on your 1.0 configuration file or project settings | ||
| 74 | - run: nosetests-2.7 --with-coverage --cover-inclusive --cover-package=eventmq --cover-tests | ||
| 75 | - run: /opt/circleci/python/3.5.2/bin/nosetests-3.4 | ||
| 76 | # This is based on your 1.0 configuration file or project settings | ||
| 77 | - run: find . -name \*.py -print | xargs flake8 --show-source --statistics | ||
| 78 | - run: coveralls | ||
| 79 | # Teardown | ||
| 80 | # If you break your build into multiple jobs with workflows, you will probably want to do the parts of this that are relevant in each | ||
| 81 | # Save test results | ||
| 82 | - store_test_results: | ||
| 83 | path: /tmp/circleci-test-results | ||
| 84 | # Save artifacts | ||
| 85 | - store_artifacts: | ||
| 86 | path: /tmp/circleci-artifacts | ||
| 87 | - store_artifacts: | ||
| 88 | path: /tmp/circleci-test-results \ No newline at end of file | ||
diff --git a/eventmq/tests/test_utils.py b/eventmq/tests/test_utils.py index 501b081..5173832 100644 --- a/eventmq/tests/test_utils.py +++ b/eventmq/tests/test_utils.py | |||
| @@ -296,11 +296,6 @@ class TestCase(unittest.TestCase): | |||
| 296 | with self.assertRaises(exceptions.InvalidMessageError): | 296 | with self.assertRaises(exceptions.InvalidMessageError): |
| 297 | messages.parse_router_message(broken_message) | 297 | messages.parse_router_message(broken_message) |
| 298 | 298 | ||
| 299 | @unittest.skip | ||
| 300 | def test_parse_router_message(self): | ||
| 301 | ['aef451a0-5cef-4f03-818a-221061c8ab68', '', 'eMQP/1.0', 'INFORM', | ||
| 302 | '5caeb5fd-15d4-4b08-89e8-4e536672eef3', 'default', 'worker'] | ||
| 303 | |||
| 304 | def test_emqDeque(self): | 299 | def test_emqDeque(self): |
| 305 | 300 | ||
| 306 | full = random.randint(1, 100) | 301 | full = random.randint(1, 100) |
diff --git a/eventmq/utils/classes.py b/eventmq/utils/classes.py index eb431bd..5788e94 100644 --- a/eventmq/utils/classes.py +++ b/eventmq/utils/classes.py | |||
| @@ -22,6 +22,7 @@ import json | |||
| 22 | import logging | 22 | import logging |
| 23 | import sys | 23 | import sys |
| 24 | 24 | ||
| 25 | import six | ||
| 25 | import zmq.error | 26 | import zmq.error |
| 26 | 27 | ||
| 27 | from .. import conf, constants, exceptions, poller, utils | 28 | from .. import conf, constants, exceptions, poller, utils |
| @@ -468,7 +469,7 @@ class EMQdeque(object): | |||
| 468 | return "{}".format(str(self._queue)) | 469 | return "{}".format(str(self._queue)) |
| 469 | 470 | ||
| 470 | def __unicode__(self): | 471 | def __unicode__(self): |
| 471 | return "{}".format(unicode(self._queue)) | 472 | return "{}".format(six.u(self._queue)) |
| 472 | 473 | ||
| 473 | def __repr__(self): | 474 | def __repr__(self): |
| 474 | return "{}".format(repr(self._queue)) | 475 | return "{}".format(repr(self._queue)) |
diff --git a/eventmq/utils/functions.py b/eventmq/utils/functions.py index 0d64725..f47526b 100644 --- a/eventmq/utils/functions.py +++ b/eventmq/utils/functions.py | |||
| @@ -2,6 +2,7 @@ import hashlib | |||
| 2 | import importlib | 2 | import importlib |
| 3 | import inspect | 3 | import inspect |
| 4 | import json | 4 | import json |
| 5 | import sys | ||
| 5 | 6 | ||
| 6 | from .. import log | 7 | from .. import log |
| 7 | from ..exceptions import CallableFromPathError | 8 | from ..exceptions import CallableFromPathError |
| @@ -188,7 +189,10 @@ def callable_from_name(callable_name, *args, **kwargs): | |||
| 188 | 189 | ||
| 189 | try: | 190 | try: |
| 190 | package = importlib.import_module(s_package) | 191 | package = importlib.import_module(s_package) |
| 191 | reload(package) | 192 | if sys.version[0] == '2': |
| 193 | reload(package) # noqa - flake8 fails here on py3 | ||
| 194 | else: | ||
| 195 | importlib.reload(package) | ||
| 192 | except Exception as e: | 196 | except Exception as e: |
| 193 | raise CallableFromPathError(str(e)) | 197 | raise CallableFromPathError(str(e)) |
| 194 | 198 | ||
| @@ -18,20 +18,20 @@ setup( | |||
| 18 | version=version, | 18 | version=version, |
| 19 | description='EventMQ job execution and messaging system based on ZeroMQ', | 19 | description='EventMQ job execution and messaging system based on ZeroMQ', |
| 20 | packages=find_packages(), | 20 | packages=find_packages(), |
| 21 | install_requires=['pyzmq==15.4.0', | 21 | install_requires=[ |
| 22 | 'six==1.10.0', | 22 | 'pyzmq==15.4.0', |
| 23 | 'monotonic==0.4', | 23 | 'six==1.10.0', |
| 24 | 'croniter==0.3.10', | 24 | 'monotonic==0.4', |
| 25 | 'future==0.15.2', | 25 | 'croniter==0.3.10', |
| 26 | 'psutil==5.0.0', | 26 | 'future==0.15.2', |
| 27 | 'python-dateutil>=2.1,<3.0.0'], | 27 | 'psutil==5.0.0', |
| 28 | ], | ||
| 28 | extras_require={ | 29 | extras_require={ |
| 29 | 'docs': ['Sphinx==1.5.2', ], | 30 | 'docs': ['Sphinx==1.5.2', ], |
| 30 | 'testing': [ | 31 | 'testing': [ |
| 31 | 'flake8==3.2.1', | 32 | 'flake8==3.2.1', |
| 32 | 'flake8-import-order==0.11', | 33 | 'flake8-import-order==0.11', |
| 33 | 'flake8-print==2.0.2', | 34 | 'flake8-print==2.0.2', |
| 34 | 'nose', | ||
| 35 | 'coverage==4.0.3', | 35 | 'coverage==4.0.3', |
| 36 | 'testfixtures==4.7.0', | 36 | 'testfixtures==4.7.0', |
| 37 | 'freezegun==0.3.7', | 37 | 'freezegun==0.3.7', |
| @@ -58,9 +58,7 @@ setup( | |||
| 58 | 'Operating System :: OS Independent', | 58 | 'Operating System :: OS Independent', |
| 59 | # Specify the Python versions you support here. In particular, ensure | 59 | # Specify the Python versions you support here. In particular, ensure |
| 60 | # that you indicate whether you support Python 2, Python 3 or both. | 60 | # that you indicate whether you support Python 2, Python 3 or both. |
| 61 | 'Programming Language :: Python :: 2.6', | ||
| 62 | 'Programming Language :: Python :: 2.7', | 61 | 'Programming Language :: Python :: 2.7', |
| 63 | 'Programming Language :: Python :: 3.4', | ||
| 64 | 'Programming Language :: Python :: 3.5', | 62 | 'Programming Language :: Python :: 3.5', |
| 65 | ], | 63 | ], |
| 66 | scripts=[ | 64 | scripts=[ |