Changes to myplex.py from code review; Update test_documentation to check for warnings and errors

This commit is contained in:
Michael Shepanski 2017-02-27 23:43:31 -05:00
parent c446d52c70
commit 1dcbf85a9f
8 changed files with 24 additions and 12 deletions

1
.gitignore vendored
View file

@ -14,6 +14,7 @@ syntax: glob
.Python
bin/
build
config.ini
dist
docs/_build/
htmlcov

View file

@ -316,3 +316,6 @@ texinfo_documents = [
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False
suppress_warnings = ['image.nonlocal_uri']
exclude_patterns = ['toc.rst']

View file

@ -1 +1 @@
.. include:: ../README.rst
.. include:: ../README.rst

7
docs/modules/alert.rst Normal file
View file

@ -0,0 +1,7 @@
.. include:: ../global.rst
Notify :modname:`plexapi.alert`
--------------------------------
.. automodule:: plexapi.alert
:members:
:show-inheritance:

View file

@ -1,7 +0,0 @@
.. include:: ../global.rst
Notify :modname:`plexapi.notify`
--------------------------------
.. automodule:: plexapi.notify
:members:
:show-inheritance:

View file

@ -11,6 +11,7 @@
:caption: Modules
:titlesonly:
modules/alert
modules/audio
modules/base
modules/client
@ -19,7 +20,6 @@
modules/library
modules/media
modules/myplex
modules/notify
modules/photo
modules/playlist
modules/playqueue

View file

@ -158,7 +158,8 @@ class MyPlexAccount(PlexObject):
# ---------------------
# Webhook Commands
def addWebhook(self, url):
urls = copy.copy(self._webhooks) + [url]
# copy _webhooks and append url
urls = self._webhooks[:] + [url]
return self.setWebhooks(urls)
def deleteWebhook(self, url):
@ -174,6 +175,7 @@ class MyPlexAccount(PlexObject):
self._webhooks = self.listAttrs(data, 'url', etag='webhook')
return self._webhooks
@property
def webhooks(self):
data = self.query(self.WEBHOOKS)
self._webhooks = self.listAttrs(data, 'url', etag='webhook')

View file

@ -11,10 +11,16 @@ SKIP_EXAMPLES = ['Example 4']
@pytest.mark.skipif(os.name == 'nt', reason='No make.bat specified for Windows')
def test_build_documentation():
docroot = join(dirname(dirname(abspath(__file__))), 'docs')
cmd = shlex.split('/usr/bin/make html --warn-undefined-variables')
proc = subprocess.Popen(cmd, cwd=docroot)
cmd = shlex.split('sphinx-build . _build')
proc = subprocess.Popen(cmd, cwd=docroot, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
status = proc.wait()
assert status == 0
for output in proc.communicate():
for line in str(output).split('\\n'):
line = line.lower().strip()
assert 'warning' not in line
assert 'error' not in line
assert 'traceback' not in line
def test_readme_examples(pms):