Commit Graph

71 Commits

Author SHA1 Message Date
Zuul 0e90d8e4c9 Merge "tox: Don't share envdir between pep8 and fast8" 2023-12-19 17:33:59 +00:00
Eric Harney 04a23c59a7 tox: Don't share envdir between pep8 and fast8
This no longer works, so just drop it.

fast8: recreate env because env type changed from
{'name': 'pep8', 'type': 'VirtualEnvRunner'} to
{'name': 'fast8', 'type': 'VirtualEnvRunner'}

Tox stated here in 2022 that this functionality is
not intended to be supported:
https://github.com/tox-dev/tox/issues/425#issuecomment-1011944293

Change-Id: I99b36cb6c906872efa4c7f943001511af917c3be
2023-08-23 08:27:24 -04:00
Eric Harney 99f6f2b734 import pylint tooling from cinder
Make "tox -e pylint" useful.

Change-Id: Ia67670dffbfd000dd8056b0ae89eb9cdb6471bcb
2023-04-25 09:09:38 -04:00
Eric Harney e43cdf6e1e Bump bandit to release 1.7.0
Use bandit 1.7.0.

Disables B101 globally and allows one instance of B604.

Change-Id: I82a39400520784adb8d26a355cd0e077ad58a530
2023-01-25 10:17:21 -05:00
Brian Rosmaita c9b82241ea Get ready for tox 4
Changes:
- eliminate whitespace in passenv values
- account for stricter allowlist checking
- removed skipsdist=True, which in tox 4 appears to prevent os-brick
  from being installed in the testenvs
- made 4.0.0 the tox minversion

This patch makes tox 4 the default so that we can hopefully catch
problems locally before they block the gate.

Change-Id: I9f88d024c9d7b4f2761aa4e132ee0bd5b7272207
2022-12-21 08:11:58 -05:00
Brian Rosmaita e768fb5ca6 Add flake8-logging-format extension
Automated logging format checking was added to cinder in ussuri
by change I1dedc0b31f78f518c, but it wasn't added to os-brick and
a few infelicities have crept into the code.  Enable the extension
and correct the issues.

To be consistent with cinder, we don't enable G200 ("Logging
statement uses exception in arguments").

Change-Id: I650b92bde5509b654d16301ffe50056e1e5ba579
2022-08-09 16:19:32 -04:00
Gorka Eguileor 62adedf6a6 PEP8: Don't force name in TODO
The Cinder team decided a while ago to not require a name in TODO
comments, since they don't provide additional value.

This patch removes this requirement from the flake8 configuration, so
now we no longer should add TODO comments as:

    # TODO(geguileo): Improve this

But instead do naked TODO:

    # TODO: Improve this

Change-Id: Iefa41fb72b3ddca14cc905cc4fb41acd215c47a8
2022-05-24 15:01:13 +02:00
Brian Rosmaita 98c0916336 Update mypy infrastructure
Port cinder change Id69cb519ee7300b33ff087de4e7d46cdad67d162
to os-brick.

Change-Id: I57ce2aea95fa0d307a2cab89366f8f780a109535
2021-07-15 14:08:28 -04:00
Zuul 6c3a89d8e6 Merge "Drop lower-constraints jobs" 2021-07-15 17:10:19 +00:00
Yandong Xuan cb25b6f372 Drop lower-constraints jobs
Change-Id: Ib63486d89afb585fa462fed77cf1e0b762f112ba
2021-07-07 16:34:56 -04:00
Brian Rosmaita a6f1a93c13 Remove skip_missing_interpreters
This prevents a job reporting 'success' when the appropriate python
interpreter cannot be found, when actually it didn't run at all.
Also change the default envlist to use generic 'py3' instead of a
specific version which might not be present.

Jeremy Stanley has given a more thorough explanation of why this
is a good change:
http://lists.openstack.org/pipermail/openstack-discuss/2020-May/014810.html

Change-Id: I4be4c4167adf01b70980269b338fbb720c49aeab
2021-06-30 16:14:27 -04:00
Eric Harney f18a33b322 Introduce mypy
This adds the "tox -e mypy" environment which works
the same way we have introduced mypy in Cinder.

Files added to mypy-files.txt are validated with mypy.

Change-Id: I6d09422dbdf5ea58661aad7a63c4d4d7a2839833
2021-05-21 16:58:22 -04:00
Hemna eb566ce245 Enable bandit runs for tox
This patch adds tox settings for running tox -ebandit
to look at potential security issues.

Current issues:
  scaleio connector disables SSL cert verification.

Change-Id: I79bec423a051eb12ab53042840a519bd4a77b4da
2021-04-16 10:37:25 -04:00
Zuul c710f37d70 Merge "Enforce import order with flake8-import-order" 2021-03-04 17:48:07 +00:00
Zuul dbabb4a321 Merge "Changed minversion in tox to 3.18.0" 2021-03-03 22:14:20 +00:00
Eric Harney 55376b85ff Enforce import order with flake8-import-order
Use flake8-import-order to enforce the correct
order of imports (stdlib, third-party, project).

