Commit Graph

52 Commits

Author SHA1 Message Date
Takashi Kajinami a52130de79 Display coverage report
... for easy reference. Also make sure old data is purged.

Also adds .coveragerc which is present in the other repos.

Change-Id: Ifee20fc38e9c8bb04c20ff4e690e652b9256d46f
2024-02-07 12:23:41 +09:00
Hervé Beraud b72372be2d Fix issues related to tox4
Related to https://lists.openstack.org/pipermail/openstack-discuss/2023-February/032247.html

Change-Id: Iec7659dbf64847d86def2a863cda8b5c49c65c3b
2023-02-17 13:15:31 +00:00
wu.shiming 85d0c7987b Remove lower-constraints remnants
These were missed in change: Iae7ce24bfd718a9a2102ce64e8dd2ad08d2b4dd6

Change-Id: I03f47af49cda61e18b0eaa96770a174b867fe2bc
2021-02-19 14:49:39 +08:00
Zuul 127d938253 Merge "Use py3 as the default runtime for tox" 2021-01-22 11:29:17 +00:00
Hervé Beraud 0d165aeb28 Use TOX_CONSTRAINTS_FILE
UPPER_CONSTRAINTS_FILE is old name and deprecated
This allows to use upper-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.

[1] https://review.opendev.org/#/c/722814/
[2] https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file

Change-Id: Ice53705bba857835e4c99ff526ff359f55a319af
2020-11-04 10:50:33 +01:00
Hervé Beraud 0d1bcc5496 Use py3 as the default runtime for tox
Moving on py3 as the default runtime for tox to avoid to update this at
each new cycle.

Wallaby support officially the following runtimes [1]:
- Python 3.6
- Python 3.8

During Victoria Python 3.7 was used as the default runtime [2] however this
version isn't longer officially supported.

[1] https://governance.openstack.org/tc/reference/runtimes/wallaby.html#python-runtimes-for-wallaby
[2] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-victoria

Change-Id: Ic211834cf66fd2f9e4fc4ce97f839b2362cc1f70
2020-11-04 10:04:23 +01:00
Hervé Beraud b1122e81ab Adding pre-commit
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>
2020-09-03 14:20:33 +02:00
Sean McGinnis 6caa7f05d3
Bump default tox env from py37 to py38
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>
2020-04-24 10:25:51 -05:00
Andreas Jaeger 4445f3296b Update hacking for Python3
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
2020-04-02 15:05:26 +02:00
Hervé Beraud 89beae0753 [ussuri][goal] Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in Ussuri cycle.

Complete discussion & schedule can be found in
-
http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Change-Id: I02784f635368ad7cc5ffde7cc8a4f4367143da98
2020-02-03 17:56:35 +01:00
caoyuan 286559f626 tox: Trivial cleanup
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
2020-01-06 14:28:33 +00:00
caoyuan 5a91d686de tox: Keeping going with docs
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
2019-11-03 02:10:35 +08:00
pengyuesheng a27c2b7083 Update the constraints url
For more detail, see http://lists.openstack.org/pipermail/openstack-discuss/2019-May/006478.html

Change-Id: I2c3631811deeda4ceb68b082c54b6dfb145cf5d0
2019-09-29 10:09:19 +08:00
Corey Bryant c6babc7222 Add Python 3 Train unit tests
This is a mechanically generated patch to ensure unit testing is in place
for all of the Tested Runtimes for Train.

See the Train python3-updates goal document for details:
https://governance.openstack.org/tc/goals/train/python3-updates.html

Change-Id: I1638f7d10bf43fe6eb8ad7fc27452f70a8deac4f
Story: #2005924
Task: #34234
2019-07-05 15:01:09 -04:00
Zuul 7a58fcce11 Merge "Replace git.openstack.org URLs with opendev.org URLs" 2019-05-03 18:17:11 +00:00
jacky06 a64282d913 Replace git.openstack.org URLs with opendev.org URLs
Change-Id: I80c0661599c18e01b5a51444423513f99084e3e8
Closes-Bug: #1826195
2019-04-24 19:10:25 +08:00
Ghanshyam Mann e36c0285ef Dropping the py35 testing
All the integration testing has been moved to
Bionic now[1] and py3.5 is not tested runtime for
Train or stable/stein[2].

As per below ML thread, we are good to drop the py35
testing now:
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/005097.html

[1] http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004647.html
[2]
https://governance.openstack.org/tc/reference/runtimes/stein.html
https://governance.openstack.org/tc/reference/runtimes/train.html

Change-Id: I0d3d40f8ac10f5b765141939cd3424332e1d4138
2019-04-15 18:37:50 +00:00
jacky06 a84402e79f Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: Ib78453ccb8fe3fa16d35bb49dd443cd6628ff932
2019-03-06 22:39:45 +08:00
Vieri 06e17e80fb Don't quote {posargs} in tox.ini
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
2018-10-09 13:37:19 +00:00
Vu Cong Tuan de7e0f0df2 Switch to stestr
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
2018-07-03 16:00:44 +07:00
Doug Hellmann 3b2b9b6462 fix tox python3 overrides
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>
2018-06-06 14:53:49 -04:00
Kenneth Giusti 7fad1d99ef Remove stale pip-missing-reqs tox test
pip_missing_reqs tool is no longer maintained and has broken with
release 10 of pip

