Pull requests

#176 Merged
Deleted repository
default (72d25c9ae682)

Make sure setup_command test can always import Sphinx

  1. Dmitry Shachnev

Currently the test suite fails when ran in a clean environment (without sphinx installed):

FAIL: test_setup_command.test_build_sphinx
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
  File "/tmp/buildd/sphinx-1.2~b3+dfsg/build/py2/tests/test_setup_command.py", line 45, in deco
    func(pkgrootdir, proc, *args, **kwds)
  File "/tmp/buildd/sphinx-1.2~b3+dfsg/build/py2/tests/test_setup_command.py", line 58, in test_build_sphinx
    assert proc.returncode == 0
-------------------- >> begin captured stdout << ---------------------

Traceback (most recent call last):
  File "setup.py", line 2, in <module>
    from sphinx.setup_command import BuildDoc
ImportError: No module named sphinx.setup_command

--------------------- >> end captured stdout << ----------------------

This PR fixes it by setting correct PYTHONPATH in the child process.

  • Learn about pull requests

Comments (7)

    1. Dmitry Shachnev author

      I got this crash when building Debian package in chroot, but simply running python tests/run.py --no-skip in a clean environment (i.e. chroot, or VM) should be sufficient to trigger it.

      1. Takayuki Shimizukawa

        In my environment (Jinja2, docutils, pygments, nose are installed, sphinx is not installed), python tests/run.py --no-skip failed all tests with ImportError: No module named sphinx.application.

        Alternatively, PYTHONPATH=/path/to/sphinx-repo-root python tests/run.py can't reproduce the issue too.

          1. Takayuki Shimizukawa

            Dmitry Shachnev Georg Brandl I apologize that I had not been able to respond in the middle of a discussion.

            I confirmed the reported problem by below procedure:

            $ virtualenv venv
            $ source venv/bin/activate
            (venv)$ pip install nose docutils jinja2 pygments
            (venv)$ cd sphinx
            (venv)$ make test

            I'll merge this PR now. Thanks!

  1. Georg Brandl repo owner

    I was wondering why it works on drone.io, but there we use tox which installs Sphinx in a virtualenv... so if this fixes the not-installed case, it looks fine.