Skip to content

Commit

Permalink
Merge "Remove py2 mentions from contributor docs"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Feb 12, 2020
2 parents 8fce844 + c0d06dd commit d897936
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 56 deletions.
15 changes: 3 additions & 12 deletions doc/source/contributor/development.environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ so the only package you install is ``tox`` itself::

Run the unit tests by doing::

tox -e py35
tox -e py27
tox -e py3

See :doc:`testing` for more details.

Expand All @@ -132,22 +131,14 @@ Manually installing and using the virtualenv

You can also manually install the virtual environment::

tox -e py27 --notest

or::

tox -e py35 --notest
tox -e py3 --notest

This will install all of the Python packages listed in the
``requirements.txt`` file into your virtualenv.

To activate the Cinder virtualenv you can run::

$ source .tox/py27/bin/activate

or::

$ source .tox/py35/bin/activate
$ source .tox/py3/bin/activate

To exit your virtualenv, just type::

Expand Down
50 changes: 6 additions & 44 deletions doc/source/contributor/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ This will create a virtual environment, load all the packages from
test-requirements.txt and run all unit tests as well as run flake8 and hacking
checks against the code.

You may run individual test targets, for example only py27 tests, by running::
You may run individual test targets, for example only py37 tests, by running::

tox -e py27
tox -e py37

Note that you can inspect the tox.ini file to get more details on the available
options and what the test run does by default.
Expand Down Expand Up @@ -93,17 +93,17 @@ it's setup in the CI environment.
Running a subset of tests using tox
-----------------------------------
One common activity is to just run a single test, you can do this with tox
simply by specifying to just run py27 or py35 tests against a single test::
simply by specifying to just run py37 tests against a single test::

tox -epy27 -- cinder.tests.unit.volume.test_availability_zone.AvailabilityZoneTestCase.test_list_availability_zones_cached
tox -epy37 -- cinder.tests.unit.volume.test_availability_zone.AvailabilityZoneTestCase.test_list_availability_zones_cached

Or all tests in the test_volume.py file::

tox -epy27 -- cinder.tests.unit.volume.test_volume
tox -epy37 -- cinder.tests.unit.volume.test_volume

You may also use regular expressions to run any matching tests::

tox -epy27 -- test_volume
tox -epy37 -- test_volume

For more information on these options and details about stestr, please see the
`stestr documentation <http://stestr.readthedocs.io/en/latest/MANUAL.html>`_.
Expand All @@ -123,44 +123,6 @@ can get around this by manually setting or updating the following line in
Note that you may use any location (not just ``/tmp``!) as long as it is not
a shared folder.

**Running py35 tests**

You will need to install python3-dev in order to get py35 tests to run. If you
do not have this, you will get the following::

netifaces.c:1:20: fatal error: Python.h: No such file or directory
#include <Python.h>
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
<snip>
ERROR: could not install deps [-r/opt/stack/cinder/test-requirements.txt,
oslo.versionedobjects[fixtures]]; v = InvocationError('/opt/stack/cinder/
.tox/py35/bin/pip install -r/opt/stack/cinder/test-requirements.txt
oslo.versionedobjects[fixtures] (see /opt/stack/cinder/.tox/py35/log/py35-1.log)', 1)
_______________________________________________________________ summary _______________________________________________________________
ERROR: py35: could not install deps [-r/opt/stack/cinder/test-requirements.txt,
oslo.versionedobjects[fixtures]]; v = InvocationError('/opt/stack/cinder/
.tox/py35/bin/pip install -r/opt/stack/cinder/test-requirements.txt
oslo.versionedobjects[fixtures] (see /opt/stack/cinder/.tox/py35/log/py35-1.log)', 1)

To Fix:

- On Ubuntu/Debian::

sudo apt-get install python3-dev

- On Fedora 21/RHEL7/CentOS7::

sudo yum install python3-devel

- On Fedora 22 and higher::

sudo dnf install python3-devel


**Assertion types in unit tests**

In general, it is best to use the most specific assertion possible in a unit
Expand Down

0 comments on commit d897936

Please sign in to comment.