ColoradoRLA icon indicating copy to clipboard operation
ColoradoRLA copied to clipboard

Add requirements.txt for Python smoke tests.

Open cjerdonek opened this issue 8 years ago • 5 comments

Hi!

I was reading the README for the smoketest directory and noticed that you can use a requirements.txt file. That's a best practice that simplifies test setup and also ensures that test environments are deterministic / identical across users (by pinning dependencies).

cjerdonek avatar Aug 16 '17 06:08 cjerdonek

Wow - thanks, Chris! This is a model PR with just the sort of help folks should indeed be able to use!

And I just learned some nice things about Checking out pull requests locally - User Documentation, e.g. this syntax for doing a git fetch command by PR:

git fetch origin pull/289/head:smoketest-add-requirements-txt

Do you know if venv works in RHEL 7? I find following the instructions in your link to virtual environment doesn't work on Ubuntu Trusty:

$ python3 -m venv ColoradoRLA-venv                                                    
The virtual environment was not created successfully because ensurepip is not
available.  On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

    apt-get install python3-venv

You may need to use sudo with that command.  After installing the python3-venv
package, recreate your virtual environment.

$ wajig install python3-venv
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python3-venv

nealmcb avatar Aug 16 '17 15:08 nealmcb

Hi Neal! Yes, I know it works, but I don't have recent experience installing it on Ubuntu via python3-venv. In my own environments, I'm currently installing Python from source rather than using the system apt-get installed Python, so things are a bit different. I'm guessing your error is because you didn't run the install command using sudo, as the instructions say you might need (and it's consistent IIRC with "unable to locate" errors).

It's good for you to be nailing this down though and documenting it, because once you can create virtualenvs on your system, everything becomes "easy." Many Python folks view virtualenvs as essential for working day-to-day.

cjerdonek avatar Aug 16 '17 16:08 cjerdonek

Indeed. I've used mkvirtualenv for years! Just trying to see how those exact instructions would work with venv. wajig is an apt helper app that automatically does stuff like running sudo for you.

This works, it turns out: wajig install python3.4-venv thanks to the instructions here: https://bugs.launchpad.net/ubuntu/+source/python3.4/+bug/1532231

So the instructions on that page need some help on at least some environments.

nealmcb avatar Aug 16 '17 17:08 nealmcb

Ah, cool, glad you figured it out so quickly! (Btw, I misunderstood the "unable to locate" error as being unable to locate the package after installation, but now I see it meant it couldn't locate it in the package management repository.)

cjerdonek avatar Aug 16 '17 17:08 cjerdonek

Thanks for the review, @nealmcb! I've updated the PR to address your comments.

cjerdonek avatar Aug 19 '17 18:08 cjerdonek