Commit Graph

94 Commits

Author SHA1 Message Date
Riccardo Pittau d4554e4ab5 Force constraints when installing a package during tox test
The tox deps option grants installation of single dependencies and
requirements, optionally pinned using constraints, before installing
a package, therefore not granting installation of the correct
constraint during the package installation.
To fix that tox 4.4.0 has introduced the constrain_package_deps
option [1]

[1] https://tox.wiki/en/4.12.1/faq.html#using-constraint-files

Change-Id: I770e55db5d6f53174c490749d27830f9209e98cc
2024-02-12 14:59:39 +01:00
Zuul a22d1fc411 Merge "Add tox target and configuration for codespell" 2024-01-08 17:22:04 +00:00
Jay Faulkner dcaed43ef9 Update to latest pep8/code style versions
Update various linting programs to their latest version, and fix any
issues created by the update.

Change-Id: I014c846560663a76a1663b568ef48659d0ab6d4d
2023-12-28 14:19:27 -08:00
Jay Faulkner 4a1acae5bc Add tox target and configuration for codespell
Adds a tox target for codespell, `tox -e codespell`. Can optionally
be run as `tox -e codespell -- -w` to get automatic spelling fixes
applied where appropriate. Adds small amounts of configuration to
setup.cfg, including an ignore list of words.

Related-bug: #2047654
Change-Id: I98203b02a9c6b6fc36edd6b4bbcc7c92a634da8b
2023-12-28 11:43:10 -08:00
likui 80c3f568bd tox: Remove basepython
Python 2 is EOL. No environment should be defaulting to it. Our CI
environments certainly aren't.

Change-Id: Ib2e4304fc6c95c853570f48690a2d2a4aeeabdbe
2023-08-02 16:59:59 +08:00
Jay Faulkner d7234c2be0 Upgrade to latest hacking - v6
No code changes needed to comply with newest flake.

Change-Id: I256397efe0fbb3e307d808b0eda2e4d72d83f9b0
2023-04-21 12:19:02 -07:00
Riccardo Pittau f2b4ac8751 Readd usedevelop true to tox.ini
This avoid using sdist, which is the wanted behavior

Change-Id: Ibfb867ee0ff8274130a19538aa7ff9b9296dc4e1
2023-01-25 14:40:21 +01:00
Riccardo Pittau 39b6553161 Fix for tox4 and setuptools
- Disable auto discovery in setuptools
This is to avoid issues with latest setuptools after version 61.0
For more info see [1]
- add bash script to allowlist in tox.ini
- use default size for vm memory

[1] https://github.com/pypa/setuptools/issues/3197

Change-Id: Iae24917add1aae6b1ed46dba0d2c270b39c5698c
2023-01-02 14:40:35 +01:00
Jay Faulkner 3ded705e56 Fixes for tox 4.0
- passenv needed better structure
- usedevelop no longer allowed alongside skipsdist

Change-Id: I22dae3b1e4cca2dc328c21e889acf7fe98a80e0b
2022-12-15 10:20:43 -08:00
Riccardo Pittau f1d45a60e7 Drop lower-constraints.txt and its testing
As discussed in TC PTG[1] and TC resolution[2], we are
dropping the lower-constraints.txt file and its testing.
We will keep lower bounds in the requirements.txt file but
with a note that these are not tested lower bounds and we
try our best to keep them updated.

[1] https://etherpad.opendev.org/p/tc-zed-ptg#L326
[2] https://governance.openstack.org/tc/resolutions/20220414-drop-lower-constraints.html#proposal

Change-Id: I16ea0a61c018d03d6c23e0b0736295a36b6dd367
2022-05-10 09:46:19 +02:00
Zuul 71f54b7f98 Merge "Increase version of hacking and pycodestyle" 2021-08-11 10:02:24 +00:00
Riccardo Pittau 22b538d61c Add lower-constraints job to current development branch
The lower-constraints test was removed because of an issue where pip
could not correctly determine the required packages versions to install,
ending in an almost infinite loop that would end up in timeout, failure,
and general mayhem.
Recently the issue has been fixed and, if properly configured, the
lower-constraints test can provide good indication of which minimum
versions are required to support the current code.
This patch adds the test back to the current development branch, and it
runs only on master.
The lower-constraints file will stay in the future stable branches.

Change-Id: Ic9cef3e56266c6e9de0936b5f113e8b38d705a9b
2021-08-04 11:35:51 +02:00
Riccardo Pittau efbbc86f53 Increase version of hacking and pycodestyle
Fix H904 "Delay string interpolations at logging calls" errors

