Skip to content

Commit

Permalink
Merge pull request #44 from odin-detector/odin_control_py3
Browse files Browse the repository at this point in the history
Add explicit support for python 3
  • Loading branch information
timcnicholls authored Apr 15, 2021
2 parents 833d018 + 89c1c85 commit 3dc6e5b
Show file tree
Hide file tree
Showing 12 changed files with 255 additions and 151 deletions.
5 changes: 5 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
notify:
slack:
default:
url: "secret:p86vG6xzWKglCbWuYQtBSGejyP2W0udsB8gacjwScz8BnSZTcfbIi6nkmJQU+62KZW7P2ZfJujXWYrm0OwPfSKHx4hFPm9QR+/qZBliA3ENlTiwDzNqZo6MpvClJnPksptVkM38KrjWbkXD4psXEsU34hhGca6NNCrwK6+oP98Y="
File renamed without changes.
49 changes: 49 additions & 0 deletions .github/workflows/test_odin_control.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test odin-control

on:
- push
- pull_request

jobs:
build_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions coverage
- name: Test with tox
run: tox
- name: Merge tox env specific coverage files
run: |
coverage combine
coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
name: ${{ matrix.python-version }}
fail_ci_if_error: true

notify:
if: ${{ always() }}
runs-on: ubuntu-latest
needs: build_and_test
steps:
- name: Slack Notification on completion
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: odin-control-notify
SLACK_COLOR: ${{ needs.build_and_test.result }}
SLACK_ICON: https://avatars.githubusercontent.com/odin-detector?size=48
SLACK_TITLE: "odin-control CI tests completed: ${{ needs.build_and_test.result }}"
SLACK_USERNAME: odin-detector
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# odin
Prototype of ODIN framework for evaluation purposes only
# odin-control

[![Build Status](https://travis-ci.org/odin-detector/odin-control.svg)](https://travis-ci.org/odin-detector/odin-control)
[![Coverage Status](https://coveralls.io/repos/github/odin-detector/odin-control/badge.svg?branch=master)](https://coveralls.io/github/odin-detector/odin-control?branch=master)
[![Stories in Ready](https://badge.waffle.io/odin-detector/odin-control.png?label=ready&title=Ready)](https://waffle.io/odin-detector/odin-control)
[![Stories in In Progress](https://badge.waffle.io/odin-detector/odin-control.png?label=In%20Progress&title=In%20Progress)](https://waffle.io/odin-detector/odin-control)
[![Code Climate](https://codeclimate.com/github/odin-detector/odin-control/badges/gpa.svg)](https://codeclimate.com/github/odin-detector/odin-control)
[![Test Coverage](https://codeclimate.com/github/odin-detector/odin-control/badges/coverage.svg)](https://codeclimate.com/github/odin-detector/odin-control/coverage)
[![Test odin-control](https://github.com/odin-detector/odin-control/actions/workflows/test_odin_control.yml/badge.svg)](https://github.com/odin-detector/odin-control/actions/workflows/test_odin_control.yml)
[![codecov](https://codecov.io/gh/odin-detector/odin-control/branch/master/graph/badge.svg?token=Urucx8wsTU)](https://codecov.io/gh/odin-detector/odin-control)
23 changes: 17 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,34 @@
'psutil>=5.0',
]

extras_require = {
'test': [
'pytest', 'pytest-cov', 'requests', 'tox'
]
}

if sys.version_info[0] == 2:
install_requires.append('futures')
extras_require['test'].append('mock')
else:
extras_require['test'].append('pytest-asyncio')

setup(
name="odin",
name="odin_control",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='ODIN detector server',
url='https://github.com/timcnicholls/odin',
description='ODIN detector control system',
url='https://github.com/odin-detector/odin-control',
author='Tim Nicholls',
author_email='tim.nicholls@stfc.ac.uk',
packages=find_packages('src'),
package_dir={'':'src'},
package_dir={'': 'src'},
entry_points={
'console_scripts' : [
'odin_server = odin.server:main',
'console_scripts': [
'odin_server = odin.server:main_deprecate',
'odin_control = odin.server:main',
],
},
install_requires=install_requires,
extras_require=extras_require,
)
25 changes: 23 additions & 2 deletions src/odin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def shutdown_handler(): # pragma: no cover


def main(argv=None):
"""Run ODIN server.
"""Run the odin-control server.
This function is the main entry point for the ODIN server. It parses configuration
This function is the main entry point for the odin-control server. It parses configuration
options from the command line and any files, resolves adapters and launches the main
API server before entering the IO processing loop.
Expand Down Expand Up @@ -77,5 +77,26 @@ def main(argv=None):
return 0


def main_deprecate(argv=None): # pragma: no cover
"""Deprecated main entry point for running the odin control server.
This method adds an entry point for running odin control server that is run by the
deprecated odin_server command. It simply runs the main entry point as normal having
printing a deprecation warning.
"""
import warnings
with warnings.catch_warnings():
warnings.simplefilter('always', DeprecationWarning)
message = """
The odin_server script entry point is deprecated and will be removed in future releases. Consider
using \'odin_control\' instead
"""
warnings.warn(message, DeprecationWarning, stacklevel=1)

main(argv)


if __name__ == '__main__': # pragma: no cover
sys.exit(main())
2 changes: 1 addition & 1 deletion tests/adapters/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from odin.adapters.parameter_tree import ParameterTree, ParameterTreeError
from odin.adapters.adapter import wants_metadata
from odin.util import convert_unicode_to_string
from tests.utils import LogCaptureFilter, log_message_seen
from tests.utils import log_message_seen

if sys.version_info[0] == 3: # pragma: no cover
from unittest.mock import Mock, patch
Expand Down
Loading

0 comments on commit 3dc6e5b

Please sign in to comment.