-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
pydoc search chokes on import errors #62210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
After installing Django, I get the following error in test_pydoc: ====================================================================== Traceback (most recent call last):
File "/home/antoine/cpython/finalize/Lib/test/test_pydoc.py", line 581, in test_url_requests
self.assertEqual(result, title, text)
AssertionError: 'Pydoc: Error - search?key=pydoc' != 'Pydoc: Search Results'
- Pydoc: Error - search?key=pydoc
+ Pydoc: Search Results The reason is attempting to import a django.something module raises the following error: django.core.exceptions.ImproperlyConfigured: Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings ... which isn't silenced by pydoc. Now I agree this is fundamentally obnoxious on Django's part, but unfortunately it isn't the only package (IIRC) to behave in this way, meaning it would be nice from pydoc to silence all such errors when an import is attempted. |
Isn't bpo-10060 related? |
Not exactly. bpo-10060 is about a crash when loading an extension module, not an exception being raised and propagated through pydoc. |
Patch attached. |
The patch looks good. |
Would be nice to have a test. |
Here is a test case. I had to insert a temporary directory into sys.path, based off my patch in bpo-25184. Let me know if it doesn’t look too evil :) |
Oh, I were not expected that the test will be so complex, and now I'm not sure that want it. :-( But looks it can't be written simpler. The patch LGTM in any case. |
New changeset 9098731de840 by Martin Panter in branch '3.4': New changeset 8702efa1feb4 by Martin Panter in branch '3.5': New changeset d86ff708f545 by Martin Panter in branch 'default': |
In Python 2, it looks like instead of the web server search function there is a GUI search function. Here is a patch to fix the equivalent problem there. However I am not volunteering to make a test case; there does not seem to be any GUI tests to start with. |
gui-search.patch LGTM. |
New changeset 1ab20d3c9dc6 by Martin Panter in branch '2.7': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: