Commit f72e10b2 authored by bliss administrator's avatar bliss administrator

[wip] commit rest of files

parent 98af786c
Pipeline #9061 failed with stage
stages:
- test
- deploy
test:
stage: test
before_script:
- source activate tango2.7
- conda install --yes git
- git clone https://gitlab.esrf.fr/ID13/id13.git
- conda install --yes --channel http://bcu-ci.esrf.fr/stable --file bliss/requirements-conda.txt
- conda install --yes --channel http://bcu-ci.esrf.fr/stable --file bliss/requirements-test-conda.txt
- pip install bliss/
script: python setup.py test
artifacts:
paths:
- tests/htmlcov/
expire_in: 7 days
pages:
stage: deploy
dependencies:
- test
script:
- mv tests/htmlcov public/
artifacts:
paths:
- public
expire_in: 2 months
only:
- master
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
ID13 software & configuration
Copyright (C) 2018 BCU Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
include LICENSE
include README.rst
recursive-include tests *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
============
ID13 project
============
[![build status](https://gitlab.esrf.fr/ID13/id13/badges/master/build.svg)](http://ID13.gitlab-pages.esrf.fr/ID13)
[![coverage report](https://gitlab.esrf.fr/ID13/id13/badges/master/coverage.svg)](http://ID13.gitlab-pages.esrf.fr/id13/htmlcov)
ID13 software & configuration
Latest documentation from master can be found [here](http://ID13.gitlab-pages.esrf.fr/id13)
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = id13
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# id13 documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import id13
# -- General configuration ---------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'ID13 project'
copyright = u"2018, BCU Team"
author = u"BCU Team"
# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
# the built documents.
#
# The short X.Y version.
version = id13.__version__
# The full version, including alpha/beta/rc tags.
release = id13.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output -------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a
# theme further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# -- Options for HTMLHelp output ---------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'id13doc'
# -- Options for LaTeX output ------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, 'id13.tex',
u'ID13 project Documentation',
u'BCU Team', 'manual'),
]
# -- Options for manual page output ------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'id13',
u'ID13 project Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'id13',
u'ID13 project Documentation',
author,
'id13',
'One line description of project.',
'Miscellaneous'),
]
Welcome to ID13 project's documentation!
======================================
.. toctree::
:maxdepth: 2
:caption: Contents:
readme
usage
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. include:: ../README.rst
=====
Usage
=====
To use ID13 project in a project::
import id13
[flake8]
exclude = docs
[aliases]
# Define setup.py command aliases here
test = pytest
[tool:pytest]
addopts = --cov id13 --cov-report html:tests/htmlcov --cov-report term -v tests/
# -*- coding: utf-8 -*-
"""The setup script."""
import sys
from setuptools import setup, find_packages
TESTING = any(x in sys.argv for x in ['test', 'pytest'])
with open('README.rst') as readme_file:
readme = readme_file.read()
requirements = ['bliss']
setup_requirements = ['pytest-runner', 'pytest'] if TESTING else []
test_requirements = ['pytest-cov', 'mock']
setup(
author="BCU Team",
author_email='bliss@esrf.fr',
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Natural Language :: English',
"Programming Language :: Python :: 2",
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
],
description="ID13 software & configuration",
install_requires=requirements,
license="GNU General Public License v3",
long_description=readme,
include_package_data=True,
keywords='id13',
name='id13',
packages=find_packages(include=['id13']),
setup_requires=setup_requirements,
test_suite='tests',
tests_require=test_requirements,
url='https://gitlab.esrf.fr/ID13/id13',
version='0.1.0',
zip_safe=False,
)
# -*- coding: utf-8 -*-
"""Unit test package for id13."""
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
import os
import time
import subprocess
import multiprocessing
import redis
import pytest
import gevent
import sys
from contextlib import contextmanager
from bliss.config import static
from bliss.config.conductor import client
from bliss.config.conductor import connection
from bliss.config.conductor.client import get_default_connection
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
BEACON = [sys.executable, '-m', 'bliss.config.conductor.server']
BEACON_DB_PATH = os.path.join(ROOT, 'tests', 'test_configuration')
REDIS_PORT = 7754
BEACON_PORT = 7755
TANGO_PORT = 7756
@pytest.fixture(scope="session")
def beacon():
args = [
'--port=%d' % BEACON_PORT,
'--redis_port=%d' % REDIS_PORT,
'--redis_socket=/tmp/redis_test_id13.sock',
'--db_path=' + BEACON_DB_PATH,
'--posix_queue=0',
'--tango_port=%d' % TANGO_PORT]
proc = subprocess.Popen(BEACON + args)
time.sleep(0.5) # wait for beacon to be really started
redis_db = redis.Redis(port=REDIS_PORT)
redis_db.flushall()
beacon_connection = connection.Connection("localhost", BEACON_PORT)
client._default_connection = beacon_connection
cfg = static.get_config()
os.environ["TANGO_HOST"] = "localhost:%d" % TANGO_PORT
yield cfg
proc.terminate()
@pytest.fixture
def redis_data_conn():
cnx = get_default_connection()
redis_conn = cnx.get_redis_connection(db=1)
yield redis_conn
@pytest.fixture
def scan_tmpdir(tmpdir):
yield tmpdir
tmpdir.remove()
@pytest.fixture(scope="session")
def lima_simulator(beacon):
from Lima.Server.LimaCCDs import main
from tango import DeviceProxy, DevFailed
device_name = "id00/limaccds/simulator1"
device_fqdn = "tango://localhost:%d/%s" % (TANGO_PORT, device_name)
p = subprocess.Popen(['LimaCCDs', 'simulator'])
with gevent.Timeout(3, RuntimeError("Lima simulator is not running")):
while True:
try:
dev_proxy = DeviceProxy(device_fqdn)
dev_proxy.ping()
dev_proxy.state()
except DevFailed as e:
gevent.sleep(0.5)
else:
break
yield device_fqdn, dev_proxy
p.terminate()
@pytest.fixture(scope="session")
def bliss_tango_server(beacon):
from tango import DeviceProxy, DevFailed
device_name = "id00/bliss/test"
device_fqdn = "tango://localhost:%d/%s" % (TANGO_HOST, device_name)
bliss_ds = [sys.executable, '-m', 'bliss.tango.servers.bliss_ds']
p = subprocess.Popen(bliss_ds+["test"])
with gevent.Timeout(3, RuntimeError("Bliss tango server is not running")):
while True:
try:
dev_proxy = DeviceProxy(device_fqdn)
dev_proxy.ping()
dev_proxy.state()
except DevFailed as e:
gevent.sleep(0.5)
else:
break
yield device_fqdn, dev_proxy
p.terminate()
def motor_fixture(name):
def get_motor(beacon):
m = beacon.get(name)
yield m
m.stop()
m.wait_move()
m.apply_config()
m.controller.set_hw_limits(m, None, None)
m.dial(0)
m.position(0)
for hook in m.motion_hooks:
hook.nb_pre_move = 0
hook.nb_post_move = 0
get_motor.__name__ = name
return pytest.fixture(get_motor)
def calc_motor_fixture(name):
def get_motor(beacon):
m = beacon.get(name)
m.no_offset = False
yield m
m.stop()
m.wait_move()
get_motor.__name__ = name
return pytest.fixture(get_motor)
m0 = motor_fixture("m0")
m1 = motor_fixture("m1")
# add more fixtures here as needed
controller:
- class: mockup
name: test
axes:
- name: robz
steps_per_unit: 10000
velocity: 100
acceleration: 300
low_limit: -1000
high_limit: 1000000000.0
- name: robz2
steps_per_unit: 10000
velocity: 1000
acceleration: 100
- class: mockup
axes:
- class: MockupAxis
name: roby
backlash: 2
steps_per_unit: 10000
velocity: 2500.0
acceleration: 1000.0
low_limit:
high_limit:
default_cust_attr: 6.28
- name: m2
steps_per_unit: 1000
velocity: 50
acceleration: 1
- name: m1
steps_per_unit: 1000
velocity: 50
acceleration: 1
encoder: $m1enc
check_encoder: true
- name: m0
velocity: 1000
acceleration: 100
- name: hooked_m0
steps_per_unit: 1000
velocity: 500
acceleration: 300
backlash: 2
motion_hooks:
- $hook0
- name: hooked_m1
velocity: 1000
acceleration: 300
motion_hooks:
- $hook0
- $hook1
- name: hooked_error_m0
velocity: 1000
acceleration: 300
motion_hooks:
- $hook0
- $hook_error
- name: s1f
steps_per_unit: -1000
velocity: 500
acceleration: 100
low_limit: -10
high_limit: 10
- name: s1b
steps_per_unit: 1000
velocity: 500
acceleration: 100
low_limit: -10
high_limit: 10
- name: s1u
steps_per_unit: -1000
velocity: 500
acceleration: 100
low_limit: -10
high_limit: 10
- name: s1d
steps_per_unit: 1000
velocity: 500
acceleration: 100
low_limit: -10
high_limit: 10
- name: jogger
steps_per_unit: -500
velocity: 100
acceleration: 300
encoders:
- name: m1enc
steps_per_unit: 50
tolerance: 0.001
- class: slits
axes:
- name: $s1f
tags: real front
- name: $s1b
tags: real back
- name: $s1u
tags: real up
- name: $s1d
tags: real down
- name: s1vg
tags: vgap
- name: s1vo
tags: voffset
- name: s1hg
tags: hgap
low_limit: -15
- name: s1ho
tags: hoffset
hooks:
- name: hook0
plugin: bliss
class: MockupHook
module: motors.mockup
- name: hook1
plugin: bliss
class: MockupHook
module: motors.mockup
- name: hook_error
plugin: bliss
class: MockupHook
module: motors.mockup
pre_move_error: true
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `id13` package."""
import pytest
import id13
def test_something(beacon):
"""test the interesting something"""
pass
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment