textile/python-textile

Import of pytest in setup.py results in build failure (ImportError: No module named pytest)

rjollos opened this issue · 3 comments

When installing from tarball there is an ImportError exception due to import of pytest in setup.py. Here is one way to reproduce:

~$virtualenv pve
New python executable in /Users/rjollos/pve/bin/python2.7
Also creating executable in /Users/rjollos/pve/bin/python
Installing setuptools, pip, wheel...done.
(pve) ~$. pve/bin/activate
(pve) ~$pip install --no-cache-dir --no-binary :all: textile
Collecting textile
  Downloading textile-2.3.6.tar.gz (45kB)
    100% |████████████████████████████████| 51kB 412kB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/qf/y5yt86vn54j_sy7dv1f8hb3r0000gn/T/pip-build-V8XzTX/textile/setup.py", line 4, in <module>
        import pytest
    ImportError: No module named pytest
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/qf/y5yt86vn54j_sy7dv1f8hb3r0000gn/T/pip-build-V8XzTX/textile/

With import pytest in setup.py, pytest would at least need to be included in install_requires.

sebix commented

Thanks for reporting this!

We could also (additionally) move the import of pytest into a try-except block.

Shouldn't this just follow pytest's integration docs?

I forgot about this. Thanks for the reminder, Radek. Your solution looks good to me. I'll implement it shortly.