* Includes some general tools/hacking cleanup
* Fix several N302 cases
* Disable N302 until all cases are fixed
Change-Id: Iddba07ff13e10dc41a6930749044bb8c0572d279
Using the setup.py testr command in run_tests.sh will sync run_tests.sh
up with the way tox currently runs the tests and collects coverage.
Change-Id: I21e3965280b3242a860c6be49c4dca44f197b03a
Nova coverage was broken because additional coverage tests were added
that interfere with collecting coverage during unit testing. These new
tests were not properly excluded by the coverage unit test regex. Modify
the regex to exclude any tests of the form '.*test.*coverage.*'. This
allows `tox -ecover` and `run_tests.sh --coverage` to run properly.
Change-Id: Id35f50ec335707c9eadb0e7fb3aa0833661f7333
* Fixes N403, along with docstring test
* Adds N404, multi line start
* Disable N403 and N404 until all cases are fixed
* Remove obsolote '--repeat' flag from tox.ini
Change-Id: Ibf6371efc1cdc764e66f6f7c5c4362440101f963
pep8 and hacking.py (by inheritance) have the ability to run self
tests via docstrings, if we format the comments correctly, and change
the docstring test regex. Include self testing in our normal pep8
tests.
fix the comments to actually be test case compliant
fix nova_import_alphabetical to pass on short import lists (only 2
lines, starting at the beginning of a file)
comment where it doesn't appear that hacking.py tests are working
(though there could be deeper black magic in some of them).
fix a doc string in pep8 self tests that breaks N301
fix the fact that pep8 error strings are supposed to start with
\w\d\d\d, we were just lucking out on some formatting because the
string NOVA happened to be only 4 chars long.
Add a couple of escapes so that we don't recursively fail on our
own fail self tests for comments. (boy that's fun)
Change-Id: I14d5e04cfc092b37ec4967cd7485e9975a5eb820
We had previously been ignoring all our custom N4xx hacking.py
errors. This fixes all the N401 errors "doc strings
should not start with a space" and reduces the ignore set down
to N402 only "single line docstrings should end with period".
It also fixes the N401 parser to catch only docstrings, and
not tripple quoted string blocks used later on in a function.
Clean up a few of the more crazy uses of """ in our code
Clean up additional funky comments to make indents a bit more
consistent, and pull in lines when possible.
Change-Id: I9040a1d2ca7efda83bd5e425b95d1408b5b63577
Previously the default test behavior was to capture stdout and stderr.
Make the new default to not capture stdout and stderr then set
.testr.conf to always capture these streams when running tests under
testr.
The motiviation behind this change is that you will want these streams
to be captured when running under testr, but when not running under
testr you may not want to capture them. An example of this would be
running `python -m testtools.run test_name` with a change to test_name
to invoke the python debugger (capturing stdout and stderr interferes
with normal debugger functionality).
Also, only invoke the test timeout by default when running under testr.
This is done for the same reason as above. When running a test under the
debugger the timeout interferes with debugging.
Change-Id: I42cbbdadb2f221ec439e92a6800d14e8436bb77b
the way the coverage exclusion was made previously meant that
if you ran coverage, it would always run all the tests. Fix
this so you can run a subset.
Change-Id: I057587204728d379e2a43b5c5ee14fe91f83f64b
Convert nova from using nosetests to testr for its test runner. Some
tests had to be modified to get them to run properly under testr.
run_tests.sh has been updated to run testr instead of nosetests.
Coverage is collected by running subunit.run under coverage.py when the
coverage environment is selected.
Note that you will need to rebuild your virtualenvs as nose is being
removed from the dependency lists and is being replaced by testr. Tests
will run in different processes once this test is merged so you cannot
use test classes to pass information between tests. Each test should be
a proper independent unit. Additionally the -x and -d flags to
run_tests.sh have been removed as there are currently no decent
approximations for those functions.
Change-Id: I019ca098972ca749b195f59968cf21edd5ba9109
When you try to debug some test using nose.tools.set_trace the pdb prompt
is 'trapped' inside tee manipulation of stdout.
Since debug mode is not supposed to be used in the gates we don't need to
concern about the lack of a log to analyze the output.
Change-Id: I7daebe7267b04d41f2ca383f826419f0dfb544ab
During Ubuntu builds we run the run_test.sh script
during the package build process, so that we can catch
regressions in our packaging before uploading to the archive.
However a recent change writes the output of the nosetests
to an error log so we don't see why the package fail to build.
This patch also displays the output of the nosetests so we
can see why the tests fail without having to look at the nosetests.log.
This patch add the '-v', for a verbose display of nosetests.
Change-Id: Id21d53df356de344a8577282c5a82f3ff927bc11
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Apart of making pep8 version standard across all openstack
projects.
With this change we ignore E712 since it is normal to use
"column == True" in sqlalchemy.
Change-Id: I73a162847a79558cb158112878033edf18039805
Signed-off-by: Chuck Short <chuck.short@canonical.com>
Some ways of running run_tests.sh will not output a line for us to
parse the count from. Treat no "Ran X tests" as "Ran 0 tests".
Change-Id: I96ba13e797ceaf9b9fa2b60ccb558510b5e32a88
Right now, run_tests seems to report test success if there is a
catastrophic failure early in the process. This can happen if you
have a python file that fails to parse, or if something else in
the test environment setup fails to initialize (such as creating
the empty database for the test run). Nosetests will report
success, but indicate that zero tests were run.
This patch snatches the output of nosetests and, if zero tests
ran, reports to the user that something is broken and offers a few
suggestions.
Change-Id: Ide6fd8b212f0650cb227f60b25d4b4e62ee150ac
Patch I32a8808c6c9cccfedcc4d2a26649333aca1cd713 changed pep8 to 1.2
but did not update the ignore list in run_tests.sh
Change-Id: I9d2cab79197ba3cdd7103d4532e28a999c9454f4
Our new lockfile code works fine if the locks already exist, but
it is annoying to pollute the source tree with lockfiles in the
tests.
This modifies the lockfile code slightly to use a tempdir if
lock_path is none. Note that a tempdir will not work in production
but it is fine for testing. We set the lock_path to None in the
testing flags.
Also removes the explicit cleanup in run_tests.sh. The new solution
works with tox and will work even if we add new locks.
Fixes bug 1035426
Change-Id: I613926e4288442e79df50ea5f5bd8f9eafdfe7e7
Messages translated into other language like Chinese cause some
unit tests to fail.
Fixes LP bug #1037946.
Change-Id: I01d04333d28bab52d6f424432524b206f3845fba
Remove a number of limitations from the external locks.
- They can be nested now
- They do not need external cleanup in case of failures
- They do not rely on lockfile or greenlet internal implementation
New implementation is based on fcntl locks and any crashing process
will drop the lock. It does not have to rely on any cleanup code or
handling exceptions. Because no cleanup is needed, a number of tests
have been removed.
This implementation is not portable outside of POSIX/BSD/SVR4 systems.
Fcntl locks should work correctly with NFS mounts.
Locks are cleaned up after the tests finish running via run_tests.sh,
even though it's not strictly needed.
This change requires eventlet >= 0.9.17.
bp improve-external-locking
Change-Id: Idf5424c04645f25097733848a007b150145b0b27
find . -executable is not available on Mac OS X. We switch back to
the old -perm syntax to find files to test.
Change-Id: Iea58a249f282c98ae6cffbe8e6359f70f8b1d63f
Shrink tox.ini to the new short version.
Fix the test cases to be able to be run in nosetets plus the
openstack.nose_plugin, which finally removes the need for
nova/testing/runner.py
Also, now we'll just output directly to stdout, which will
make nose collect the trace logging directly and either output
it at the end of the run, or inject it into the xunit output
appropriately.
Change-Id: I1456e18a11a840145492038108bdfe812c8230d1
Ignore nova/openstack/common code when calculating coverage.
We do this because the unit tests for the common code are in a
different repository.
Change-Id: I0103b8acfc4cdaace68a18b1d1723a13595debe2
* cleaner output
* fix bug 980009
* Fix N201
* N306: alphabetical order imports
* N401: docstring start
* N402: one line docstring start
* N403: multi line docstring end
* Until fixed, N40* will be disabled by default
Change-Id: I9addafdaa7a1f8fb950e14a5409f661dec6c7b87
Coverage report generation was not using --include filters.
This resulted in generating a report that included all external
dependencies. Some of these may include problematic characters for
utf8 decoding. In the odd case this was found, coverage would fail
with a UnicodeDecodeError.
Fixes bug #987077.
Change-Id: I276698e65ac1037972209a406058168433cd826b
Fixes bug 977489
--repeat became the default in 0.7; since we're now requiring 1.0 or
above, this can go away.
Change-Id: I85ee8ab274594ce96ece6610247dfd8a6f082af5
* Works around migrate issue 72 [1] by monkey patching migrate prior
to import.
* Removes previous workaround
* Refactor test config to work under nosetests directly
* Fixes LP940407
1: https://code.google.com/p/sqlalchemy-migrate/issues/detail?id=72
Change-Id: I219e4cecf8bb2e34ae238ac270428f496378ee61