60 Commits

Author SHA1 Message Date
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
Mateusz Kowalski
8891018897 Use standard quote character
On some platforms using ’ instead of ' causes problems for
tox to be run. This patch fixes this at the same time not
causing any readability issues.

Change-Id: Icf8e4a9aa42dce64afb0d15ca7ff005478dbbfa7
2017-08-09 15:39:14 +02:00
Julian Edwards
393d686638 Add a debug tox environment
Uses oslo_debug_helper to run up the tests in single-threaded
mode so that pdb works.

Examples:
 # Run all tests.
 tox -e debug
 # Run a specific test or set of tests.
 tox -e debug module.to.my.test

Change-Id: I272f6aa34bafcd7ac2d2828cbd6dd48e0e615b79
2017-03-31 14:33:55 +10:00
John L. Villalovos
e9344077fc flake8: Specify 'ironic_python_agent' as name of app
Specify 'ironic_python_agent' as the name of the application for the
flake8-import-order plugin. That way it knows that imports of
ironic_python_agent should come after external libraries.

Change-Id: Id39d558a51aeb97d96633afea28676634547d0d7
2017-03-16 07:09:07 -07:00
Annie Lezil
a07c855498 Python 3.4 (py34) is removed from tox envlist
Python 3.4 is not a supported python version. So removing it from tox
envlist

Change-Id: If4adb371dc5af023399f806ac6678f114a3f6a2f
Related-Bug:1667312
2017-03-03 18:37:05 +00:00
John L. Villalovos
949f4f509e 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: I946457e9079ce0b54c7fe0ad554d024a1c61dce0
2017-02-16 09:46:21 -08:00
Pavlo Shchelokovskyy
762f3bf4e6 Use oslo-config-generator for sample config
The old generate_sample.sh is broken already as it refers to
non-existing openstack/common path.

Let's use oslo-config-generator as many other OpenStack projects do.

Also, where applicable, option descriptions are updated with the
corresponding kernel parameters to set those options durig pxe boot.

Change-Id: Id4a0df30ea573d52f3b359f357fe8f4a29751939
2016-12-09 21:01:02 +02:00
OpenStack Proposal Bot
c40575e4e0 Add bash scripts style checking for IPA
Updated file tox.ini allows to check code style in all ".sh" files
included in Ironic Python Agent. Checking can be invoked by calling either
"tox" or "tox -e pep8".

Change-Id: Ie76605737c7db10a064f2aebfda388372a4c0591
Closes-Bug: #1625215
2016-11-09 14:14:40 -08:00
John L. Villalovos
0b8763e332 Update to hacking 0.12.0 and use new checks
Use hacking 0.12.0

Use the new checks that are available:
    [H106] Don’t put vim configuration in source files.
    [H203] Use assertIs(Not)None to check for None.
    [H904] Delay string interpolations at logging calls.

Fix code so tests pass.

Change-Id: If22ad272c332f30624ce10861408d377908b152b
Depends-On: I2aa44b62f900d4dfd67701b01eadd0523fbfaf07
2016-11-08 11:31:18 -08:00
linbing
156ddaa966 Force en_US language for tests
This patch forces the use of the en_US locale for tests run.
This is done to avoid tests failing due to message translation.
For example:

When asserting if the message of an exception is correct, those are
usually hardcoded in the tests.

Change-Id: Ia8068b454f1461f17994733afc57337f4b017460
2016-10-07 13:50:43 +00:00
John L. Villalovos
f6acb7cc03 Add py35 to tox environments
Since we're running python 3.5 tests now, we should also be
running them when running all tests with just `tox`.

Change-Id: I3f57abcbeaa3550f49d56f08140a34d6989885c9
2016-09-22 11:17:41 -07:00
Jim Rollenhagen
8de195a3d5 Use upper-constraints for all tox targets
The issue has been resolved by infra [0], so we can use upper
constraints for all targets.

[0]
http://lists.openstack.org/pipermail/openstack-dev/2016-August/101474.html

Change-Id: If075c2752fa77547e23e3dda4688386185f79dca
2016-08-19 08:50:20 -04:00
Moshe Levi
992b875dc8 tox: Update flake8 to ignore tinyipa imagebuild folders
This prevents the pep8 to check python files that are
in the tinyipa tinyipabuild and tinyipafinal folders

