pinax/pinax-stripe-light

Setup instructions possibly dated?

dalanmiller opened this issue · 3 comments

Issue Summary

Going through the dev setup instructions here, I was unable to get to a state in which I could successfully run the tests.

➜  pinax-stripe git:(master) ✗ detox
py34-dj18 create: /Users/dalan/Documents/pinax-stripe/.tox/py34-dj18
ERROR: InterpreterNotFound: python3.4
checkqa runtests: PYTHONHASHSEED='2700619649'
checkqa runtests: commands[0] | flake8 pinax
py27-dj18 runtests: PYTHONHASHSEED='2700619649'
py27-dj18 runtests: commands[0] | coverage run setup.py test
py27-dj18-pytest runtests: PYTHONHASHSEED='2700619649'
py27-dj18-pytest runtests: commands[0] | coverage run -m pytest
py27-dj110 runtests: PYTHONHASHSEED='2700619649'
py27-dj110 runtests: commands[0] | coverage run setup.py test
py27-dj110-pytest runtests: PYTHONHASHSEED='2700619649'
py27-dj110-pytest runtests: commands[0] | coverage run -m pytest
py27-dj111 runtests: PYTHONHASHSEED='2700619649'
py27-dj111 runtests: commands[0] | coverage run setup.py test
py27-dj111-pytest runtests: PYTHONHASHSEED='2700619649'
py27-dj111-pytest runtests: commands[0] | coverage run -m pytest
py34-dj18-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py34-dj18-pytest
ERROR: InterpreterNotFound: python3.4
py34-dj110 create: /Users/dalan/Documents/pinax-stripe/.tox/py34-dj110
ERROR: InterpreterNotFound: python3.4
py34-dj110-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py34-dj110-pytest
ERROR: InterpreterNotFound: python3.4
py34-dj111 create: /Users/dalan/Documents/pinax-stripe/.tox/py34-dj111
ERROR: InterpreterNotFound: python3.4
py34-dj111-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py34-dj111-pytest
ERROR: InterpreterNotFound: python3.4
py34-dj20 create: /Users/dalan/Documents/pinax-stripe/.tox/py34-dj20
ERROR: InterpreterNotFound: python3.4
py34-dj20-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py34-dj20-pytest
ERROR: InterpreterNotFound: python3.4
py35-dj18 create: /Users/dalan/Documents/pinax-stripe/.tox/py35-dj18
ERROR: InterpreterNotFound: python3.5
py35-dj18-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py35-dj18-pytest
ERROR: InterpreterNotFound: python3.5
py35-dj110 create: /Users/dalan/Documents/pinax-stripe/.tox/py35-dj110
ERROR: InterpreterNotFound: python3.5
py35-dj110-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py35-dj110-pytest
ERROR: InterpreterNotFound: python3.5
py35-dj111 create: /Users/dalan/Documents/pinax-stripe/.tox/py35-dj111
ERROR: InterpreterNotFound: python3.5
py35-dj111-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py35-dj111-pytest
ERROR: InterpreterNotFound: python3.5
py35-dj20 create: /Users/dalan/Documents/pinax-stripe/.tox/py35-dj20
ERROR: InterpreterNotFound: python3.5
py35-dj20-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py35-dj20-pytest
ERROR: InterpreterNotFound: python3.5
py36-dj111 create: /Users/dalan/Documents/pinax-stripe/.tox/py36-dj111
ERROR: InterpreterNotFound: python3.6
py36-dj111-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py36-dj111-pytest
ERROR: InterpreterNotFound: python3.6
py36-dj20 create: /Users/dalan/Documents/pinax-stripe/.tox/py36-dj20
ERROR: InterpreterNotFound: python3.6
py36-dj20-pytest create: /Users/dalan/Documents/pinax-stripe/.tox/py36-dj20-pytest

Errors continue along with many errors of no module named pytest when I definitely have it installed.

As well as:

ERROR: InvocationError for command /Users/dalan/Documents/pinax-stripe/.tox/py27-dj110-pytest/bin/coverage run -m pytest (see /Users/dalan/Documents/pinax-stripe/.tox/py27-dj110-pytest/log/py27-dj110-pytest-8.log) (exited with code 1)
ERROR: invocation failed (exit code 1), logfile: /Users/dalan/Documents/pinax-stripe/.tox/checkqa/log/checkqa-8.log
ERROR: actionid: checkqa
msg: runtests
cmdargs: ['/Users/dalan/Documents/pinax-stripe/.tox/checkqa/bin/flake8', 'pinax']

Which led me to look at the log file:

➜  pinax-stripe git:(master) ✗ cat /Users/dalan/Documents/pinax-stripe/.tox/checkqa/log/checkqa-8.log
actionid: checkqa
msg: runtests
cmdargs: ['/Users/dalan/Documents/pinax-stripe/.tox/checkqa/bin/flake8', 'pinax']