Change-Id: I331808d0132094faf739998a6984440787d3ebf8
2021-07-30 14:34:33 +02:00
likui 5473700f9c Remove lower-constraints job
As discussed during the upstream ironic community meeting on
Monday Dec 14 2020, the lower-constraints job is being removed.

Change-Id: I9392117ccdef8fc6ff3d95d667107d752459cb24
2021-06-11 15:36:21 +08:00
likui e27cdb3673 Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: I434a6330defbc5cc65788f4d64b7f2d4d2b37db7
2021-06-03 16:51:06 +08:00
Zane Bitter b510d2d4d0 unit tests: Capture log output
Debugging unit test failures is very challenging because all of the log
output is mixed together. Capture the log messages and store them as
part of the test, so that only log messages associated with failures are
output, interleaved correctly with the results.

This does not capture logs sent to stdout by _early_log(), although that
would be a nice further improvement.

Change-Id: I01e409ea73ff444e16caae0078e81585c703d5a5
2021-04-29 09:56:08 -04:00
Riccardo Pittau c72e58b2fa Update minversion of tox
The minimum version since when tox accepts having inline comments
in deps is 3.9.0

https://tox.readthedocs.io/en/latest/changelog.html#v3-9-0-2019-04-17

Change-Id: Ice30f3c900dd87c07f29a96cdbeef9899ead6777
2021-01-22 09:16:21 +01:00
Zuul 923bded572 Merge "Avoid a full install in tox environments that do not need it" 2020-12-15 09:15:41 +00:00
Dmitry Tantsur 88621e1886 Avoid a full install in tox environments that do not need it
Usage of usedevelop=True results in all requirements.txt dependencies
always installed (without constraints) even when requirements.txt
is not explicitly added. Override usedevelop for these environments.

Add missing constraints to the bandit environment.

Change-Id: I037dc04ffc4f426c828667df010ebe4e357e7fda
2020-12-14 16:48:59 +01:00
Riccardo Pittau 67ee66785c Upgrade version of doc8
The doc8 module explicitl supports Python 3.6 starting from version
0.8.1

Also remove it from test-requirements as we already have it in tox.ini

Change-Id: Idc66758dc350d9a7a09b4295b08f4423cec288dc
2020-12-14 14:47:57 +01:00
Iury Gregory Melo Ferreira c327735b39 Fix lower-constraints with the new pip resolver
* Remove pep8 dependencies from test-requirements, they're not
needed there and are hard to constraint properly.

* Add cliff to l-c (same version we have on ironic)

Change-Id: I8e7582492276db2308217460af37f691fb99c0ce
2020-12-09 13:28:56 -08:00
likui 60900d4f22 Reuse the docs deps to benefit from constraints
Tox trying to install latest versions for building docs,
which may not be supported by stable and lower branches,
so should be restricted by respective version's upper-constraints.txt

Change-Id: I1e134bb72b6fef3fba8f20d3b3d65520c66bbbf1
2020-11-18 10:20:23 +08:00
likui 24a4b13a28 Use TOX_CONSTRAINTS_FILE
UPPER_CONSTRAINTS_FILE is old name and deprecated
-https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file
This allows to use uppper-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.

[1] https://review.opendev.org/#/c/722814/

Change-Id: Ibd7895fe3856a179b9f90104015057a38a062aa9
2020-11-03 13:18:58 +08:00
Dmitry Tantsur 7fb098aa0b Import example hardware managers from ipa-example-hardware-managers
They're not easily discoverable there, let's keep them in tree.

The examples have been restructured to have two different projects
ready to be copied and adjusted. PEP8 failures have been fixed.

Change-Id: I2af04f4b7f9a2109fe83ec517e716159331a48bb
Co-Authored-By: Jay Faulkner <jay@jvf.cc>
2020-07-31 13:35:34 +02:00
Riccardo Pittau c66bec0f43 Set min version of tox to 3.2.1
As recommended, since version 3.2.0 tox switches pip invocations
to use the module -m pip instead of direct invocation.
We set min version to 3.2.1 [1] to also fix the behavior of
--parallel--safe-build

[1] https://tox.readthedocs.io/en/latest/changelog.html#v3-2-1-2018-08-10

Change-Id: I6c91e84366dcec7290456eea535a0b2bd3eda4d1
2020-07-15 15:27:49 +02:00
Julia Kreger cf870ae510 Fix apidoc build
Change-Id: Id7c5686cdbdc79812e06eb4a5f87eddc75005cc3
2020-06-15 11:30:02 -07:00
Iury Gregory Melo Ferreira 2039a5d65b Stop configuring install_command in tox.
Currently, we are overriding 'install_command' to use 'pip'. This is
considered poor behavior and 'python -m pip' should be used instead:

https://snarky.ca/why-you-should-use-python-m-pip/

