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

Add requirements.txt for Python smoke tests. #289

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/smoketest/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.cache
smoketest-venv/
46 changes: 38 additions & 8 deletions test/smoketest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,47 @@ See results in smoketest.*.out, generated like this:
Note: the pytest tests from zerotest are currently unused and disabled.

## Installing Test Dependencies
For now, you'll need to install
[zerotest](https://github.com/jjyr/zerotest)

For now, you need to install [zerotest](https://github.com/jjyr/zerotest)
to run these tests, and/or generate new ones in the same way.

This is mainly tested with python3, but has been seen to work
on python2 also. You will need these libraries for some of the tests:
This is mainly tested with python3, but has been seen to work on python2.

### Create a Python virtual environment

Create a new [virtual environment](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments)
for the project:

$ python3 -m venv smoketest-venv

(This creates a directory called "smoketest-venv" inside the current
directory.)

On Debian/Ubuntu systems, the command above may instruct you to first install
`python3-venv`. If you are using Python 3.4 and installing `python3-venv`
gives you an error like the following:

> E: Unable to locate package python3-venv

then you can try installing `python3.4-venv` instead. This was seen
[to be required](https://bugs.launchpad.net/ubuntu/+source/python3.4/+bug/1532231)
on Ubuntu.

To activate the virtual environment in a new shell window:

$ source smoketest-venv/bin/activate

### Installing Python dependencies

Install the Python dependencies in your Python environment (e.g. in the
virtual environment you created above):

$ pip install -r requirements.txt

`pip install zerotest requests`
(You may need to replace `pip` with `pip3` above depending on your system.)

or `pip3 install zerotest requests` (or similar) if you have
multiple Python installations.
If `requirements.txt` ever needs updating, you can follow the instructions
inside `requirements.in`.

## Running a smoketest

Expand Down Expand Up @@ -141,7 +171,7 @@ Interim test of captured queries:
Generate raw test script which should work with existing database:

```
zerotest generate --ignore-all-headers server_test.json > server_test_raw.py
zerotest generate --ignore-all-headers server_test.json > server_test_raw.py
sed 's,localhost:8887,localhost:8888,' server_test_raw.py > server_test_raw2.py
```

Expand Down
14 changes: 14 additions & 0 deletions test/smoketest/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# "Abstract" dependencies for the project
#
# The sibling requirements.txt file contains the corresponding concrete /
# pinned dependencies.
#
# To update requirements.txt (e.g. to check for upgrades in package
# dependencies or to add a new dependency to the current file), run the
# following from a new virtual environment:
#
# $ pip install -r requirements.in
# $ pip freeze > requirements.txt
#
requests
zerotest
12 changes: 12 additions & 0 deletions test/smoketest/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
certifi==2017.7.27.1
chardet==3.0.4
idna==2.6
Jinja2==2.9.6
MarkupSafe==1.0
py==1.4.34
pytest==3.2.1
requests==2.18.4
six==1.10.0
urllib3==1.22
Werkzeug==0.12.2
zerotest==1.2.1