/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/pycodestyle.py:113: FutureWarning: Possible nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8_isort.py", line 137, in sortimports_linenum_msg
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 646, in _run_checks
    return checker.run_checks()
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 577, in run_checks
    self.run_ast_checks()
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 491, in run_ast_checks
    for (line_number, offset, text, check) in runner:
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8_isort.py", line 72, in run
    for line_num, message in self.sortimports_linenum_msg(sort_result):
RuntimeError: generator raised StopIteration
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/bin/flake8", line 11, in <module>
    sys.exit(main())
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/main/application.py", line 348, in run
    self._run(argv)
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/main/application.py", line 336, in _run
    self.run_checks()
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/main/application.py", line 266, in run_checks
    self.file_checker_manager.run()
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 317, in run
    self.run_parallel()
  File "/Users/dalan/Documents/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 286, in run_parallel
    for ret in pool_map:
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 354, in <genexpr>
    return (item for chunk in result for item in chunk)
  File "/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
RuntimeError: generator raised StopIteration

Ultimately, I work for Stripe and just found out about this package while at Pycon AU in Sydney. I'd love to help contribute to the repo! But I thought we might want to get the instructions sorted to ensure people can successfully start developing and testing easily.

  1. There is not much sense in running all variants using detox - docs should be adjusted.
  2. You should rather pick a single env (see tox -l).
    And then of course you need the used Python to be installed already outside of tox.
  3. Not sure about the problem with "checkqa".

Thanks for the thoughts @blueyed. I wrote a quick Dockerfile to try and separate out what was going wrong and hopefully to discover that it was my current OS X environment or some bad intersection with my brew installed python@2. However it's still not working and I'm curious how CircleCI or any of the contributors are successful in running the tests.

Dockerfile:

FROM bopen/ubuntu-pyenv
COPY . /pinax-stripe
WORKDIR /pinax-stripe
RUN git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
RUN pyenv install 2.7.14
RUN pip install detox django-appconf jsonfield stripe django pytz six django-ipware
CMD detox

I also modified tox.ini to just try and run the 2.7 tests by removing the py3* lines:

 envlist =
     checkqa
     py27-dj{18,110,111}{,-pytest}
-    py34-dj{18,110,111,20}{,-pytest}
-    py35-dj{18,110,111,20}{,-pytest}
-    py36-dj{111,20}{,-pytest}

And then I tried to run tox on a single Python version in my clean slate docker image. Unfortunately, I was still getting the same missing dependencies.

➜  pinax-stripe git:(master) ✗ docker run -it fac4d712d77d /bin/sh
#
# tox -l
checkqa
py27-dj18
py27-dj18-pytest
# tox py27-dj18
checkqa create: /pinax-stripe/.tox/checkqa
checkqa installdeps: flake8 == 3.4.1, flake8-isort == 2.2.2, flake8-quotes == 0.11.0
checkqa develop-inst: /pinax-stripe
checkqa installed: certifi==2018.8.24,chardet==3.0.4,Django==2.1.1,django-appconf==1.0.2,django-ipware==2.1.0,flake8==3.4.1,flake8-isort==2.2.2,flake8-polyfill==1.0.2,flake8-quotes==0.11.0,idna==2.7,isort==4.3.4,jsonfield==2.0.2,mccabe==0.6.1,-e git+https://github.com/pinax/pinax-stripe@06c2ec80d97ee456e781c3cfbfa71149f828af22#egg=pinax_stripe,pycodestyle==2.3.1,pyflakes==1.5.0,pytz==2018.5,requests==2.19.1,six==1.11.0,stripe==2.7.0,testfixtures==6.3.0,urllib3==1.23
checkqa runtests: PYTHONHASHSEED='1483929480'
checkqa runtests: commands[0] | flake8 pinax
/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/pycodestyle.py:113: FutureWarning: Possible nested set at position 1
  EXTRANEOUS_WHITESPACE_REGEX = re.compile(r'[[({] | []}),;:]')
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8_isort.py", line 137, in sortimports_linenum_msg
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/pyenv/versions/3.7.0/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/opt/pyenv/versions/3.7.0/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 646, in _run_checks
    return checker.run_checks()
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 577, in run_checks
    self.run_ast_checks()
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 491, in run_ast_checks
    for (line_number, offset, text, check) in runner:
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8_isort.py", line 72, in run
    for line_num, message in self.sortimports_linenum_msg(sort_result):
