Commit Graph

97 Commits

Author SHA1 Message Date
Riccardo Pittau 31ecf49b97 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: I14a93e67735df0f1b82dd687873ec77d8bfaac78
2024-02-12 14:58:41 +01:00
Zuul 64d82cd1d6 Merge "Bump hacking to 6.1.0" 2024-01-29 08:09:00 +00:00
Takashi Kajinami e76360a991 Bump hacking to 6.1.0
... which is the latest version available now.

Change-Id: I777ae1dd4202ae43da35089a36fc760894acae6e
2024-01-27 23:07:37 +09:00
Sharpz7 5e1ca2a437 [codespell] Add tox target and configuration for codespell
Continuing the work of @JayF in other repos.

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: https://bugs.launchpad.net/ironic-python-agent/+bug/2047654

Change-Id: I284045ee9dfb51eee59a0442abda657c74abed05
2024-01-15 07:16:35 +00:00
Jay Faulkner 853bedce5c Upgrade to latest hacking - v6
Includes a single minor change to comply with latest flake8.

Change-Id: Ifda4810940f5c4d963946939f103f65175cc7868
2023-04-21 12:26:23 -07:00
Riccardo Pittau 7a00c0d674 Exclude all files starting with . from flake8 tests
Some tests tool and IDE may create a .local directory inside the repo
with virtualenvs for dependencies, other tools may create . directories
or files for temporary reports.
While they can be removed in a second time, or configured differently,
it's advisable to just exclude all file starting with . from the
flake8 tests to avoid confusion and possible unexpected errors.

Change-Id: Iea00e194fbe9c89754fb0a65cdaaabdaad31e4cc
2023-03-23 14:39:56 +01:00
Riccardo Pittau 55b67de89e Fix tox4 error
Remove skipsdist that it was never supported and causes breakage
when used with usedevelop.

Change-Id: I20029ec4944b68a98c1b94b2b76dd81dcd2c5209
2022-12-28 14:59:04 +01:00
Jay Faulkner 1c6af2e63a No longer override install_command in tox.ini
Per ClarkB on the list, overriding install_command makes it more
difficult to troubleshoot behavior differences and failures.

Change-Id: I3fb6760bf4754bd1688db173037e55c238a0601e
2022-11-29 07:37:27 -08:00
leiyashuai 9d116cd7c6 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: I0f09e027650d5c2953dab7191b3f3286a37057f1
2022-08-23 08:30:19 -03:00
LiZekun 5662b92fda 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>.

Change-Id: I7b79d0bc10c4c5c48e167e7042d383921feb1486
2022-05-19 07:24:08 +00:00
Riccardo Pittau 54a176a085 Increase version of hacking and pycodestyle
Change-Id: Ib4340aacba21cadef655998b1729dc6b18e173a8
2021-07-29 16:19:57 +02:00
Riccardo Pittau f7db05cc9d Update min version of tox to use allowlist
The min version of tox is updated to 3.18.0 to replace whitelist_externals
with allowist_externals option [1]

[1] https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: I655917f1c44b68118ce22fcf479f3f317636ac98
2021-06-15 09:59:33 +02:00
Dmitry Tantsur 782b85d57f Import common keystone configuration from ironic
This code is used by both ironic and ironic-inspector with barely
any difference and will be required to import the JSON RPC code.

To prevent IPA from depending on keystoneauth, the new requirement
is added as a new extra feature "keystone".

Change-Id: I8bc08ec9e081a67d1687033413fee63698e14e69
2021-02-08 13:33:40 +01:00
Riccardo Pittau c9764a2df0 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: I1976e24792d506003962cf970cd59b8d47891f4a
2021-01-21 11:51:51 +01:00
Riccardo Pittau c99fae9393 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.

Change lower-constraints to make pip resolver happy.

Add bindep.txt to provide dev libraries to build python modules.

Change-Id: I4edc2ebc7b29849901964279b5cc551944d830a9
2020-12-09 12:43:40 -08:00
Riccardo Pittau 01574fa23a 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: Idc0c845dc499768d8f6ea2859596bc6e391c9f60
2020-07-06 09:19:22 +00:00
Dmitry Tantsur 7fd83d7d9b Dependencies and tox.ini clean-up
* Remove testscenarios, it's an ancient artefact
* Replace the only usage of testtools with a simple check
* Split out doc/requirements.txt
* Clean tox.ini of unnecessary (and probably cargo-culted) stuff
* Added Pygments for syntax highlighting check

Change-Id: I9f6b03606973e1e8123165c46bef53c4ce8e2b92
2020-04-28 13:20:08 +02:00
Andreas Jaeger a235a15346 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
- Update classifiers
- Update requirements, no need for python_version anymore
- Switch to apidoc instead of autodoc for API docs, use sphinx-build.

