... for easy reference. Also make sure old data is purged.
Also adds .coveragerc which is present in the other repos.
Change-Id: Ifee20fc38e9c8bb04c20ff4e690e652b9256d46f
Introduced changes:
- pre-commit config and rules
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.
Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.
pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker);
- Checks that non-binary executables have a proper
shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings (check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)
For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks
Change-Id: I04e73b8a70d32fec3e6131526e0bed0be8599c28
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
Python 3.8 is now our highest level supported python runtime.
This updates the default tox target environments to swap out
py37 for py38 to make sure local development testing is
covering this version.
This does not impact zuul jobs in any way, nor prevent local
tests against py37. It just changes the default if none is
explicitly provided.
Change-Id: Ie4a88297493182929b6620dd42d2e2b9d85dc637
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.
Fix problems found.
Remove hacking and friends from lower-constraints, they are not needed
for installation.
Change-Id: If75153300f07e6d1c5bf433af35a0dd4d98e6c7f
1. refactor basepython to testenv
2. remove py27 target
3. fix a bug that prevented usage of upper constraints in some test envs
Change-Id: I5fcec1c7ec978f9fb279de8ac9aae227e6ec5e9d
Sphinx 1.8 introduced [1] the '--keep-going' argument which, as its name
suggests, keeps the build running when it encounters non-fatal errors.
This is exceptionally useful in avoiding a continuous edit-build loop
when undertaking large doc reworks where multiple errors may be
introduced.
[1] https://github.com/sphinx-doc/sphinx/commit/e3483e9b045
Change-Id: I2858ce6bf73471328b92b52be1cdc18ab46254d9
Quotes around {posargs} cause the entire string to be combined into one
arg that gets passed to stestr. This prevents passing multiple args
(e.g. '--concurrency=16 some-regex')
Change-Id: Ib999d2ca6424351e18a61ccf14cf7588396d022a
According to Openstack summit session [1],
stestr is maintained project to which all Openstack projects should migrate.
Let's switch to stestr as other projects have already moved to it.
[1] https://etherpad.openstack.org/p/YVR-python-pti
Change-Id: Ibee9bd5c371f6f94131cccf093ec2100e258f411
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.
We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.
We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.
Change-Id: I5240d20be9647ade5015fba45c42f5ceb8e83d51
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Set the default python to python3 except for the py27 environment. We
have to set that explicitly to override the new default.
Change-Id: Ie23c9361218a3ecdedd7682fe4dc6236994ac31d
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Fixed a TypeError when running with python3, and also added
a 'benchmark3' target to run it on python3 explicitly.
Change-Id: Ia3514465f7d1e97845891cf9aaabcf93e36e0f57
Create a tox environment for running the unit tests against the lower
bounds of the dependencies.
Create a lower-constraints.txt to be used to enforce the lower bounds
in those tests.
Add openstack-tox-lower-constraints job to the zuul configuration.
See http://lists.openstack.org/pipermail/openstack-dev/2018-March/128352.html
for more details.
Change-Id: I4bf5b081d630414cdd8beb7fd322aeb6fd90d7d7
Depends-On: https://review.openstack.org/555034
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This adds a flag to the sphinx-build command to treat warnings
as errors.
It also cleans out the old doc related entries from setup.cfg
since docs are no longer built using that method.
Change-Id: I1bacf231605ab791d4b817223ab64be2a4133672
Add the bandit security scanner to the pep8 job.
* convert assert statement to raise AssertionError
* Don't hard code '/tmp' in test
* skip B404
Change-Id: Ie30163d32dc6884667f0725f5aced809c0de82d0
'pip install -U' ugrades specified packages, this is not necessary
since we use constraints, remove the parameter '-U' from the line.
With tools/tox_install.sh - which a previous change of mine removed -
the -U was not harmful, but with the current set up, it might cause
upgrades, so remove it.
Change-Id: Id4be08d56b83dcc4d8b14ffbbed55cad7c3ea8a4
We do not need tox_install.sh, pip can handle constraints itself
and install the project correctly. Thus update tox.ini and remove
the now obsolete tools/tox_install.sh file.
This follows https://review.openstack.org/#/c/508061 to remove
tools/tox_install.sh.
Change-Id: I79cc8160e11d11de83d91323ec28ccbe1b5fc15f
The gating on python 3.4 is restricted to <= Mitaka. This is due
to the change from Ubuntu Trusty to Xenial, where only python3.5
is available. There is no need to continue to keep these settings.
Change-Id: I1100dfbd3af361af33438263771ce7bf45d5bef0
Adding constraints support to libraries is slightly more complex than
services as the libraries themselves are listed in upper-constraints.txt
which leads to errors that you can't install a specific version and a
constrained version.
This change adds constraints support by also adding a helper script to
edit the constraints to remove oslo.rootwrap.
Change-Id: Ie14167eced0bba29f7d4e30f815785641c1da6c0
Now that there is a passing gate job, we can claim support for
Python 3.5 in the classifier. This patch also adds the convenience
py35 venv.
Change-Id: I7c1ce52e6d1427e797d4a002d0ee0543e11dd92b
* Remove support for python 2.6
* Remove skipsdist : Needs to be set only if
sdist is expensive
* Remove usedevelop : only needed when skipsdist
is set to True
* Remove install_command : We can just use the
default, we don't need to override
* Remove setenv : We can just use the default as
we don't need any extra environment variables
* Remove requirements.txt from deps, as this is
already added automatically
Change-Id: I5defad3ba70eac774a01b2137abbffcd812cd0d5
Use eventlet.green.subprocess if eventlet is used and enable eventlet
tests on Python 3.
This change adds oslo_rootwrap.subprocess which is
eventlet.green.subprocess if eventlet monkey-patching is enabled or
if the TEST_EVENTLET environment variable is set, or subprocess of
the Python standard library otherwise.
When eventlet is used (with monkey-patching or not), it's more
reliable to use eventlet.green.subprocess instead of using directly
subprocess from the Python standard library.
On Python 2, it "works" to use directly subprocess: subprocess.Popen
calls os.pipe() and os.fdopen(fd) which are both monkey-patched. On
Python 3, it doesn't work because subprocess uses os.pipe() and
io.open(fd), and the io module is *not* monkey-patched at all.
Change-Id: Ib859bebe52612b35f0f1f53aedf76222683795e7
* get StringIO from six.StringIO to support Python 2 and Python 3
* Replace "__builtin__.open" with "six.moves.builtins.open" to mock
open()
* Workaround a Python 3.4.0 regression: get the log level directly
from logging._nameToLevel instead of using logging.getLevelName().
Replace Python 3.3 with Python 3.4:
* tox.ini: replace py33 test environment with py34
* setup.cfg: replace "Programming Language :: Python :: 3.3"
classifier with "Programming Language :: Python :: 3.4"
Change-Id: Ied495f5867f47eee57b64ab35c0423913ee17d6e
eventlet is already available for Python 3.x so no reason to
keep requirements for Python 3.x special.
This should also fix failing I98a0fa6.
Change-Id: Ib56f93f6749846c730c9a765217f3d15df4a6971
Currently translatable messages are not used, so there are no uses
of _.
This will ensure if _ is used in the future pep8 won't assume
it is provided as a builtin.
Change-Id: Ifd514de79f8c82bb2423d9e7e7f8479f16d5f71c
Benchmark for daemon mode is to be added in next commit.
Current results on my machine for 'ip a':
method : min avg max dev
ip a : 3.701ms 4.966ms 12.720ms 1.206ms
sudo ip a : 11.531ms 13.538ms 19.685ms 1.525ms
sudo rootwrap conf ip a : 92.253ms 119.431ms 211.236ms 17.948ms
daemon.run('ip a') : 6.718ms 9.914ms 189.873ms 18.201ms
Implements: blueprint rootwrap-daemon-mode
Change-Id: Iace26738f910a18a5d1d3479fad949027e5a3816
Benchmark shows performance penalty rootwrap introduces compared to one of
plain sudo.
To run benchmark, issue: tox -e benchmark
Example output:
Running 'ip a':
method : min avg max dev
ip a : 4.185ms 4.570ms 5.657ms 187.705us
sudo ip a : 13.564ms 14.437ms 28.452ms 1.470ms
sudo rootwrap conf ip a : 148.839ms 192.424ms 254.043ms 19.219ms
Running 'ip netns exec bench_ns ip a':
method : min avg max dev
sudo ip netns exec bench_ns ip a : 109.772ms 151.627ms 209.943ms 22.991ms
sudo rootwrap conf ip netns exec bench_ns ip a : 289.345ms 345.471ms 463.807ms 32.873ms
Change-Id: Id8e41be6602fa8dcff48a8a4ba44d35dd3043731
Like commented in the test-requirements.ini file the test requirement
coverage can be moved into the tox.ini file when tox>=1.4 is required.
The minimum version at the moment is 1.6.
Change-Id: Ic71f63fb0fab0470e4732099bb8ab5c13dd98538
In order to keep this patch to just a requirements bump, ignore new and
stricter hacking rules that are being triggered. Fixing up the code and
turning these on is out of scope of this patch and is for future patches.
Change-Id: I4331cd8ed44712eba2f1edd76ff6bdb7dd874c44
Run the python 3 test environment before the others so
the python 3 version of anydbm used by testr picks a
file format known to the python 2 version of the library.
Change-Id: I4d94fa47fe0b4a0f815261f7048866cccab11299