elgertam/cookiecutter-pipenv

tox fails due to lack of requirements_dev.txt when py.test used

nmusolino opened this issue · 6 comments

  • Date you used Cookiecutter PyPackage: October 7, 2018
  • Cookiecutter version used, if any: 1.6.0
  • Python version, if known: 3.7
  • Operating System: Mac OS X High Sierra/10.13.6

Description

When the "use py.test" option is selected, the make test-all command fails.

What I Did

First, I created a project and selected y for py.test.

$ cookiecutter  gh:elgertam/cookiecutter-pipenv
full_name [Audrey Roy Greenfeld]:               
email [ame@example.com]: 
github_username [audreyr]: 
project_name [Python Boilerplate]: 
project_slug [python_boilerplate]: 
project_short_description [Python Boilerplate contains all the boilerplate you need to create a Python package.]: 
pypi_username [audreyr]: 
version [0.1.0]: 
use_pytest [n]: y
use_pypi_deployment_with_travis [y]: 
add_pyup_badge [n]: 
Select command_line_interface:
1 - Click
2 - No command-line interface
Choose from 1, 2 [1]: 
create_author_file [y]: 
Select open_source_license:
1 - MIT license
2 - BSD license
3 - ISC license
4 - Apache Software License 2.0
5 - GNU General Public License v3
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 

Install the new package:

$ pipenv install --dev
[Output omitted]
$ piping install -e .
[Output omitted]

Run the tests:

$ pipenv run make test
py.test
platform darwin -- Python 3.7.0, pytest-3.4.2, py-1.6.0, pluggy-0.6.0
rootdir: /Users/musolino/source/python_boilerplate, inifile: setup.cfg
collected 2 items                                                                                                                                                                  

tests/test_python_boilerplate.py ..                                                                                                                                          [100%]

Attempt to run tox:

tox
GLOB sdist-make: /Users/musolino/source/python_boilerplate/setup.py
py27 create: /Users/musolino/source/python_boilerplate/.tox/py27
py27 installdeps: -r/Users/musolino/source/python_boilerplate/requirements_dev.txt
ERROR: invocation failed (exit code 1), logfile: /Users/musolino/source/python_boilerplate/.tox/py27/log/py27-1.log
ERROR: actionid: py27
msg: getenv
cmdargs: ['/Users/musolino/source/python_boilerplate/.tox/py27/bin/pip', 'install', '-r/Users/musolino/source/python_boilerplate/requirements_dev.txt']

Could not open requirements file: [Errno 2] No such file or directory: '/Users/musolino/source/python_boilerplate/requirements_dev.txt'

ERROR: could not install deps [-r/Users/musolino/source/python_boilerplate/requirements_dev.txt]; v = InvocationError('/Users/musolino/source/python_boilerplate/.tox/py27/bin/pip install -r/Users/musolino/source/python_boilerplate/requirements_dev.txt (see /Users/musolino/source/python_boilerplate/.tox/py27/log/py27-1.log)', 1)

Thanks for the very detailed bug report! I'll try to get a fix out this week.

Certainly. Thanks for this cookie cutter project -- I tried a few pipenv-based cookiecutter templates, and this one was my favorite.

Here is how I tackled the tox issue in my project:
nmusolino/codeowners@bf5529a

To be clear, this is my first time working with pipenv (and tox), so I'm not sure if this is the "proper" solution for tox-pipenv integration.

@nmusolino I really appreciate it! I took a look at your solution to it. I'd welcome a PR, although I'm curious about the lines 19-20:

deps =
    pipenv

Does that install pipenv inside the tox virtualenvs? Can tox not use the globally installed pipenv?

Thanks again for the kind words. I'm glad you've found this cookiecutter useful.

@elgertam I've solved this issue and proposed the solution at #9, would be happy if you could look into all the 3 PRs I've created as I think they are simple and make lots of sense. I loved this repo :)

This issue is now fixed. Thank you to @AlmogCohen for submitting a PR.

Also, I appreciate the love. Makes me feel happy! 😄

Thank you, @elgertam and @AlmogCohen. Sorry I didn’t answer your earlier question. PR #9 looks good to me.