crl.devutils


Namecrl.devutils JSON
Version 1.3.0 PyPI version JSON
download
home_pagehttps://github.com/nokia/crl-devutils
SummaryCommon Robot Libraries development and CI tools
upload_time2023-04-06 14:18:46
maintainer
docs_urlNone
authorPetri Huovinen
requires_python
licenseBSD 3-Clause
keywords robotframework testing testautomation acceptancetesting atdd bdd
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage
            .. Copyright (C) 2019, Nokia

.. image:: https://travis-ci.org/nokia/crl-devutils.svg?branch=master
    :target: https://travis-ci.org/nokia/crl-devutils

##################################################################
Guide for developing Common Robot Libraries (CRL) via crl.devutils
##################################################################


Documentation
=============

Documentation for crl.devutils can be found from `Read The Docs`_.

.. _Read the Docs: http://crl-devutils.readthedocs.io/


Setup
=====

First, install crl.devutils.

.. code:: bash

    $ pip install crl.devutils

Now, there is available *crl* development command line:

.. code:: bash

    $ crl -l

    Available tasks:

      clean               Clean workspace.
      create_docs         Create both Robot Framework and Sphinx documentation.
      create_index        Create an index with given bases
      create_setup        Create initial setup.py into current directory from library name.
      delete_index        Delete an index
      help                Show help, basically an alias for --help.
      publish             *DEPRECATED* Publish version from a given index to another index.
      sdist               Create source distribution.
      set_version         Set version in ./src/crl/<libname>/_version.py`.
      tag_release         Tag specified release.
      tag_setup_version   Tag specified release.
      test                Uploads contents of current workspace to devpi and runs tox tests.



**NOTE that some of the commands have been deprecated and should not be used.**

This tool is based on invoke 3rd party Python module and more details can be
found by running command *crl help*. Please use *crl* instead of *invoke* even
though the help shows this differently.

The *crl* tasks glue the git tags and the package distribution versions
together behind the scenes.


Using the CRL devpi server
--------------------------

For using the test command you need the devpi server. If you do not have devpi,
you need to install and configure it. See instructions on how to `Configure
Devpi`_.

Before using the test command you should also configure the devpi index that is
to be used as the base index of the library.

Here devpi is configured to use the imaginary
https://example.devpi.com/user/index simple index.

.. code:: bash

    $ devpi use https://example.devpi.com/user/index/+simple --set-cfg
    current devpi index: https://example.devpi.com/crl/prod (logged in as <username>)
    ~/.pydistutils.cfg     : https://example.devpi.com/user/index/+simple/
    ~/.pip/pip.conf        : https://example.devpi.com/user/index/+simple/
    ~/.buildout/default.cfg: https://example.devpi.com/user/index/+simple/
    always-set-cfg: no


Using the Test Environment
^^^^^^^^^^^^^^^^^^^^^^^^^^

If there is a [testenv:test] in the library's tox.ini, you can use this to
test your work. This runs the same tests as tox, but also uploads the current
workspace contents to a development index. Also, this is the way tests are
run in CI, so you might want to simulate the CI run to avoid problems later.

If the library's tox.ini doesn't have the test environment, it can be added
easily by adding the following lines into the tox.ini file:

.. code:: bash

    [testenv:test]
    changedir = {toxinidir}
    deps=
         crl.devutils
    commands= crl test --no-virtualenv {posargs}

.. warning::
    Dependency package list to this test environment may vary according
    to the library's needs.

First, login to the devpi server. Now you can load development indexes under
your personal user index.

.. code:: bash

    $ PYPI=https://example.devpi.com/user/index
    $ tox -e test -- -b ${PYPI} -t <test-indexname> --verbose

The above command saves the tests and contents to
https://example.devpi.com/<username>/<test-indexname>.


Working without the *crl* namespace
-----------------------------------

If the library shall not be in *crl* namespace, then the version file path has
to be given relatively.

For example:

.. code:: bash

    $ tox -e test -i ${PYPI}/+simple -- \
        -t CRL-92 \
        -p src/examplelib/_version.py \
        -s https://example.devpi.com/<username>/<srcindexname> \
        -d https://example.devpi.com/<username>/<destindexname>

The tagging of the version commmand has to also contain the path to version
file. For example:

.. code:: bash

    $ crl tag_release \
         --pathtoversionfile src/examplelib/_version.py 0.6.10.dev201612050621


Creating a new CRL library
==========================

Creating a new CRL library is done with a dedicated Jenkins job `Create New CRL
Library`_. The job creates the library structure from a template and generates
all the needed Jenkins jobs for the library.

Creating Documentation
======================

The *crl* tool provides two alternatives for the documentation of the test
library: *crl create_docs* and *crl publish*.

Now, the *crl create_docs* is a standalone tool for generating documentation
during the development. If documentation is done so that a *sphinxdocs*
directory exists, *crl publish* tool automatically uploads the documentation
more or less the same produced by *crl create_docs* tool. It is recommended
that *crl create_docs* will be integrated to *tox* in order to verify
documentation generation, as well as producing it in the CI e.g. via Jenkins
jobs for each commit to git.

Adding docs environment for tox.ini. Remember to add the docs environment to
the *envlist*.

.. code:: bash

    [testenv:docs]
    deps =
        sphinx
        crl.devutils
        robotframework
    commands = crl create_docs -v

.. warning::
    Dependency package list for docs environment may vary according to the
    library's needs

In order to generate documentation for your library with robot.libdoc you
should:

* create *robotdocs/robotdocsconf.py*, with content like below:

.. code:: python

        robotdocs={
            'crl.examplelib.examplelib':
                {'docformat': 'rest',
                 'synopsis': 'Example of test library functions.'},
            'crl.examplelib.examplelib.Example':
                {'args':['example'],
                 'docformat': 'rest',
                 'synopsis': 'Example of test library class.'}}

* add relative path of your *robotdocs* directory to 'html_extra_path' in
  *sphinxdocs/conf.py*:

.. code:: python

       html_extra_path = ['../robotdocs']

* it is also recommended to set page width to 90% in 'html_theme_options' in
  *sphinxdocs/conf.py*

.. code:: python

        html_theme_options = {'page_width': '90%'}

Libraries using crl.devutils process
====================================

Libraries providing Robot Framework test libraries
--------------------------------------------------

======================== ================================================================
Library                  Description
======================== ================================================================
crl-interactivesessions_ Remote command and file management via pexpect
------------------------ ----------------------------------------------------------------
crl-remotescript_        Remote command and file management via paramiko and trilead-ssh
------------------------ ----------------------------------------------------------------
crl-remotesession_       Wrapper of crl-interactivesessions_ and crl-remotescript_
======================== ================================================================

.. _crl-interactivesessions: https://github.com/nokia/crl-interactivesessions
.. _crl-remotescript: https://github.com/nokia/crl-remotescript
.. _crl-remotesession: https://github.com/nokia/crl-remotesession

Robot Framework robot command wrappers
--------------------------------------

======================== ================================================================
Library                  Description
======================== ================================================================
crl-rfcli_               Python path setter and parser of test target file
------------------------ ----------------------------------------------------------------
crl-threadverify_        Robot run verifier for hanging threads
======================== ================================================================

.. _crl-rfcli: https://github.com/nokia/crl-rfcli
.. _crl-threadverify: https://github.com/nokia/crl-threadverify

Development libraries
----------------------

======================== ================================================================
Library                  Description
======================== ================================================================
crl-devutils_            Development tools for CRL
------------------------ ----------------------------------------------------------------
crl-examplelib_          Example library template for CRL
======================== ================================================================

.. _crl-devutils: https://github.com/nokia/crl-devutils
.. _crl-examplelib: https://github.com/nokia/crl-examplelib

Generic helper libraries
------------------------

======================== ================================================================
Library                  Description
======================== ================================================================
fixtureresources_        Pytest fixtures
------------------------ ----------------------------------------------------------------
sphinx-invoke_           Sphinx extension for invoke tasks
------------------------ ----------------------------------------------------------------
virtualenvrunner_        Python Virtualenv creator and command executor
======================== ================================================================

.. _fixtureresources: https://github.com/nokia/fixtureresources
.. _sphinx-invoke: https://github.com/nokia/sphinx-invoke
.. _virtualenvrunner: https://github.com/nokia/virtualenvrunner

Useful Links
============

* `Configure Devpi`_
* `Create New CRL Library`_

.. _`Configure Devpi`: https://doc.devpi.net
.. _`Create New CRL Library`: https://github.com/nokia/cookiecutter-crl-template


Contributing
============

Please see contributing_ for development and contribution practices.

The code_ and the issues_ are hosted on GitHub.

The project is licensed under BSD-3-Clause_.

.. _contributing: https://github.com/nokia/crl-devutils/blob/master/CONTRIBUTING.rst
.. _code: https://github.com/nokia/crl-devutils
.. _issues: https://github.com/nokia/crl-devutils/issues
.. _BSD-3-Clause:  https://github.com/nokia/crl-devutils/blob/master/LICENSE
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nokia/crl-devutils",
    "name": "crl.devutils",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "robotframework testing testautomation acceptancetesting atdd bdd",
    "author": "Petri Huovinen",
    "author_email": "petri.huovinen@nokia.com",
    "download_url": "https://files.pythonhosted.org/packages/68/54/f2baa9e77681c1b600c44465c04a90547cfa4e282ad8952b81b526b0a225/crl.devutils-1.3.0.tar.gz",
    "platform": null,
    "description": ".. Copyright (C) 2019, Nokia\n\n.. image:: https://travis-ci.org/nokia/crl-devutils.svg?branch=master\n    :target: https://travis-ci.org/nokia/crl-devutils\n\n##################################################################\nGuide for developing Common Robot Libraries (CRL) via crl.devutils\n##################################################################\n\n\nDocumentation\n=============\n\nDocumentation for crl.devutils can be found from `Read The Docs`_.\n\n.. _Read the Docs: http://crl-devutils.readthedocs.io/\n\n\nSetup\n=====\n\nFirst, install crl.devutils.\n\n.. code:: bash\n\n    $ pip install crl.devutils\n\nNow, there is available *crl* development command line:\n\n.. code:: bash\n\n    $ crl -l\n\n    Available tasks:\n\n      clean               Clean workspace.\n      create_docs         Create both Robot Framework and Sphinx documentation.\n      create_index        Create an index with given bases\n      create_setup        Create initial setup.py into current directory from library name.\n      delete_index        Delete an index\n      help                Show help, basically an alias for --help.\n      publish             *DEPRECATED* Publish version from a given index to another index.\n      sdist               Create source distribution.\n      set_version         Set version in ./src/crl/<libname>/_version.py`.\n      tag_release         Tag specified release.\n      tag_setup_version   Tag specified release.\n      test                Uploads contents of current workspace to devpi and runs tox tests.\n\n\n\n**NOTE that some of the commands have been deprecated and should not be used.**\n\nThis tool is based on invoke 3rd party Python module and more details can be\nfound by running command *crl help*. Please use *crl* instead of *invoke* even\nthough the help shows this differently.\n\nThe *crl* tasks glue the git tags and the package distribution versions\ntogether behind the scenes.\n\n\nUsing the CRL devpi server\n--------------------------\n\nFor using the test command you need the devpi server. If you do not have devpi,\nyou need to install and configure it. See instructions on how to `Configure\nDevpi`_.\n\nBefore using the test command you should also configure the devpi index that is\nto be used as the base index of the library.\n\nHere devpi is configured to use the imaginary\nhttps://example.devpi.com/user/index simple index.\n\n.. code:: bash\n\n    $ devpi use https://example.devpi.com/user/index/+simple --set-cfg\n    current devpi index: https://example.devpi.com/crl/prod (logged in as <username>)\n    ~/.pydistutils.cfg     : https://example.devpi.com/user/index/+simple/\n    ~/.pip/pip.conf        : https://example.devpi.com/user/index/+simple/\n    ~/.buildout/default.cfg: https://example.devpi.com/user/index/+simple/\n    always-set-cfg: no\n\n\nUsing the Test Environment\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIf there is a [testenv:test] in the library's tox.ini, you can use this to\ntest your work. This runs the same tests as tox, but also uploads the current\nworkspace contents to a development index. Also, this is the way tests are\nrun in CI, so you might want to simulate the CI run to avoid problems later.\n\nIf the library's tox.ini doesn't have the test environment, it can be added\neasily by adding the following lines into the tox.ini file:\n\n.. code:: bash\n\n    [testenv:test]\n    changedir = {toxinidir}\n    deps=\n         crl.devutils\n    commands= crl test --no-virtualenv {posargs}\n\n.. warning::\n    Dependency package list to this test environment may vary according\n    to the library's needs.\n\nFirst, login to the devpi server. Now you can load development indexes under\nyour personal user index.\n\n.. code:: bash\n\n    $ PYPI=https://example.devpi.com/user/index\n    $ tox -e test -- -b ${PYPI} -t <test-indexname> --verbose\n\nThe above command saves the tests and contents to\nhttps://example.devpi.com/<username>/<test-indexname>.\n\n\nWorking without the *crl* namespace\n-----------------------------------\n\nIf the library shall not be in *crl* namespace, then the version file path has\nto be given relatively.\n\nFor example:\n\n.. code:: bash\n\n    $ tox -e test -i ${PYPI}/+simple -- \\\n        -t CRL-92 \\\n        -p src/examplelib/_version.py \\\n        -s https://example.devpi.com/<username>/<srcindexname> \\\n        -d https://example.devpi.com/<username>/<destindexname>\n\nThe tagging of the version commmand has to also contain the path to version\nfile. For example:\n\n.. code:: bash\n\n    $ crl tag_release \\\n         --pathtoversionfile src/examplelib/_version.py 0.6.10.dev201612050621\n\n\nCreating a new CRL library\n==========================\n\nCreating a new CRL library is done with a dedicated Jenkins job `Create New CRL\nLibrary`_. The job creates the library structure from a template and generates\nall the needed Jenkins jobs for the library.\n\nCreating Documentation\n======================\n\nThe *crl* tool provides two alternatives for the documentation of the test\nlibrary: *crl create_docs* and *crl publish*.\n\nNow, the *crl create_docs* is a standalone tool for generating documentation\nduring the development. If documentation is done so that a *sphinxdocs*\ndirectory exists, *crl publish* tool automatically uploads the documentation\nmore or less the same produced by *crl create_docs* tool. It is recommended\nthat *crl create_docs* will be integrated to *tox* in order to verify\ndocumentation generation, as well as producing it in the CI e.g. via Jenkins\njobs for each commit to git.\n\nAdding docs environment for tox.ini. Remember to add the docs environment to\nthe *envlist*.\n\n.. code:: bash\n\n    [testenv:docs]\n    deps =\n        sphinx\n        crl.devutils\n        robotframework\n    commands = crl create_docs -v\n\n.. warning::\n    Dependency package list for docs environment may vary according to the\n    library's needs\n\nIn order to generate documentation for your library with robot.libdoc you\nshould:\n\n* create *robotdocs/robotdocsconf.py*, with content like below:\n\n.. code:: python\n\n        robotdocs={\n            'crl.examplelib.examplelib':\n                {'docformat': 'rest',\n                 'synopsis': 'Example of test library functions.'},\n            'crl.examplelib.examplelib.Example':\n                {'args':['example'],\n                 'docformat': 'rest',\n                 'synopsis': 'Example of test library class.'}}\n\n* add relative path of your *robotdocs* directory to 'html_extra_path' in\n  *sphinxdocs/conf.py*:\n\n.. code:: python\n\n       html_extra_path = ['../robotdocs']\n\n* it is also recommended to set page width to 90% in 'html_theme_options' in\n  *sphinxdocs/conf.py*\n\n.. code:: python\n\n        html_theme_options = {'page_width': '90%'}\n\nLibraries using crl.devutils process\n====================================\n\nLibraries providing Robot Framework test libraries\n--------------------------------------------------\n\n======================== ================================================================\nLibrary                  Description\n======================== ================================================================\ncrl-interactivesessions_ Remote command and file management via pexpect\n------------------------ ----------------------------------------------------------------\ncrl-remotescript_        Remote command and file management via paramiko and trilead-ssh\n------------------------ ----------------------------------------------------------------\ncrl-remotesession_       Wrapper of crl-interactivesessions_ and crl-remotescript_\n======================== ================================================================\n\n.. _crl-interactivesessions: https://github.com/nokia/crl-interactivesessions\n.. _crl-remotescript: https://github.com/nokia/crl-remotescript\n.. _crl-remotesession: https://github.com/nokia/crl-remotesession\n\nRobot Framework robot command wrappers\n--------------------------------------\n\n======================== ================================================================\nLibrary                  Description\n======================== ================================================================\ncrl-rfcli_               Python path setter and parser of test target file\n------------------------ ----------------------------------------------------------------\ncrl-threadverify_        Robot run verifier for hanging threads\n======================== ================================================================\n\n.. _crl-rfcli: https://github.com/nokia/crl-rfcli\n.. _crl-threadverify: https://github.com/nokia/crl-threadverify\n\nDevelopment libraries\n----------------------\n\n======================== ================================================================\nLibrary                  Description\n======================== ================================================================\ncrl-devutils_            Development tools for CRL\n------------------------ ----------------------------------------------------------------\ncrl-examplelib_          Example library template for CRL\n======================== ================================================================\n\n.. _crl-devutils: https://github.com/nokia/crl-devutils\n.. _crl-examplelib: https://github.com/nokia/crl-examplelib\n\nGeneric helper libraries\n------------------------\n\n======================== ================================================================\nLibrary                  Description\n======================== ================================================================\nfixtureresources_        Pytest fixtures\n------------------------ ----------------------------------------------------------------\nsphinx-invoke_           Sphinx extension for invoke tasks\n------------------------ ----------------------------------------------------------------\nvirtualenvrunner_        Python Virtualenv creator and command executor\n======================== ================================================================\n\n.. _fixtureresources: https://github.com/nokia/fixtureresources\n.. _sphinx-invoke: https://github.com/nokia/sphinx-invoke\n.. _virtualenvrunner: https://github.com/nokia/virtualenvrunner\n\nUseful Links\n============\n\n* `Configure Devpi`_\n* `Create New CRL Library`_\n\n.. _`Configure Devpi`: https://doc.devpi.net\n.. _`Create New CRL Library`: https://github.com/nokia/cookiecutter-crl-template\n\n\nContributing\n============\n\nPlease see contributing_ for development and contribution practices.\n\nThe code_ and the issues_ are hosted on GitHub.\n\nThe project is licensed under BSD-3-Clause_.\n\n.. _contributing: https://github.com/nokia/crl-devutils/blob/master/CONTRIBUTING.rst\n.. _code: https://github.com/nokia/crl-devutils\n.. _issues: https://github.com/nokia/crl-devutils/issues\n.. _BSD-3-Clause:  https://github.com/nokia/crl-devutils/blob/master/LICENSE",
    "bugtrack_url": null,
    "license": "BSD 3-Clause",
    "summary": "Common Robot Libraries development and CI tools",
    "version": "1.3.0",
    "split_keywords": [
        "robotframework",
        "testing",
        "testautomation",
        "acceptancetesting",
        "atdd",
        "bdd"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6854f2baa9e77681c1b600c44465c04a90547cfa4e282ad8952b81b526b0a225",
                "md5": "a4c2839040b816f3e2a887a0398c0eb4",
                "sha256": "ce0f8b57c925a031a67f16a2a145e651678603364794e06d49e9095a3b4a8eea"
            },
            "downloads": -1,
            "filename": "crl.devutils-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a4c2839040b816f3e2a887a0398c0eb4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 51368,
            "upload_time": "2023-04-06T14:18:46",
            "upload_time_iso_8601": "2023-04-06T14:18:46.781709Z",
            "url": "https://files.pythonhosted.org/packages/68/54/f2baa9e77681c1b600c44465c04a90547cfa4e282ad8952b81b526b0a225/crl.devutils-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-06 14:18:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "nokia",
    "github_project": "crl-devutils",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "tox": true,
    "lcname": "crl.devutils"
}
        
Elapsed time: 0.05153s