Refer to:
 http://lists.openstack.org/pipermail/openstack-dev/2018-April/130027.html

Change-Id: Ib727ef8df87a5e195bcf6745df05b5cc3d5b9914
2018-05-02 10:44:26 -04:00
Doug Hellmann 5a37cb77b4 set default python to python3
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>
2018-04-13 16:05:18 -04:00
Brian Haley cfc7838f8c Update to support running benchmark on python3
Fixed a TypeError when running with python3, and also added
a 'benchmark3' target to run it on python3 explicitly.

Change-Id: Ia3514465f7d1e97845891cf9aaabcf93e36e0f57
2018-04-04 11:40:23 -04:00
Doug Hellmann fbc837e75a add lower-constraints job
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>
2018-03-24 21:02:51 -04:00
Sean McGinnis 674d805260 Treat doc warnings as errors
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
2018-01-08 11:47:18 -06:00
Sean McGinnis d3d76e08fc Follow the new PTI for document build
For compliance with the Project Testing Interface as described in:

https://governance.openstack.org/tc/reference/project-testing-interface.html

For more detials information, please refer to:

http://lists.openstack.org/pipermail/openstack-dev/2017-December/125710.html

Change-Id: Ifa689b590378f58d7abe2a52e8b92f5f32dc5196
2017-12-29 11:56:10 -06:00
ChangBo Guo(gcb) 24156a438f Add bandit to pep8 job
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
2017-12-13 11:25:50 +08:00
Andreas Jaeger e3fded79c1 Remove -U from pip install
'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
2017-12-02 19:30:23 +01:00
Andreas Jaeger 093bae2247 Avoid tox_install.sh for constraints support
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
2017-12-01 09:51:13 +01:00
melissaml 7a418520aa Remove support for py34
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
2017-02-09 20:02:19 +08:00
Tony Breeds 9e96313690 Add Constraints support
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
2016-12-13 15:39:31 +11:00
Jenkins a1487259fd Merge "Add reno for release notes management" 2016-09-14 16:20:10 +00:00
Yatin Kumbhare 5e5ed2e133 Add Python 3.5 classifier and venv
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
2016-07-12 17:01:41 +05:30
Kirill Bespalov 1c110e0398 Add reno for release notes management
An initial patch to add reno and create a base directory for
release notes

Change-Id: I14222756c84e0d2161fea5f4df75d78cd00dccb4
2016-06-30 09:59:31 +00:00
Davanum Srinivas bdbe0111cd Remove python 2.6 and cleanup tox.ini
* 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
2015-11-16 00:16:47 +00:00
Victor Stinner 31cfdbd407 Fix Python 3 support for eventlet monkey-patching
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
2015-10-13 21:51:47 +02:00
Victor Stinner 6f424f73cd Fix Python 3 issues in tests
* 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
2015-10-12 10:07:53 +02:00
Yuriy Taraday 97b936debc Remove test-requirements-py3.txt
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
2015-07-01 22:59:43 +03:00
Davanum Srinivas 143030e2fd Add tox target to find missing requirements
Change-Id: If202cafb98b4f5f339f16ac4a03fba3d5f4fdff9
2015-06-26 07:31:57 -04:00
James Carey c651d837a7 Activate pep8 check that _ is imported
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
2014-12-11 22:56:10 +00:00
Davanum Srinivas 94140b3287 Initial cut of documentation for oslo.rootwrap
Closes-Bug: #1364141
Change-Id: If20de8767ff36b0a64c3b39f346d54a1ad6ca08f
2014-09-10 09:16:20 -04:00
Jenkins a8f555fc97 Merge "Add an option to run rootwrap as a daemon" 2014-08-20 21:15:04 +00:00
Yuriy Taraday ed45e5aa6d Add an option to run rootwrap as a daemon
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
2014-08-13 20:42:59 +04:00
Jenkins 8ca6446f41 Merge "Move test requirement coverage into tox.ini" 2014-08-13 14:29:56 +00:00
Yuriy Taraday 196bdc0fa2 Add basic benchmark
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
2014-07-28 13:46:52 +04:00
Christian Berendt 1ae4684f49 Move test requirement coverage into tox.ini
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
2014-07-21 13:32:05 +02:00
Christian Berendt 5fb3475fac Enabled hacking check H305
* [H305] imports not grouped correctly

Change-Id: I2b2bf2ca5d1a8cfa68169e11b8cb885172bad0a2
2014-07-17 11:54:24 +02:00
Davanum Srinivas 338436a62e Bump hacking to 0.9.x series
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
2014-06-30 13:34:21 -04:00
Doug Hellmann 59beaa46fd Run py33 test env before others
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
2014-03-24 06:41:11 -07:00