Change-Id: Ieea899d618d5225403ceafae60359d5cb4d9c6c5
2016-06-22 15:31:13 +00:00
Jim Rollenhagen
4e35b0ee64 Use constraints for all the things
This configures tox to use upper-constraints for everything, except
environments used for post jobs (as constraints aren't supported there
yet).

This also doesn't enable constraints for our image builds, as it isn't
possible to pass an environment variable into the Dockerfile to allow
folks to choose their own constraints file (and we don't want to force
people to rely on git.o.o for building images).

Change-Id: I285855c6386f59e9dd352473aa28463109818c90
2016-05-19 10:08:56 -04:00
Jenkins
291515b14b Merge "Switch tox unit test command to use ostestr" 2016-04-10 20:56:23 +00:00
Jay Faulkner
63d4323435 Fix coverage for IPA
ironic-python-agent coverage was broken, tox -ecover printed error
messages. This change fixes the coverage command to work reliably, and
adds the directory generated by the job to gitignore.

Change-Id: I36656c17c13b5b4bce8e7eca2ec0f12c1bf76f29
2016-04-08 22:32:02 +00:00
John L. Villalovos
5fd716412e Switch tox unit test command to use ostestr
This commit switches the tox command to use ostestr instead of calling
testr through setup.py. The primary advantage here is that it uses the
subunit-trace output filter. ostestr primarily exists as a replacement
for pretty_tox.sh bash scripts which spread like a plague through
OpenStack projects after Nova copied it from Tempest. (although ostestr
also provides some other useful features) Granted ironic wasn't using
that, but this commit makes the switch to enable getting the
subunit-trace output which is generally useful.

Note that this dramatically increases output while running tests.
However, test failures are still at the bottom of the output, so it
shouldn't cause much pain, if any.

Also remove requirements.txt from tox.ini deps

This is redundant, per lifeless email:
http://lists.openstack.org/pipermail/openstack-dev/2015-July/069663.html

Change-Id: Ia9e3000ddfe02979c26807ae5d130bfd2730c5e1
2016-04-08 15:13:18 -07:00
Jim Rollenhagen
e8488c2534 Add reno for release notes management
Change-Id: Id6bfe132dcc8fc3efbe0d96820eebf7d174b2736
2015-12-16 16:04:29 -08:00
Ondřej Nový
6dc7f34e36 Deprecated tox -downloadcache option removed
Caching is enabled by default from pip version 6.0

More info:
https://testrun.org/tox/latest/config.html#confval-downloadcache=path
https://pip.pypa.io/en/stable/reference/pip_install/#caching

Change-Id: I64c83c96db5c00b04acca9a7538ab83b96fb5f9b
2015-12-11 21:18:09 +01:00
Mario Villaplana
4a7b954d14 Adds more functional tests for commands
This adds additional functional tests for the commands API.
It also restructures the current functional test to run in
sequence as a monolithic test to preserve IPA state and test
order between test runs. The time to wait for IPA to start
was increased due to an intermittent race condition that
occurs with the larger test suite.

Partial-Bug: 1492036
Change-Id: Iff9b41fb531d34225d702b9bfd39826e3c7195ad
2015-10-06 15:36:27 +00:00
John L. Villalovos
dcbba2b121 Enforce all flake8 rules except E129
Bring ironic-python-agent in line with the other ironic projects.

Stop ignoring all E12* errors except E129
Stop ignoring E711

Change-Id: Icb9bc198473d1b5e807c20869eb2af7f4d7ac360
2015-10-02 10:01:00 -07:00
Ruby Loo
e74cd66a4b Use doc8 style checker
This uses the doc8 style checker to check that document files
conform to certain requirements, as documented at
https://pypi.python.org/pypi/doc8.

The README was modified because it had several lines that were
were longer than 79 characters, and some links were fixed.

Change-Id: Ia21b680ec227357ada58326fea104696561475d5
2015-10-01 14:20:58 +00:00
Josh Gachnang
508b7b67e2 Split functional and py27 tests
Moved tests/extensions to tests/unit/extensions, otherwise they
wouldn't have run. Renamed the files in tests/unit/extensions to be
prefixed with 'test_', to match the rest of the test files. Did a
general clean up of tox.ini so we have standard whitespace.

Change-Id: I5615bfbf2d6ff4a4bc3e66e71c2472b0d1e3a2d7
2015-08-28 14:16:34 -07:00
John L. Villalovos
f675fd41b5 Have tox run py34 as first test
Hopefully this will minimize errors we see with py34 test failing after
a py27 run.

