66 Commits

Author SHA1 Message Date
John L. Villalovos
3f6e443232 Add constraint target to tox.ini
This adds a pip install command to tox.ini that is only used when the
tox env is passed with the 'constraints' factor appended onto it.
As such this will not effect developer workflows or current unit tests.

The initial use of this will be in a non-voting job, to verify that the
constrained checks with tox are stable.  DevStack is already running
constrained jobs, as such problems are not expected.

To run a tox with pip using constraints on a developer system a
developer should run the desired tox environment with -constraints.
For example: $(tox -epy27-constraints)
Pip will pull the current version of the upper-constraints.txt file down
from the git.openstack.org, however this method can be overriden to use
a local file setting the environment variable "UPPER_CONSTRAINTS_FILE"
to the local path or a different URL, it is passed directly to pip.

This is currently not enabled in the default tox run, however it is
possible to enable it as a default by adding it to 'envlist' in tox.ini

Backport of Nova commit ad38ce1fc98692ee59ef061de1a35f355d219aa1

Change-Id: Ia3cfb30fd1d8529bb4fbcf8873036149ea6f483c
Implements Blueprint: Requirements-Management
2015-09-17 11:42:58 -07:00
Thiago Paiva
bcdacbaf9a 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: Ib09cbc71149ffcc1f36495faf1c6586c4e0a0a86
Closes-bug: #1489059
2015-08-26 12:58:56 -03:00
Lucas Alvares Gomes
7f1aebfc2b Enforce flake8 E711
This patch enforces the rules E711 in the Ironic code base.

Change-Id: Ic9395f5f6869212e4076a045ced83b57d0c16324
2015-08-13 16:36:15 +01:00
Jim Rollenhagen
6f8ad61cbd 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: Ie78d0e5b2fc8274867f2c6013b04ae9e0796f81f
2015-07-15 18:31:29 -07:00
Yuriy Zveryanskyy
8e0838536f Remove db connection string env variable from tox.ini
It is not needed with oslo.db 1.12.0.

Change-Id: I49dc450d6bb84e5a75ef9ecdf248eac567c3442c
2015-07-02 14:37:10 +03:00
Jeremy Stanley
25f2c5e079 Switch from MySQL-python to PyMySQL
As discussed in the Liberty Design Summit "Moving apps to Python 3"
cross-project workshop, the way forward in the near future is to
switch to the pure-python PyMySQL library as a default.

https://etherpad.openstack.org/p/liberty-cross-project-python3

Also set the OS_TEST_DBAPI_ADMIN_CONNECTION override variable so
that oslo.db opportunistic detection will know to use PyMySQL until
I12b32dc097a121bd43991bc38dd4d289b65e86c1 makes it the default
behavior.

Change-Id: Icd91a065d3c4f62791ba0dca99a822e3a1a0ad44
Co-Authored-By: Victor Sergeyev <vsergeyev@mirantis.com>
2015-06-22 15:51:10 +03:00
Jenkins
b6e447a1aa Merge "Enable flake8 checking of ironic/nova/*" 2015-06-18 18:19:47 +00:00
Yuiko Takada
c924c3f1a4 Pass environment variables of proxy to tox
When a development environment is under a proxy, tox is failed even if
environment variables of the proxy are set.

This patch fix this problem.