Change-Id: I5cadb10ee418dd1f5e8a7d407a93d95ebcbaedb8
2021-03-03 16:27:33 -05:00
tushargite96 15c114d54c 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: Ic7c30f00f6bd4fb5d49df9edc23873ce46e40a3a
2021-02-26 23:18:31 +05:30
tushargite96 c598659fd4 Update TOX_CONSTRAINTS_FILE
This allows to use lower-constraints file as more readable way
instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.

https: //zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file
Change-Id: I890048df63a600db1bcf97817f796975f02d72d3
2021-02-16 12:52:00 +05:30
zhangboye edbbe7d207 Replace deprecated UPPER_CONSTRAINTS_FILE variable
Change-Id: I4f3511374e0c558351bdc1099c68eecd82926bb0
2020-12-03 14:07:38 +08:00
tushargite96 070ab479c9 Stop configuring install_command in tox.
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.

Change-Id: I93b6aea505bc0b4e3e91229e7a2f35a8c01db6d7
2020-09-09 09:59:57 +05:30
Sean McGinnis eecfe7294a
Add doc linting to pep8 target
This adds a doc8 check to our pep8 job so both code and docs are lint
checked. This matches what is done in the cinder repo.

Depends-on: https://review.opendev.org/736382

Change-Id: If7b9414b8bbf4a41c0744460f16ff80a1a9cd94c
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-06-22 09:43:03 -05:00
Brian Rosmaita 08c609ceba Add dependencies to releasenotes environment
The current tox 'releasenotes' environment does not include the
doc/requirements.txt as a dependency, and as a result sphinx-build
cannot be found when attempting to build the release notes.  So add
it.

Change-Id: Ie86dc0966826b38999170d3b07d5616bd151baa8
2020-05-29 22:15:27 -04:00
Sean McGinnis f00c18c0fc
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: Ie5fb0c27a76f6d7f0b2165ae26c9accdf634307a
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-04-24 10:25:47 -05:00
Zuul df2a3969b7 Merge "Remove Python 2.7 support from testing and gates" 2019-12-17 14:19:29 +00:00
Zuul 8ae933a200 Merge "Fix tox 'bindep' environment" 2019-12-11 00:00:57 +00:00
Brian Rosmaita ecff5ec771 Remove Python 2.7 support from testing and gates
Makes Python 3 the base python for all tox venvs and removes
py2 jobs from zuul.yaml.

Remaining:
- move the legacy gate jobs from openstack-zuul-jobs to the os-brick
  repo and make them py3 jobs
- adjust setup.cfg to require py3 and remove py2 requirements from
  test-requirements.txt and doc/requirements.txt

Partial-bug: #1853372

Change-Id: Ib447656aa213914bafd50380b3821090f93776f8
2019-12-04 16:29:40 -05:00
Brian Rosmaita a8ee3a1b00 Fix tox 'bindep' environment
tox.ini is hard-coded to always use the 'test' profile for bindep;
instead, let tox get the profile from the posargs

Closes-bug: #1841836
Change-Id: I24bfb313cf28b20037f5f9aea9417bc8371bfd91
2019-11-13 19:50:00 +00:00
pengyuesheng 32b129761b Update the constraints url
For more detail, see http://lists.openstack.org/pipermail/openstack-discuss/2019-May/006478.html

Change-Id: If50cb6b9a4ff04ed96f4ce39fc952f7e8238fa45
2019-09-23 16:13:33 +08:00
Walter A. Boring IV 132a531e17 Add pdf documentation build in tox
This patch adds a tox command -e pdf-docs for building the pdf
documentation for os-brick.

Change-Id: Ib56ef75468bbbd39fcfec869c42ba4377ecbdd2c
2019-08-29 11:41:33 -07:00
Corey Bryant 4ec35ed3b0 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: If2aeeb1597146528b94b1cb76e3be6061831a0b1
Story: #2005924
Task: #34200
2019-06-22 06:01:43 -05:00
Zuul 8cb5fe3623 Merge "Replace git.openstack.org URLs with opendev.org URLs" 2019-05-08 04:10:41 +00:00
Eric Harney 80e37a3e61 Ignore pep8 W503/W504
W503 has been reversed in current pep8, so we
shouldn't start enforcing this here.

W504 takes the opposite stance of W503.

Neither of these seem worth enforcing in our
code for now, just punt on a strict rule for
this and aim for readable code.

Change-Id: Id38b2629ea22792bbc7b4dce77fa9e7039be140f
2019-04-25 15:15:44 -04:00
caoyuan 255b5c8c8a Replace git.openstack.org URLs with opendev.org URLs
Change-Id: Ib380ce9533dc54544257418cef6449cf8525219d
2019-04-23 20:55:14 +08:00
Sean McGinnis c88071dc19
Drop py35 jobs
Python 3.5 was the target runtime for the Rocky release. The current
target py3 runtime for Stein is Python 3.6, so there is no reason to
keep testing against the older version.

https://governance.openstack.org/tc/reference/runtimes/stein.html#python-runtime-for-stein

Change-Id: I3a8d2137a1d3158a476a6c23b8a6229b1dfc20f6
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-02-26 14:24:46 -06:00
Sahid Orentino Ferdjaoui ddab8ea8ad add python 3.7 unit test job
See ML discussion here [1] for context.

[1] http://lists.openstack.org/pipermail/openstack-dev/2018-October/135626.html

Story: #2004073
Co-authored-by: Charles Short <chucks@redhat.com>
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@canonical.com>
Change-Id: Ic6d01c35f04482acfdab975a118ffa9178b906b0
2019-02-26 16:40:04 +01:00
Sean McGinnis 959ec5d54d
Add slowest test output to end of test run
Change-Id: Ie74a663b147bde12456d9f64edca05cfb4a29136
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2019-02-07 14:43:32 -06:00
Zuul cb2ee2776d Merge "Switch to using stestr" 2018-06-12 17:22:10 +00:00
Doug Hellmann 66362ae0f2 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: Ie6a61e4db3f7d3f6e1c7478fab4ab4afb6c88ce1
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-06 15:27:01 -04:00
Charles Short 80d222a847 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: I5bfb3f34c27e393197456edf9b16010875fa9b7c
Signed-off-by: Charles Short <zulcss@gmail.com>
2018-06-03 08:19:28 -04:00
Doug Hellmann f11695cf0d 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: I59d376c6da1afc0847a25893d80ca9a210bbe64b
Depends-On: https://review.openstack.org/555034
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-04-17 17:17:38 -04:00
Luong Anh Tuan df8e0fe027 Enable hacking-extensions H204, H205
This patch enable extensions:
-[H204] Use assert(Not)Equal to check for equality.
-[H205] Use assert(Greater|Less)(Equal) for comparison.

Change-Id: I89efcab9993fcbb187249e32712fe00b86715e3a
2018-02-07 16:06:03 +00:00
Andreas Jaeger 56d034ab10 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: I43828f47711118eba8d835222586db4faac93180
2017-12-02 16:51:51 +00:00
Eric Harney e9422a730a Enable Python hash randomization for tests
This should be enabled for all tests to ensure
we don't introduce bugs related to code relying
on ordering of unordered types.

Change-Id: I7150e6f222c8b7a264da2d497ea879028ab24b12
2017-10-18 11:40:26 -04:00
Sean McGinnis 9a741bac21 Add .stestr.conf configuration
os-testr has moved over to use stestr instead of testr. While this
is usually compaible with existing settings, there is a warning
that is emitted when .stestr.conf is not present. It is usually
able to fall back to parsing the .testr.conf file, but to be more
correct and to prevent future problems we should update the config.

Change-Id: I15fd3427485ff26ee936cae622585745ba9281b7
2017-10-02 17:35:26 -05:00
Jenkins 0f01864959 Merge "Enable some off-by-default checks" 2017-09-01 14:22:04 +00:00
Stephen Finucane f3eb28dcf6 doc: Remove cruft from conf.py
Clean up both the releasenotes 'conf.py' and some remaining pieces of
the main 'conf.py'. In the case of the former, it looks like this was
copied from Cinder's config, and retains a lot of unnecessary config for
same. Remove it all.

It is also necessary to remove a docstring from 'os_brick/__init__.py',
as this was causing build issues. No idea how this was building
previously.

Change-Id: I2ca913c2ebcf2030642b18c72af180bb8f03b288
2017-08-08 15:44:29 +01:00
zhanghongtao cbca5ba77b Enable some off-by-default checks
Some of the available checks are disabled by default, like:
[H106] Don’t put vim configuration in source files
[H203] Use assertIs(Not)None to check for None

Change-Id: I4b7cc70025a56e19aad7ffc2caec307e5f70500e
2017-07-26 19:57:29 +08:00
Maciej Kucia 22f7500025 Removed invalid comments in tox.ini [flake8]
Change-Id: I9b12f6b1ad2612403de7c904a7752ef6960480e2
Signed-off-by: Maciej Kucia <maciej@kucia.net>
2017-05-24 00:44:57 +02:00
Maciej Kucia a14653b255 Stop ignoring H904 hacking rule in tox
This change is one in the series of changes to
align os-brick with Cinder rules.

- H904 'Wrap long lines in parentheses instead of a backslash'

See following for more information:
 https://github.com/openstack-dev/hacking

Change-Id: Ia08ce1b9cdab968c0965bc04aa7d202190cb4bb3
Signed-off-by: Maciej Kucia <maciej@kucia.net>
2017-05-24 00:44:57 +02:00
Maciej Kucia d9ac24d0d2 Stop ignoring H405 hacking rule in tox
This change is one in the series of changes to
align os-brick with Cinder rules.

- H405 'multi line docstring summary not
        separated with an empty line'

See following for more information:
 https://github.com/openstack-dev/hacking

Change-Id: Id67324c0ef22287d91b49ae11eda094bf73739a1
Signed-off-by: Maciej Kucia <maciej@kucia.net>
2017-05-24 00:44:57 +02:00