Skip to content
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

Setting up a test environment #781

Closed
rolette opened this issue Sep 6, 2016 · 2 comments
Closed

Setting up a test environment #781

rolette opened this issue Sep 6, 2016 · 2 comments

Comments

@rolette
Copy link

rolette commented Sep 6, 2016

Are there instructions somewhere on how to setup a test environment for redis-py? I'm working on a fix for #732. Besides the tests I run for my product, I'd like to run the automated redis-py unit tests before I submit a patch/pull-request.

I've installed tox and tried running it against redis-py, but I'm clearly missing some setup steps to get things configured. Presumably it's something to do with the various scripts in the vagrant directory, but I didn't find any READMEs that looked relevant.

@andymccurdy
Copy link
Contributor

andymccurdy commented Sep 6, 2016

Running tox within the root redis-py directory should execute the complete test suite against all supported Python versions. You need all supported Python versions installed for this to work successfully. The only other dependency is a running Redis instance on the default port: 6379.

The vagrant scripts configure a linux VM w/ multiple Redis and Sentinel processes running and expose those processes ports to the host OS. The VM currently isn't meant to run tox or py.test, but it probably could if you don't have another option.

@rolette
Copy link
Author

rolette commented Sep 6, 2016

Thanks @andymccurdy. That's pretty much what I tried at first, but no joy. In retrospect, I think some bits of pip and python got cross-linked between python 2.7 and 3.5. I used a different vagrant box that I hadn't worked with before and apparently pip maps to pip3 instead of pip2 on it.

I killed that instance and setup a new one and tox works from the root of redis-py as you described just fine (at least for python 2.7 and 3.4 that I tested it against).

In case it helps someone down the road, here's what I did to set things up:

# create new vagrant box (bento/ubuntu-14.04)
$ vagrant up
$ vagrant ssh

# on the new VM
#   - python 2.7.6, 3.4.3

$ sudo aptitude update
$ sudo aptitude install git
$ sudo aptitude install curl
$ sudo aptitude install python-dev python3-dev python-hiredis

$ curl https://bootstrap.pypa.io/get-pip.py > get-pip.py
$ sudo python3 get-pip.py
$ sudo python get-pip.py

$ sudo pip install -U hiredis
$ sudo pip3 install -U hiredis
$ sudo pip install tox

# get a vanilla instance of redis up and running
$ git clone https://github.com/antirez/redis.git
$ cd redis
$ git checkout 3.2.3
$ make
$ sudo make install
$ redis-server &

# make sure we can talk to redis
$ redis-cli ping
PONG

$ git clone https://github.com/andymccurdy/redis-py.git
$ cd redis-py
$ tox -e py34
$ tox -e py27

@rolette rolette closed this as completed Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants