summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-07-31 00:02:59 -0700
committerGitHub <noreply@github.com>2018-07-31 00:02:59 -0700
commitbc559df2afcc51d1804e5d068d7e2c57bc4f72af (patch)
tree5ba022bfcc13ca1d6f9f16ac323d570cde51895b
parent573d15705bfa57a22b63010796d76c9ba5f7be3b (diff)
parent57e6bf0c0162c3fd445580344ada5d662b373bd3 (diff)
downloadcmd2-git-bc559df2afcc51d1804e5d068d7e2c57bc4f72af.tar.gz
Merge pull request #485 from python-cmd2/sphinx_tests
Add tests which verify documentation build
-rw-r--r--.travis.yml3
-rw-r--r--cmd2/cmd2.py4
-rw-r--r--docs/conf.py2
-rw-r--r--docs/requirements.txt4
-rwxr-xr-xexamples/alias_startup.py5
-rwxr-xr-xsetup.py6
-rw-r--r--tox.ini10
7 files changed, 22 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml
index d6689c58..30fdc8cf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,6 +16,9 @@ matrix:
- os: linux
python: 3.7-dev
env: TOXENV=py37
+ - os: linux
+ python: 3.5
+ env: TOXENV=docs
# # Warning: Don't try to use code coverage analysis with pypy as it is insanely slow
# - os: linux
# python: pypy3
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 7dffa4f8..d34e7161 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -1652,8 +1652,8 @@ class Cmd(cmd.Cmd):
If you want a reliable pre parsing hook method, register a postparsing
hook, modify the user input, and then reparse it.
- :param raw: raw command line input :return: potentially modified raw
- command line input
+ :param raw: raw command line input :return: potentially modified raw command line input
+ :return: a potentially modified version of the raw input string
"""
return raw
diff --git a/docs/conf.py b/docs/conf.py
index 13a2dba2..2c75e14e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -102,7 +102,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# 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']
+html_static_path = []
# -- Options for HTMLHelp output ------------------------------------------
diff --git a/docs/requirements.txt b/docs/requirements.txt
deleted file mode 100644
index bfd6ee02..00000000
--- a/docs/requirements.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-attrs
-colorama
-pyperclip
-wcwidth
diff --git a/examples/alias_startup.py b/examples/alias_startup.py
index 4a061e87..4ae91661 100755
--- a/examples/alias_startup.py
+++ b/examples/alias_startup.py
@@ -4,14 +4,15 @@
1) How to add custom command aliases using the alias command
2) How to load an initialization script at startup
"""
-
+import os
import cmd2
class AliasAndStartup(cmd2.Cmd):
""" Example cmd2 application where we create commands that just print the arguments they are called with."""
def __init__(self):
- super().__init__(startup_script='.cmd2rc')
+ alias_script = os.path.join(os.path.dirname(__file__), '.cmd2rc')
+ super().__init__(startup_script=alias_script)
if __name__ == '__main__':
diff --git a/setup.py b/setup.py
index e67e14b6..0425cf7e 100755
--- a/setup.py
+++ b/setup.py
@@ -73,8 +73,10 @@ EXTRAS_REQUIRE = {
# development only dependencies
# install with 'pip install -e .[dev]'
'dev': [
- 'pytest', 'pytest-cov', 'tox', 'pylint', 'sphinx', 'sphinx-rtd-theme',
- 'sphinx-autobuild', 'invoke', 'twine>=1.11',
+ # for python 3.5 and earlier we need the third party mock module
+ "mock ; python_version<'3.6'",
+ 'pytest', 'codecov', 'pytest-cov', 'pytest-mock', 'tox', 'pylint',
+ 'sphinx', 'sphinx-rtd-theme', 'sphinx-autobuild', 'invoke', 'twine>=1.11',
]
}
diff --git a/tox.ini b/tox.ini
index a5e91d46..150589b7 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py34,py35,py36,py37,py35-win,py36-win,py37-win
+envlist = docs,py34,py35,py36,py37,py35-win,py36-win,py37-win
[pytest]
testpaths = tests
@@ -9,6 +9,14 @@ passenv = CI TRAVIS TRAVIS_* APPVEYOR*
setenv =
PYTHONPATH={toxinidir}
+[testenv:docs]
+basepython = python3.5
+deps =
+ sphinx
+ sphinx-rtd-theme
+changedir = docs
+commands = sphinx-build -a -W -T -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
+
[testenv:py34]
deps =
codecov