unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/3] python: fix documentation build with python 3.7
Date: Mon, 11 Feb 2019 20:22:35 +0200	[thread overview]
Message-ID: <20190211182237.32201-1-jani@nikula.org> (raw)

From: Jani Nikula <jani.nikula@intel.com>

The simplistic mocking in conf.py falls short on python 3.7. Just use
unittest.mock instead.

Fixes:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sphinx/config.py", line 368, in eval_config_file
    execfile_(filename, namespace)
  File "/usr/lib/python3/dist-packages/sphinx/util/pycompat.py", line 150, in execfile_
    exec_(code, _globals)
  File "/path/to/notmuch/bindings/python/docs/source/conf.py", line 39, in <module>
    from notmuch import __VERSION__,__AUTHOR__
  File "/path/to/notmuch/bindings/python/notmuch/__init__.py", line 54, in <module>
    from .database import Database
  File "/path/to/notmuch/bindings/python/notmuch/database.py", line 25, in <module>
    from .globals import (
  File "/path/to/notmuch/bindings/python/notmuch/globals.py", line 48, in <module>
    class NotmuchDatabaseS(Structure):
TypeError: __mro_entries__ must return a tuple
---
 bindings/python/docs/source/conf.py | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/bindings/python/docs/source/conf.py b/bindings/python/docs/source/conf.py
index 5b901c4ec4d8..8b43c5ca3f9f 100644
--- a/bindings/python/docs/source/conf.py
+++ b/bindings/python/docs/source/conf.py
@@ -13,22 +13,13 @@
 
 import sys, os
 
+from unittest.mock import Mock
+
 # 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.
 sys.path.insert(0,os.path.abspath('../..'))
 
-class Mock(object):
-    def __init__(self, *args, **kwargs):
-        pass
-
-    def __call__(self, *args, **kwargs):
-        return Mock()
-
-    @classmethod
-    def __getattr__(self, name):
-        return Mock() if name not in ('__file__', '__path__') else '/dev/null'
-
 MOCK_MODULES = [
     'ctypes',
 ]
-- 
2.20.1

             reply	other threads:[~2019-02-11 18:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 18:22 Jani Nikula [this message]
2019-02-11 18:22 ` [PATCH 2/3] python: fix documentation title underline Jani Nikula
2019-02-11 18:22 ` [PATCH 3/3] python: fix threads.__str__ automethod documentation Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190211182237.32201-1-jani@nikula.org \
    --to=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).