Change-Id: Ie6107bc80961a7306957b17ac2eda44417b53d3e
2020-04-05 19:16:10 +02:00
Riccardo Pittau f6cdde207a [trivial] add description of ignored flake8 checks
Change-Id: Ied8a0e728e08f4f3ea7a7db4e1047360cfe6d734
2020-04-01 14:18:11 +02:00
Dmitry Tantsur 6c9d5dc58b Bump hacking to 3.0.0
The new version enables a lot of standard flake8 checks, so a few
fixes are required. W503 is disabled as it conflicts with W504
and the latter seems to be preferred nowadays.

Change-Id: I929ff36eaa47a42bc551f5c37bd40f64bc4f14d0
2020-03-30 11:34:27 +02:00
Riccardo Pittau b849d0ff42 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: I63127c91c708af3a215fc653e43e2017c46dd7ad
2019-12-23 11:19:07 +01:00
Iury Gregory Melo Ferreira 6bb4f81c46 Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

ironic-lib 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: Idfa5afedb607c99c34ff4a07594f698c9bd3bed8
2019-11-22 14:10:45 +01:00
Kaifeng Wang aa44aadb72 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: I8b42ab0f057cb33c1ec93adfa32c45aafc2730b0
2019-09-06 08:45:32 +08:00
zhulingjie 899d255b4a Replace git.openstack.org URLs with opendev.org URLs
Change-Id: I94bac46dc88d4f4e02418ab303673884c5ef5f97
2019-04-23 09:04:42 +00:00
Chuck Short 89fbae42ac 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