Change-Id: I0147d6a8af37094280da17d53d0b55d1ee18ad2b
2015-08-28 11:26:37 -07:00
Dmitry Tantsur
ac1dade417 Bump wait timeout in functional tests to 5 seconds
2 seconds is not enough for me locally.

Change-Id: Idad5b0d51b889968fc8769f309b46d5c97fc87b9
2015-08-19 19:17:51 +02:00
Josh Gachnang
fb2790774d Add base for IPA functional tests
Starts up an agent in a thread and then runs functional tests against
it.

Add the first functional test of the API: a simple test of the
commands API.

Co-Authored-By: Mario Villaplana <mario.villaplana@gmail.com>
Change-Id: If4ad611929d388a2a9454224646cb296bd0ba0ce
2015-08-18 16:19:47 +00:00
Tom Cocozzello
2ddb46e608 Activate pep8 check that _ is imported
Remove the specification in tox.ini that _ is a builtin so that
it will no longer assume that _ does not need to be imported.
This helps ensure that the _ from i18n is used.

Activating this check did not flag any violations.

Change-Id: Id555b593cff19d7c741b4233182837def685317a
2015-08-04 14:19:08 -05:00
Lucas Alvares Gomes
06eed473fb Add Python3 support
This patch add Python 3 support for IPA. We still need to enable it on
gate to avoid code breaking the support from sneaking in.

Partial-Bug: #1474896
Depends-On: I5a774eaa8d978f4d50faca4dc1b03a87fb194ce2
Change-Id: If47c0797b63d2914b3c47aba62ec5201301b6c33
2015-07-15 17:12:08 +01:00
Andreas Jaeger
141191bcfa Rename gendocs tox environment
All other openstack projects use docs environment, use the same
name for ironic-python-agent as well.

Change-Id: I3315e111bd5994d2af2a7a2d0079a09e3d4e4d8b
2015-05-20 16:37:56 +02:00
Jay Faulkner
67a48c8cb1 Add PYTHONHASHSEED=0 to venv tox env
This is the environment used to generate docs in the check/gate, not
gendocs.

Change-Id: Ia026425f1a56d59c8d87a3ad44610c26fc286fad
2015-04-06 08:35:08 -07:00
Jay Faulkner
be97525975 Add sphinx build + basic documentation
This adds and configures a sphinx doc builder. This is based on the code
in Ironic to build documentation.

The goal is for this to contain development documentation relevant to
hacking on the agent, including how to make custom HardwareManagers.

Change-Id: Ib6cecb9959f4ad5c71440fb37827b996582a9545
2015-03-31 16:22:12 -07:00
Jay Faulkner
d95a99d5d1 Remove python 2.6 from tox.ini
Ironic doesn't support python 2.6, we don't need to either.

Change-Id: I136ac50840d4bf855e1e7d8dac923b3243962cc0
2015-01-07 15:33:51 -08:00
Vladyslav Drok
a8db7b0443 Cleanup coreos-oem-inject.py
The current script used to inject the IPA container into CoreOS is
not pep8 compliant, has requirements that are not in
global-requirements, and never has tests run. Now requirement on
plumbum is removed, script is pep8 compliant, flake8 runs against the
script when tests are run.

Closes-bug: #1337551

Change-Id: I14d3e46e60c4e072f34f80dc50d7214079953f49
2014-11-18 14:52:32 -08:00
Josh Gachnang
0835d1648b Remove PyPy from default tox runlist
PyPy has been failing locally for a month or two. On Ubuntu 14.04: 
"No module named _bsddb", on 12.04: "Not a .py file: 
/data/dev/work/ironic-python-agent/.tox/pypy/build/setuptools/
setuptools/cli-32.exe"

PyPy isn't enabled as a job in the gate yet (even non-voting). Until 
we sort the gate out and fix the above errors, we should remove it 
from the default tox runlist.

Change-Id: I34c0a72edebc296b79c6058e64ffb98f60979bcb
2014-09-12 20:39:29 +00:00
Alex Gaynor
a3cab12393 Added PyPy env to tox.ini
Also fixes tests that were broken on PyPy.

Co-Authored-By: Jim Rollenhagen <jim@jimrollenhagen.com>
Change-Id: I2554aa844b040c4c74cbf287dccb06d816a39dbe
2014-03-28 08:26:17 -07:00