RuntimeError: generator raised StopIteration
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/pinax-stripe/.tox/checkqa/bin/flake8", line 11, in <module>
    sys.exit(main())
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/main/cli.py", line 16, in main
    app.run(argv)
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/main/application.py", line 348, in run
    self._run(argv)
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/main/application.py", line 336, in _run
    self.run_checks()
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/main/application.py", line 266, in run_checks
    self.file_checker_manager.run()
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 317, in run
    self.run_parallel()
  File "/pinax-stripe/.tox/checkqa/lib/python3.7/site-packages/flake8/checker.py", line 286, in run_parallel
    for ret in pool_map:
  File "/opt/pyenv/versions/3.7.0/lib/python3.7/multiprocessing/pool.py", line 354, in <genexpr>
    return (item for chunk in result for item in chunk)
  File "/opt/pyenv/versions/3.7.0/lib/python3.7/multiprocessing/pool.py", line 748, in next
    raise value
RuntimeError: generator raised StopIteration
ERROR: InvocationError for command '/pinax-stripe/.tox/checkqa/bin/flake8 pinax' (exited with code 1)
py27-dj18 create: /pinax-stripe/.tox/py27-dj18
py27-dj18 installdeps: coverage, codecov, Django>=1.8,<1.9
py27-dj18 develop-inst: /pinax-stripe
py27-dj18 installed: asn1crypto==0.24.0,certifi==2018.8.24,cffi==1.11.5,chardet==3.0.4,codecov==2.0.15,coverage==4.5.1,cryptography==2.3.1,Django==1.8.19,django-appconf==1.0.2,django-ipware==2.1.0,enum34==1.1.6,idna==2.7,ipaddress==1.0.22,jsonfield==2.0.2,-e git+https://github.com/pinax/pinax-stripe@06c2ec80d97ee456e781c3cfbfa71149f828af22#egg=pinax_stripe,pycparser==2.18,pyOpenSSL==18.0.0,pytz==2018.5,requests==2.19.1,six==1.11.0,stripe==2.7.0,urllib3==1.23
py27-dj18 runtests: PYTHONHASHSEED='1483929480'
py27-dj18 runtests: commands[0] | coverage run setup.py test py27-dj18
Coverage.py warning: No data was collected. (no-data-collected)
invalid command name 'py27-dj18'
ERROR: InvocationError for command '/pinax-stripe/.tox/py27-dj18/bin/coverage run setup.py test py27-dj18' (exited with code 1)
py27-dj18-pytest create: /pinax-stripe/.tox/py27-dj18-pytest
py27-dj18-pytest installdeps: coverage, codecov, Django>=1.8,<1.9
py27-dj18-pytest develop-inst: /pinax-stripe
py27-dj18-pytest installed: asn1crypto==0.24.0,atomicwrites==1.2.1,attrs==18.2.0,certifi==2018.8.24,cffi==1.11.5,chardet==3.0.4,codecov==2.0.15,coverage==4.5.1,cryptography==2.3.1,Django==1.8.19,django-appconf==1.0.2,django-ipware==2.1.0,enum34==1.1.6,funcsigs==1.0.2,idna==2.7,ipaddress==1.0.22,jsonfield==2.0.2,mock==2.0.0,more-itertools==4.3.0,pathlib2==2.3.2,pbr==4.2.0,-e git+https://github.com/pinax/pinax-stripe@06c2ec80d97ee456e781c3cfbfa71149f828af22#egg=pinax_stripe,pluggy==0.7.1,py==1.6.0,pycparser==2.18,pyOpenSSL==18.0.0,pytest==3.7.4,pytest-django==3.4.2,pytz==2018.5,requests==2.19.1,scandir==1.9.0,six==1.11.0,stripe==2.7.0,urllib3==1.23
py27-dj18-pytest runtests: PYTHONHASHSEED='1483929480'
py27-dj18-pytest runtests: commands[0] | coverage run -m pytest py27-dj18
============================ test session starts ============================
platform linux2 -- Python 2.7.15, pytest-3.7.4, py-1.6.0, pluggy-0.7.1
Django settings: pinax.stripe.tests.settings (from environment variable)
rootdir: /pinax-stripe, inifile: setup.cfg
plugins: django-3.4.2

======================= no tests ran in 0.00 seconds ========================
ERROR: file not found: py27-dj18

ERROR: InvocationError for command '/pinax-stripe/.tox/py27-dj18-pytest/bin/coverage run -m pytest py27-dj18' (exited with code 4)
__________________________________ summary __________________________________
ERROR:   checkqa: commands failed
ERROR:   py27-dj18: commands failed
ERROR:   py27-dj18-pytest: commands failed

You missed a command with your environment setup (pyvenv global). Change your Dockerfile to the following:

FROM bopen/ubuntu-pyenv
COPY . /pinax-stripe
WORKDIR /pinax-stripe
RUN git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
RUN pyenv install 2.7.14
RUN pyenv global 2.7.14
RUN pip install detox django-appconf jsonfield stripe django pytz six django-ipware
CMD detox

In addition, when you are specifying an environment to run with tox, you need to include the -e flag.

tox -e py27-dj18

Then you should be good to go!