diff --git a/test/smoketest/.gitignore b/test/smoketest/.gitignore index 16d3c4dbb..0af220808 100644 --- a/test/smoketest/.gitignore +++ b/test/smoketest/.gitignore @@ -1 +1,2 @@ .cache +smoketest-venv/ diff --git a/test/smoketest/README.md b/test/smoketest/README.md index 848af7590..242c9ff20 100644 --- a/test/smoketest/README.md +++ b/test/smoketest/README.md @@ -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 @@ -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 ``` diff --git a/test/smoketest/requirements.in b/test/smoketest/requirements.in new file mode 100644 index 000000000..a48bf0a5b --- /dev/null +++ b/test/smoketest/requirements.in @@ -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 diff --git a/test/smoketest/requirements.txt b/test/smoketest/requirements.txt new file mode 100644 index 000000000..8883a6c18 --- /dev/null +++ b/test/smoketest/requirements.txt @@ -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