Commit 1d097799 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Merge branch '55-documentation-should-be-improved' into 'master'

Resolve "Documentation should be improved"

Closes #55

See merge request !76
parents fbb34ea9 627fab4e
Pipeline #21370 passed with stages
in 8 minutes and 11 seconds
from .new_version import main as new_version
from .dependency_graph import main as dependency_graph
from .main_cli import main as main_cli
from . import click_helper
......
This diff is collapsed.
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Andre Anjos <andre.anjos@idiap.ch>
# Thu 20 Mar 2014 12:43:48 CET
"""Tests for scripts
"""
import os
import sys
import nose.tools
def test_new_version():
# Tests the bob_new_version.py script
from bob.extension.scripts import new_version
# test the script using the dry-run option (to avoid to actually tag and push code)
# assert that it does not raise an exception, when both latest and stable version are specified
if os.path.exists("version.txt"):
new_version(['--dry-run', '--stable-version', '20.7.0', '--latest-version', '20.8.0'])
# assert that it does not raise an exception, when only the latest version is specified
if os.path.exists("version.txt"):
new_version(['--dry-run', '--latest-version', '20.8.0'])
# assert that no exception is raised even if no version is specified
if os.path.exists("version.txt"):
new_version(['--dry-run'])
# assert that no exception is raised even if no version is specified
if os.path.exists("version.txt"):
new_version(['--dry-run', '--minor'])
# assert that no exception is raised even if no version is specified
if os.path.exists("version.txt"):
new_version(['--dry-run', '--major'])
# assert that it does raise an exception, when the --stable-version and
# --minor and/or --major is provided
nose.tools.assert_raises(ValueError, new_version, ['--dry-run', '--stable-version', '100.8.0', '--minor'])
nose.tools.assert_raises(ValueError, new_version, ['--dry-run', '--stable-version', '100.8.0', '--major'])
nose.tools.assert_raises(ValueError, new_version, ['--dry-run', '--stable-version', '100.8.0', '--minor', '--major'])
# assert that it does raise an exception, when the latest version is too low
nose.tools.assert_raises(ValueError, new_version, ['--dry-run', '--latest-version', '0.8.0'])
# assert that it does raise an exception, when the stable version is too low
nose.tools.assert_raises(ValueError, new_version, ['--dry-run', '--stable-version', '0.8.0', '--latest-version', '0.9.0'])
# assert that it does raise an exception, when the stable version is higher than latest version
nose.tools.assert_raises(ValueError, new_version, ['--dry-run', '--stable-version', '20.8.0', '--latest-version', '20.8.0a1'])
# assert that it does not raise an exception, when --force is given and the latest version is too low
if os.path.exists("version.txt"):
new_version(['--force', '--dry-run', '--latest-version', '0.8.0'])
# assert that it does not raise an exception, when --force is given and the stable version is too low
if os.path.exists("version.txt"):
new_version(['--force', '--dry-run', '--stable-version', '0.8.0', '--latest-version', '0.9.0'])
# assert that it does not raise an exception, when --force is given and the stable version is higher than latest version
if os.path.exists("version.txt"):
new_version(['--force', '--dry-run', '--stable-version', '20.8.0', '--latest-version', '20.8.0a1'])
......@@ -7,7 +7,6 @@ package:
build:
entry_points:
- bob_new_version.py = bob.extension.scripts:new_version
- bob_dependecy_graph.py = bob.extension.scripts:dependency_graph
number: {{ environ.get('BOB_BUILD_NUMBER', 0) }}
run_exports:
......@@ -33,7 +32,6 @@ test:
imports:
- {{ name }}
commands:
- bob_new_version.py --help
- bob_dependecy_graph.py --help
- nosetests --with-coverage --cover-package={{ name }} -sv {{ name }} --exclude=test_extensions
- sphinx-build -aEW {{ project_dir }}/doc {{ project_dir }}/sphinx
......
This diff is collapsed.
......@@ -44,8 +44,10 @@ To write documentation, use the `Sphinx`_ Documentation Generator.
Get familiar with Sphinx and then unleash the writer in you.
To automatically generate API documentation, we make use of the `Napoleon`_ Sphinx extension
that enables Sphinx to parse both NumPy and Google style docstrings. To get familiar on how to document your Python code,
you can have a look on the `Napoleon`_ website (and the links within) or in existing bob packages.
that enables Sphinx to parse both NumPy and Google style docstrings. It has been agreed
that the style used to document bob packages is the NumPy style. To get familiar on how to document your Python code,
you can have a look on the `Napoleon`_ website (and the links within) or in existing bob packages. You can also
refer to the official `numpydoc docstring guide`_.
.. note::
......
......@@ -39,3 +39,5 @@
.. _bob-devel: https://gitlab.idiap.ch/bob/bob.conda/tree/master/recipes/bob-devel
.. _pip: https://pip.pypa.io/en/stable/
.. _discuss: https://www.idiap.ch/software/bob/discuss
.. _numpydoc docstring guide: https://numpydoc.readthedocs.io/en/latest/format.html
.. _new package instructions: https://gitlab.idiap.ch/bob/bob.admin/tree/master/templates
......@@ -20,6 +20,13 @@ existing one. The guide heavily relies on the use of Python `setuptools`_ and
Python package index and distribution portal. `Python packaging guide`_ can
also be useful to learn about setuptools_.
.. note::
You should also go through the `new package instructions`_ page when creating a new
package. It is a step-by-step guide on how to setup your package, and in particular
contains various templates that you must use. Among other stuff, you will find
templates for ``README.rst``, ``setup.py``, ``buildout.cfg`` files,
for continuous integration and for the conda recipe of your package.
Anatomy of a package
--------------------
......
......@@ -27,7 +27,6 @@ setup(
entry_points={
'console_scripts': [
'bob = bob.extension.scripts:main_cli',
'bob_new_version.py = bob.extension.scripts:new_version',
'bob_dependecy_graph.py = bob.extension.scripts:dependency_graph',
],
'bob.cli': [
......
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