It turns out that this is the the default value provided by tox:

https://tox.readthedocs.io/en/latest/config.html#conf-install_command

So we can remove the line and simply use the default value.

openstack-discuss thread
http://lists.openstack.org/pipermail/openstack-discuss/2020-April/014237.html

Change-Id: Idda0a78f63d5bc3e8c9e56e042630c8d28db2162
2020-04-17 20:49:42 +02:00
Andreas Jaeger 3e7d44746e Cleanup py27 support
Make a few cleanups:
- Remove python 2.7 stanza from setup.py
- Add requires on python >= 3.6 to setup.cfg so that pypi and pip
  know about the requirement
- Remove obsolete sections from setup.cfg:
  * Wheel is not needed for python 3 only repo
  * Some other sections are obsolete
- Update classifiers
- Update requirements, no need for python_version anymore
- Use sphinx-build

Change-Id: I8abd764d97a6711d3e6347ec3a7b8967f1512006
2020-04-05 10:46:10 +02:00
Riccardo Pittau 96d46aa5bf Enforce running tox with correct python version based on env
Since removing support for Python 2, we changed the basepython
value to 3.
This means that all the tox tests run with the default python
version available in the system.
This is not quite correct when running on environment such as
py36, py37 or py38, since they imply running with different
Python versions based on the environment.
To enforce the correct version we need to add the option
ignore_basepython_conflict available since tox 3.1.0 [0].

[0] https://tox.readthedocs.io/en/latest/config.html#conf-ignore_basepython_conflict

Change-Id: I96758527bbba9d8ec298867390b25be493f57789
2019-12-23 09:57:40 +01:00
Dmitry Tantsur 82084730cd Remove the configuration sample file
It's horribly outdated and can be easily regenerated locally.
A similar change has been done to ironic long ago.

Change-Id: I5b7a0079bc90320adc2b4710cdee714d278e543c
2019-12-02 12:11:58 +01:00
Madhuri Kumari 18862bb5fa Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

ironic-python-agent is ready with python 3 and ok to drop
the python 2.7 support.

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://review.opendev.org/#/c/691178/

Change-Id: Ifd0e0b99bb82a7d7e82d6c14309468196f5734fc
2019-11-22 15:36:28 +05:30
Dmitry Tantsur fc068f2b0f tox.ini: remove the devenv environment
This is what 'venv' is for.

Change-Id: I0e2190a9bf7b11537d0931c4e1e970836eb11c01
2019-09-26 11:20:48 +02:00
Dmitry Tantsur 91ed55678e Fix tox.ini to correctly test lower-constraints
Due to the way we currently define install_command, all test targets
are using upper-constraints, including the lower-constraints one.
This patch fixes it and adds standard things like passing proxy settings.

Change-Id: I61c3b45ae591ea44688f29598cb8b802bb094423
2019-09-25 11:53:27 +02:00
Kaifeng Wang cef3bac3dc Build pdf doc
The is one of community goals that each project could produce a
single PDF file. The pdf should be in the output of openstack-tox-docs
job.

TeX packages are required to build PDF locally, following is recommended:

* inkscape
* texlive-latex-base
* texlive-latex-extra
* texlive-fonts-recommended

More about the goal:
https://governance.openstack.org/tc/goals/train/pdf-doc-generation.html
https://etherpad.openstack.org/p/train-pdf-support-goal
https://etherpad.openstack.org/p/pdf-goal-train-common-problems

Change-Id: If5446ce4ceee7e38a0052503aa8fc2b6c5d7de66
2019-09-06 10:48:58 +08:00
Kaifeng Wang 6f634c358b Adds bandit template and exclude some of tests
Adds bandit configuration template and exclude some of
tests that we don't want to fix for the moment.

Keeping job unvoted so that we can keep an eye on possible
issues while not breaking gate.

Change-Id: I092d686ba38723d7951e8f06415f28cc809ad365
Story: 2005791
Task: 33563
2019-06-20 14:39:36 +08:00
Kaifeng Wang 3352d40907 Incorporate bandit support in CI
Change-Id: I2144c284ffcfa696412fca30f59a66c54c3d1965
Story: 2005791
Task: 33564
2019-06-05 08:49:58 +08:00
Pavlo Shchelokovskyy 93dae93d52 Fetch upper constraints from opendev.org
the imagebuild/common/generate_upper_constraints.sh
is currently failing as the curl command in this file does not
handle redirects.

Instead of allowing redirects, use the proper current link to the
upper constraints file.

Change-Id: I92c5bfa65ba149687f61172c2a89ff38660a58cf
2019-04-22 14:45:14 +03:00
taoguo d4919dc068 Update min tox version to 2.0
The commands used by constraints need at least tox 2.0.