Change-Id: Ibb1e23aceeb9a864306c52b410bda77736454ef0
Signed-off-by: Chuck Short <chucks@redhat.com>
2018-06-27 14:50:06 -04:00
Doug Hellmann e4dda71703 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: Ic86d838e3e0093d41d1230f96c5bd85fcc0e8016
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-06 15:27:00 -04:00
Doug Hellmann 4270bbe4e9 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: I7b1a6743bea281fc8c75fd8ad062973c51539670
Depends-On: https://review.openstack.org/555034
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-03-22 13:45:20 -04:00
melissaml 91e43cdb6e 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: I126b1f475614b7368ce76426ab1d7f61c8fbf4af
2018-01-26 00:41:00 +08:00
John L. Villalovos 7e578f1570 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: I775712a592bcdc01a6d0373d42971a8a53616112
2017-12-11 07:29:39 -08:00
Andreas Jaeger b5923cf7d2 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: Ic2615a261e433ce7ec8c0ef1d9c2061286a05739
2017-12-02 16:53:55 +00:00
John L. Villalovos 35adf2c8da 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: I49bd08a402663bfabe1fea14957435ee071145e7
2017-09-26 09:22:22 -07:00
John L. Villalovos c693d5d04f flake8: Enable some off-by-default checks
Enable the following off-by-default checks:
    * [H106] Don't put vim configuration in source files.
    * [H203] Use assertIs(Not)None to check for None.
    * [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
    * [H904] Delay string interpolations at logging calls.

Fix code that failed [H904]. Nothing else failed the new added checks.

Change-Id: I727c944aad04298de07bcdd1d0008dcb9ffe32e9
2017-09-06 20:39:38 -07:00
Jim Rollenhagen 8d899bd8f2 Revert "Update UPPER_CONSTRAINTS_FILE for stable/ocata"
This reverts commit c608d845ea.

This should have happened on the stable/ocata branch, not master.

Change-Id: I20bb1bc5a3dbe4dbf2358301cd98204300e2e8f3
2017-03-28 09:24:07 -04:00
John L. Villalovos 009d0abcad flake8: Specify 'ironic_lib' as name of app
Specify 'ironic_lib' as the name of the application for the flake8-import-order
plugin. That way it knows that imports of ironic_lib should come after external
libraries.

Change-Id: I6c88a6a8142634c1194832896f40f9bc9c122367
2017-03-16 08:40:55 -07:00
kavithahr 0e397eb988 Python 3.5 is added
Added python 3.5 to setup.cfg so it contains all supported python
versions. Removed python 3.4 in tox.ini because 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: I5051826fdc867caea9f6a17c39a86e1799365527
2017-03-09 11:03:58 +05:30
Jenkins 5f431bb36c Merge "Update UPPER_CONSTRAINTS_FILE for stable/ocata" 2017-03-02 10:37:14 +00:00
John L. Villalovos 30c946d330 Use flake8-import-order
Use the flake8 plugin flake8-import-order to check import ordering. It
can do it automatically and don't need reviewers to check it.

Change-Id: Ib3fde54d8baa2c6e3567ff3f1a902de4b25f9f70
2017-02-16 09:51:31 -08:00
Doug Hellmann c608d845ea Update UPPER_CONSTRAINTS_FILE for stable/ocata
Change-Id: Iffd79e8d267142579f71248e8b78ecb59f07d522
2017-01-18 12:10:29 -05:00
John L. Villalovos 4fc0078f95 Add py35 to tox environments
Since we're running python 3.5 tests now, we should also be
running thme when running all tests with just `tox`.

Change-Id: Ic5d1c64d4cfccbc517f753bfe48aec13a16736e8
2016-09-22 10:48:02 -07:00
Jenkins 5ca6f2c9a2 Merge "Use constraints for all the things" 2016-08-19 14:16:59 +00:00
Jim Rollenhagen 65fbc0d664 Use constraints for all the things
This configures tox to use upper-constraints for everything.

Change-Id: I77f8d86e8791c3853534c95f52c88594c428ba8d
2016-08-19 08:14:55 -04:00
Jay Faulkner 84f8c3095a Enforce doc8, make it pass, + fix inaccuracies
This patch fixes all sphinx warnings generated by malformed docstrings.

Additionally, it contains formatting and accuracy fixes for the metrics
docstrings, to ensure blockquotes are properly rendered, and to indicate
the get_metrics_logger() method is actually in metrics_utils.

Finally, this adds doc8 to the pep8 job, ensuring we don't reintroduce
some of these errors. As a note, there are items that can cause warnings
in doc builds that aren't enforced by doc8, and can't be enforced until
a doc build job is added to project-config.

Change-Id: I622812bfe8af576ab215c098dd211c6faf697a0c
Partial-bug: #1614272
Partial-bug: #1611559
2016-08-18 16:47:22 +00:00
Jay Faulkner 4f58317ce0 Add framework for doc building in ironic-lib
This adds a doc build for ironic-lib. Currently the only documentation
is that generated from docstrings.

Change-Id: I6ee00ad863bc7ce72958db4e8d5b6871a5b96eb0
Partial-bug: #1614272
2016-08-18 09:14:52 -07:00
Yushiro FURUKAWA c693f1e9bb Fix coverage option and execution
--coverage-package-name option was no longer supported by 'testr'[1].
This commit replaces from 'testr' to 'test' as coverage option.

[1] https://review.openstack.org/#/c/217847/

Change-Id: I0e3e5e837ee2f7275c489502700e91c15c7d44aa
2016-04-14 03:11:02 +00:00
John L. Villalovos 63f83cc9ff Put py34 first in the env order of tox
To solve the problem of "db type could not be determined" on py34 we
have to run first the py34 env to, then, run py27.  This patch puts py34
first on the tox.ini list of envs to avoid this problem to happen.

Change-Id: I80b755d0aa18db7c55ccaecd1c4f64d4fe09b4c5
Closes-Bug: #1489059
2015-10-01 06:07:29 +00:00
Jim Rollenhagen d7d3d03ddf Add a cover target to tox
This allows a post job to generate coverage data for ironic-lib. The
package name needs to be overridden, as the default is taken to be
ironic-lib, not ironic_lib.

Omit openstack.common as we aren't responsible for testing that.

Change-Id: I30a810effd918b8cb88485a527ecbfbc01dfb2e1
2015-09-30 09:37:26 -07:00
Jim Rollenhagen eb1277cc59 Better optimize test runs
This syncs a few changes from ironic's tox.ini:

* Specify minimum tox version as 1.8
* Skips sdist generation
* Don't write bytecode (pyc) when running tests
* Run tests in English so that log messages are consistent

Change-Id: If0b8afb1102d8ee2ba31ea88f1259fbb42143605
2015-09-30 09:37:26 -07:00
Jim Rollenhagen fb520b1302 Move tests/ under ironic_lib/, use ostestr
This moves the tests directory under ironic_lib, which is kind of the
standard around here. Updates tox.ini to point at this directory.

Also updates tox.ini to use ostestr, to be more standard with other
OpenStack things.

Change-Id: I91e6ba38c44a475602175b66c10757ec11b173f9
2015-09-30 09:37:17 -07:00
Ramakrishnan G f33d181430 Fix E128 issues and enable E128
This commit fixes the issues reported by pep8 as
violation of E128, and enables E128 in tox.ini

Change-Id: If88653c3dbadffa63b5ba7c561f69ce893d670ac
2015-08-13 12:57:19 +00:00
Dmitry Tantsur e5731c00b4 Update tox.ini and fix py34 issues
* No need to explicitly mention requirements.txt
* Added py34 environment
* Leave only required flake8 excludes
* Run with hash randomization

Also fixes tests on Python 3.

Change-Id: I03f2a474a66fba7a7e30bd326acb394f0b196f57
2015-08-13 11:24:46 +00:00