Change-Id: I650019ae86e223d5e9c2d4a5b51b92377f3c471e
2015-06-15 10:00:23 +09:00
John L. Villalovos
9508d86dd0 Enable flake8 checking of ironic/nova/*
The directory ironic/nova/* was being excluded from the flake8 check.

Make some minor whitespace and comment changes to
ironic/nova/compute/manager.py to make it pass the flake8 checks.

Change-Id: I5a76550db3b28a87964d1505441246cdb0354ee7
2015-06-12 11:48:20 -07:00
Jenkins
309707bab0 Merge "Enforce flake8 E123/6/7/8 in ironic" 2015-06-04 13:49:28 +00:00
Sam Betts
8c07c4fda3 Enforce flake8 E123/6/7/8 in ironic
This patch enforces the rules E123, E126, E127, and E128 in the ironic
code base:

E123 - closing bracket does not match indentation of opening
bracket’s line
E126 - continuation line over-indented for hanging indent
E127 - continuation line over-indented for visual indent
E128 - continuation line under-indented for visual indent

This fixes any parts of the current code which fails these rules and
removes these rules from the tox.ini flake8 ignore list.

Change-Id: Ia96582b5e9abc088d6c1694afc93c59be4a4065c
Closes-Bug: 1421522
2015-06-04 12:56:51 +01:00
Joshua Harlow
3681315012 Use svg as it looks better/scales better than png
Change-Id: I2a17b5ddbe90fe8ea1ead53497e4dfcac5bf5647
2015-06-03 16:56:45 -07:00
John L. Villalovos
1acab160cc Revert "Add simplegeneric to py34 requirements"
This reverts commit fe2f445418ad7cb7741a7d237fd2ad69c27833a4.

WSME has been updated to 0.7 which fixes the underlying issue with
'simplegeneric' not being pulled in as a dependency.

Change-Id: Ia224eafb2c2220c970367580a8818746f9479f9d
Depends-On: I28861178fac89e6f3fabd34b048f53b6506eda5e
2015-06-02 15:01:01 +00:00
Andreas Jaeger
6befe83d87 Rename gendocs tox environment
All other openstack projects use docs environment, use the same
name for ironic as well.

Change-Id: I46fd50da89c3247bffefc9c971f8eda309bbe9bd
2015-05-21 08:06:06 +02:00
Victor Sergeyev
fe2f445418 Add simplegeneric to py34 requirements
simplegeneric suppoosed to be installed by WSME, but for a some reasons
it was missed in py3 env. We can't add this library to requirements.txt,
because it missed in global requirements, so I've added simplegeneric
to the `deps` section in py34 environment.

This if a fast-and-dirty way to unblock python34 gates for ironic.

Change-Id: Ib0cddf7541defbdfe1b17448b52becf8bd4ef3de
2015-05-20 16:42:34 +03:00
Victor Sergeyev
70062322a2 Run tests in py34 environment
A lot of fixes to be compatible with python 3:
- fix encoding/decoding errors
- fix issues with comparison
- use `reload`, `reraise`, ext. modules from six
- use items() instead of iteritems()
- add a new file with py3 specific test requirements
- drop passing the arbitrary arguments to object.__new__ method.
  See bug [1] for more details.
- add a workaround to bug in `mock` library
- add py33 and py34 test environment to tox.ini

[1] http://bugs.python.org/issue1683368

Change-Id: I90936cb6b6eaaf4b5e1ce67732caec3c8bdc1cc2
2015-05-06 11:51:44 +03:00
Joshua Harlow
4c7a7bdf64 Add a venv that can generate/write/update the states diagram
Instead of requiring manual understanding of how to generate
the states diagram, add an explicit virtualenv that can be
used to create and generate that docs diagram (and replace the
existing file with it).

Change-Id: I1738da9bf08bfda9b9be01489e8456569a31709e
2015-04-27 11:07:01 -07:00
Jay Faulkner
021462beed Set hash seed to 0 in gendocs environment
This was done in the venv environment to fix docs builds in the gate,
but they still fail randonly locally when using the tox environment to
build them. This change ensures the gendocs environment works for
generating documentation locally.

Change-Id: I41e4af9edaaa76b837a6c92a296b5738c85b632b
2015-04-07 13:32:53 -07:00
John L. Villalovos
826cd21a7d Remove setting language to en_US for 'venv'
Remove setting LANGUAGE=en_US for 'venv' virtualenv.

Since the 'venv' environment is not used for unittests and users may
want to see messages in their native language in the 'venv' virtualenv.

Also makes it consistent with python-ironicclient

Change-Id: I1902d162cc7a5a1c8ee2e6a7412096d645277cc0
2015-04-01 13:35:35 -07:00
John L. Villalovos
bf6d966756 Force LANGUAGE=en_US in test runs
Basically back-porting what was done for Nova in this patch:
https://review.openstack.org/#/c/160892/

If your native locale is not en_US and you run tests, some could fail
due to the message translation that happens since the assertion messages
are in en_US (not translated, just hard-coded in the tests).

Note that setting LANG=en_US had no effect.

Change-Id: I16fab554612a718871625f688dd5501a69fb3417
2015-03-13 08:42:51 -07:00
John L. Villalovos
45b525d341 Fix PEP8 E124 & E125 errors
Fix PEP8 E124 & E125 errors
    E124: closing bracket does not match visual indentation
    E125: continuation line with same indent as next logical line

Remove E124 & E125 from the ignore list for flake8

Change-Id: Ia9aee2fb7e0bb6771aad11d3523119944eeb4170
2015-02-20 12:24:28 -08:00
John L. Villalovos
c1c4c5a41b Fix PEP8 E121 & E122 errors
Fix PEP8 E121 & E122 errors
 E121: continuation line under-indented for hanging indent
 E122: continuation line missing indentation or outdented

Remove E121 & E122 from the ignore list for flake8

Change-Id: If63dd80ee85fc97596492e0b2cb6db9e10458c54
2015-02-19 08:29:35 -08:00
John L. Villalovos
bb6a0b29c9 For flake8 check, make the 'E12' ignore be more granular
ignore = E12 means ignore E12* errors.

Make it more granular by converting to E121,E122,...,E129

This will make it easier in the future to remove a single ignore and
update the code to resolve the issues.

Change-Id: Iddff6a826bc7c9ff07643b7408c51f1bd129530c
2015-02-18 14:39:30 -08:00
Naohiro Tamura
6e612260b7 dev-quickstart.rst update to add required packages
* added unspecifed required package "python-tox" for Ubuntu/Debian,
  and removed "py26" from "tox.ini" so that "tox" command doesn't
  invoke the tests in Python 2.6 environment.

Change-Id: I57df22a54fc08f2bb53a17d13b70706952815871
Closes-Bug: #1392304
2014-11-17 10:51:13 +09:00
Lucas Alvares Gomes
f8e4eab684 Add gendocs tox job for generating the documentation
We already use tox to generate the sample configuration, run the tests,
etc.. This patch is adding a new 'gendocs' tox job for generating the
documentation. I always have a hard time remembering the syntax to
generate the docs, by adding it to tox I hope it may facilitate it a bit.

You can now (re)generate the docs with this tox job:

tox -egendocs

The quick start guide was also updated with the new command.

Change-Id: I6a755c31382310420d706e51a3e014941fd49872
2014-11-14 17:19:17 +00:00
jiangfei
63ab84ccac Enable hacking rule E265
E265 is block comment should start with '# '

Closes-Bug: #1391787

Change-Id: I8f0e142bd14fd201da3b8c39501f9d858a5b051b
2014-11-13 10:48:34 +08:00
Michael Davies
3fba6a9468 Put a cap on our cyclomatic complexity
Flake8 has support for McCabe cyclomatic complexity.  Ironic's
most complex code is at 16 right now, so cap this at 17 to make
sure we don't start writing more complex code than what we already
have today.

Nova is doing similar: https://review.openstack.org/#/c/129125

Change-Id: I99fa26f763ab456d3428951d6a729098a73cf9ef
2014-10-16 22:37:18 -07:00
David Shrewsbury
3e26f519f6 Fix E131 PEP8 errors
Fixes files with the following error:

    E131 continuation line unaligned for hanging indent

and enables the check in tox.ini.

Also enables the E113 check (unexpected indentation) since it seems
that was fixed coincidentally with other previous changes.

Change-Id: I9270e5df257e12dc903689d8eb6fb03be01c034b
2014-10-14 14:36:26 -04:00
David Shrewsbury
26df76b77a Enable E111 PEP8 check
Fixes files with the PEP8 error:

  E111 indentation is not a multiple of four

and enables the check in tox.ini.

Change-Id: I9e4e8d6b59d018367febd9362cbc9bc3e79ebd53
2014-10-13 16:07:40 -04:00
David Shrewsbury
46deca788b Fix F812 PEP8 error
One file was redefining a variable, thus exposing this PEP8 error:

    F812 list comprehension redefines 'n' from line 1868

This fixes it and enables the check in tox.ini.

Change-Id: Ifa9a2365160db1b8ec80b274f3458cea6bd1f653
2014-10-13 10:31:16 -04:00
David Shrewsbury
cfcc3ec733 Enable H305 PEP8 check
Fixes files with the PEP8 error:

    H305  imports not grouped correctly

and enables the check in tox.ini.

Import order is: stdlib, 3rd-party, project imports

Change-Id: I81fc67bc9f79c514b6f4941a13e44c95badd34e2
2014-10-13 10:23:15 -04:00
David Shrewsbury
8858c610a9 Enable H307 PEP8 check
Fixes files with the PEP8 error:

    H307  like imports should be grouped together

and enables the check in tox.ini.

For the modified files, made sure the import order matches the
template as described in:

http://docs.openstack.org/developer/hacking/#import-order-template

This order is currently: stdlib, 3rd-party, and project imports.

Change-Id: I4538356c207535b778da1273aadcf3b4a7b20383
2014-10-13 10:09:53 -04:00
David Shrewsbury
f3ef289360 Enable H405 PEP8 check
Fixes files with the PEP8 error:

    H405  multi line docstring summary not separated with an empty line

and enables the PEP8 check in tox.ini.

Change-Id: I632c89e2a1783be8305a8a8cea7ae9d3bb55b62c
2014-10-10 16:18:14 -04:00
David Shrewsbury
bfec3234c3 Enable H702 PEP8 check
Fixes files with the PEP8 error:

    H702  Argument to _, _LI, _LW, _LC, or _LE must be just a string

and enables the PEP8 check in tox.ini.

Change-Id: I6ca187535981d9809ca221e90de38988601f96e0
2014-10-10 14:11:37 -04:00
David Shrewsbury
beda2675e1 Enable H904 PEP8 check
Fixes all files with the PEP8 error:

   H904  Wrap long lines in parentheses instead of a backslash

and enables the PEP8 check in tox.ini.

Change-Id: Ie3314487a45d34f59304a5b24eef9488ca3ce35e
2014-10-10 13:57:28 -04:00
Yuriy Zveryanskyy
9c725602c4 Fix pep8 test
For hacking 0.9 "ignore" and "select" options are mutually exclusive,
therefore pep8 test always passed. This patch fix this bug and also
fix long line in keystone module.

Closes-Bug: #1379470
Change-Id: Ie8681caa9891bc4f4e257a8e56dc4a30c6f26723
2014-10-09 21:37:02 +03:00
Devananda van der Veen
56245fcda0 Stop running check_uptodate in the pep8 testenv
As per this discussion on the mailing list:
  http://lists.openstack.org/pipermail/openstack-dev/2014-September/047160.html

We are going to stop enforcing the correctness of the sample config
file, and move to a separate non-voting check test that notifies us when
it is no longer accurate, thus prompting a human to correct it.

This addresses the issue where config options in dependent libraries
(eg. keystone) repeatedly break our gate, without removing the sample
config file that deployers benefit from.

Change-Id: Ief88a693e4967b32f5f2f71b9a683599527a5129
2014-09-29 16:28:09 -07:00
Lucas Alvares Gomes
3aac5a1992 Don't write python bytecode while testing
This patch was based on the Nova patch:
https://review.openstack.org/#/c/121044

This should reduce the number of times you need to completely delete
your tox dir because you have stale pyc files around.

In Ironic we have hit this problem a number of times, migrating to
oslo.message was a big one that caused a lot of confusion.

Closes-Bug: #1368661
Change-Id: I7dda3ad879beff1e494a36144c941a847177c2ef
2014-09-12 12:09:04 +01:00
Ruby Loo
526bb53528 Remove bypassing of H302 for gettextutils markers
When we used the i18n markers (_, _LE, _LW, etc) from
ironic.openstack.common.gettextutils, we bypassed H302
hacking rule for them (via tox.ini file). Now that we've
converted to using the markers from oslo.i18n and are no
longer using the markers from gettextutils, we can remove
the bypass stuff.

Change-Id: I26147b69884cd9c075e1cfe38a92e38e861083e7
Closes-Bug: #1368425
2014-09-11 21:04:47 +00:00
Michael Davies
93edd4f380 Deprecate Ironic compute driver and sched manager
Updates the Ironic compute driver and scheduler manager so that they
subclass the now in-Nova-tree driver classes. This should de-duplicate
code maintenance across Nova and Ironic and also provide end users
an easier upgrade path (with Deprecation log messages).

This patch also removes the old Ironic compute driver tests and classes
since those now live in Nova.

This patch also removes a line from tox.ini which was copying the second
set of unit test outputs; those no longer exist, since we are no longer
running unit tests on nova code in this tree.

Co-Authored-By: Dan Prince <dprince@redhat.com>
Co-Authored-By: Devananda van der Veen <devananda.vdv@gmail.com>

Change-Id: Ic194f779eca470e4a4dd8a3fbd31ca5a6f6b4f7e
2014-09-09 15:35:43 -07:00
Vladyslav Drok
f80e85ef6d Translator functions cleanup part 1
This part fixes ironic/common folder and tox.ini file.

Some modules use _ function for log translation, even when the
translated string is passed to e.g. LOG.warn function. This patch
fixes it, using translator functions appropriate for corresponding
log levels. Translator functions, imported from
ironic.openstack.common.gettextutils are now imported from
ironic.common.i18n. Translator functions are imported the same way
across all modules. All places that are changed conform to
http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Partial-bug: #1364813

Change-Id: I195d0e256c5412d6d75d2e6c35b19b44f2a0b09f
2014-09-05 14:09:30 +03:00
Vladyslav Drok
39a5a507bf Remove gettextutils _ injection
Now that ironic supports oslo.i18n, using the install function to
inject _ into the builtin has been deprecated. New i18n common module
used instead. In one module _ was imported from gettextutils, now
also changed to i18n import.

Closes-bug: #1346406
Change-Id: I672a975d479991982c24031e834a26e2c2811890
2014-08-29 15:36:28 -07:00
Adam Gandelman
2abea080f6 Set PYTHONHASHSEED for venv tox environment
We're seeing frequent failures of the docs Jenkins job that appear
to be caused by the tox 1.7.2 upgrade and the migration to using
PYTHONHASHSEED=random.  This overrides the environment in the venv
testenv to set PYTHONHASHSEED=0 and allows docs to build
successfully.  Note that we want to run our tests with a random seed
if possible, so this avoids disabling it for the base testenv and
only uses non-random for the testenv used by Jenkins for doc builds.

Change-Id: I665703c9a002500bc90b90cd268bd3ccff4e3534
Closes-bug: 1361295
2014-08-25 12:48:10 -07:00
Ghe Rivero
61533bbe24 oslo.i18n migration
Switch ironic to use oslo.i18n. A new i18n module has been
added under ironic with translation globals and imports the
necessary functions from oslo.i18n.

gettextutils module is still needed in the nova ironic driver.

Change-Id: I682228e158132c628166e4d1e334c4003249d112
2014-07-16 21:53:05 +00:00
Ellen Hui
5841a6466b Add gettextutils._L* to import_exceptions
Using the new logging translation markers (_LI(), _LW(), _LE(),
_LC())[1] is problematic because they are not modules. Since the
Openstack guidelines only allow modules to be imported[2], the entire
gettextutils module must imported in order to use the translation
markers.

This patch adds all four markers to import_exceptions in tox.ini, so
they can be imported individually without failing the pep8 tests.  This
is already done with the _() marker.  With this change, it will be
allowable to import marker functions like so:

from ironic.openstack.common.gettextutils import _LI
from ironic.openstack.common.gettextutils import _LW
from ironic.openstack.common.gettextutils import _LE
from ironic.openstack.common.gettextutils import _LC

[1]http://docs.openstack.org/developer/oslo.i18n/guidelines.html
[2]http://docs.openstack.org/developer/hacking/#imports

Change-Id: I78192dd7525624174deb8d377996ed3d61b36a8a
2014-07-03 22:59:05 +00:00
Mathieu Gagné
0076328a44 Add genconfig tox job for sample config file generation
If someone tries to run generate_sample.sh outside a venv
or without installing project dependencies, you could encounter
error messages related to missing or outdated dependencies.

This change wraps generate_sample.sh execution in tox. Wrapping it
in a tox job makes sure all dependencies found in requirements.txt and
test-requirements.txt are properly installed prior to its execution.

This change does not propose the removal of the sample config file
already in place in the repository and it does not propose adding
it to the list of jobs automatically ran by tox.

This change is merely the introduction of a more convenient way
to execute generate_sample.sh in a proper venv.

You can now (re)generate the sample config file with this tox job:

  tox -egenconfig

Change-Id: I1058a306a462ba8349a4433c78070fabd6d03e39
2014-06-23 15:33:55 -04:00
Christian Berendt
164f963676 Test for membership should be 'not in'
Enabled check for PEP8 issue E713.

Change-Id: Id41f5f19796a7af8cf4cb52dd7afc2e6ec1ccbc4
2014-06-16 13:19:11 +02:00
Jenkins
322d3b42d2 Merge "Update tox.ini to also run nova tests" 2014-04-07 19:55:46 +00:00
Adam Gandelman
a61985324a Update tox.ini to also run nova tests
This updates testr.conf to allow passing of the tests directory as an
environment variable (defaulting to ironic/tests/). Also updates tox.ini
to run testr once for ironic/tests and once for ironic/nova/tests/, then
combine subunit output.

test-requirements.txt is updated to pull in Nova from a tarball, as well
as mox and python-ironicclient.

Updates the existing Nova driver unit tests to account for recent
refactoring and changes in the Nova virt API.

Change-Id: Ibefa2e0d3f97512f4da9ace780703fe47467232e
Closes-bug: #1299312
2014-04-04 14:36:02 -07:00
Andreas Jaeger
ae41d9e367 Use xargs -0 instead of --null
This gives compatibility with OS X in the test.

Change-Id: I483b4279d0d6a5a6fe4f81b9fb07a838e17e1b0f
2014-04-03 20:25:43 +02:00