Change-Id: I4813ed34b22895d59db26d15ee5158de8840628a
2018-11-10 14:27:53 +08:00
Chuck Short 1036384f74 Switch to using stestr
According to Openstack summit session [1] stestr is maintained project
to which all Openstack projects should migrate.
Let's switch it then.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Also adjust requiremenst to past the gate checks.

Change-Id: If7a0ebd9cca26cb67eb2ec9036d0aa2693fdffbf
Signed-off-by: Chuck Short <chucks@redhat.com>
2018-06-29 09:38:30 -04:00
huang.zhiping 0a668b16da 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: I3c8e5c663a3fd881430f84fc502e46192de77fc7
2018-06-09 02:19:20 +08:00
John L. Villalovos c09634ad80 flake8: Add W503 to ignore list as invalid
W503 according to the [1] pycodestyle docs is not supposed to be
enabled. But it is.

W503 is something we will likely never enable as it is a personal
style decision and can change depending on the code. There is no one
right answer. Interestingly there is also a W504 which is the opposite
check.

[1] http://pycodestyle.pycqa.org/en/latest/intro.html#error-codes

Change-Id: I1025f21a57837e97280f82baba50fdd823a190cc
2018-04-11 09:33:45 -07:00
Doug Hellmann dc5d6590e2 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: I8d773d4ee3d0835fb2a9183fe2154e82db085bd5
Depends-On: https://review.openstack.org/555034
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-03-22 13:45:58 -04:00
melissaml c51b34e41e Replace curly quotes with straight quotes
Curly quotes usually input from Chinese input method.
When read from english context, it makes some confusion.

Change-Id: Ife984be980a4235d9b14152143e2b3540e414751
2018-01-26 00:59:03 +08:00
Zuul 20a36e1695 Merge "Use 'functional' tox environment" 2017-12-20 20:37:32 +00:00
Ruby Loo 64b663719a Use 'functional' tox environment
Rename 'func' to 'functional' tox environment and replace custom
legacy func job with cross-project 'openstack-tox-functional' job.

Change-Id: I2a774a0a9870163457d1e7bc9c2976a9680ace01
2017-12-20 12:20:13 -05:00
John L. Villalovos 1128a26cb4 tox: Don't create *.pyc files during unit/functional tests
Don't create *.pyc files during unit/functional tests as they just add
cruft during tox runs.

This is similar to what we already do in openstack/ironic

Change-Id: Id4364519903db20308f78f2aaeca3ad2d37b298a
2017-12-01 10:00:48 -08:00
John L. Villalovos 4d1272b171 tox: Use the default version of Python 3 for tox tests
When running the tox tests, use the default version of Python 3. Instead
of having to update the Python 3 version as we move from
    py34 -> py35 -> py36 -> py37 -> py38

Just use the default version of Python 3 on the system.

This will not affect what gets run in the gate, as the version is
explicitly specified when it runs there. This is for developers who run
the tests locally.

Change-Id: I005d85b7d8f84f5471db3c3da279c5cf9cf13d4e
2017-10-17 16:11:15 -07:00
John L. Villalovos e082559046 Fix for broken zuul v3 job and releasenotes
The Zuul v3 job is looking for the log files from the release notes
in: .tox/releasenotes/log/ but we had then in .tox/venv/log/

Fix it to where the Zuul v3 job expects it to be.

Also updated the 'docs' job, even though job isn't failing. If the job
did fail, with current setup, no log files would be copied which would
make debugging more difficult. This change will make it so the log
files are copied.

Change-Id: I5c036db1a9e94ca28e26fd7b45475d52223f5f0e
2017-10-16 13:50:44 -07:00
John L. Villalovos 0ef540fc20 Migrate to stestr as unit tests runner
Recent update brought os-testr 1.0.0 that already uses stestr test
runner instead of testrepository. This patch migrates those places
using testrepository to using stestr.

Inspired by the patch of the same name in openstack/ironic

Change-Id: I2c1b271550629437627f3f62b6f33e2beb2b3c4b
2017-09-26 09:23:53 -07:00
John L. Villalovos b67f9c1298 flake8: Enable some off-by-default checks
Enable the following off-by-default checks:
    * [H204] Use assert(Not)Equal to check for equality.
    * [H205] Use assert(Greater|Less)(Equal) for comparison.
    * [H210] Require ‘autospec’, ‘spec’, or ‘spec_set’ in
             mock.patch/mock.patch.object calls

Increase the version of hacking in test-requirements so that can use new
off-by-default checks.

No changes to code were required.

Change-Id: I98aa484dc5414ee49c281dfd40e44b3c613d53e0
2017-09-23 12:28:14 -07:00