71 Commits

Author SHA1 Message Date
Jenkins
6f599a2735 Merge "Add unit test for colorizer" 2016-01-28 10:58:40 +00:00
Masayuki Igawa
87ec944a0c Updated from global requirements
This commit updates *requirements.txt that comes from global
requirements.

Change-Id: I19df7b5d7ce54d5a793018e8158d985775fb7007
2016-01-26 14:25:59 +09:00
Masayuki Igawa
8f71069bc8 Add unit test for colorizer
This commit adds unit-test cases for colorizer module.

Change-Id: I329a808bbed3240e6fa41ac21d3e5558a0704d6a
2016-01-12 13:58:24 +09:00
Jenkins
2366c8c170 Merge "Add subunit_trace --color option's doc" 2016-01-07 01:20:33 +00:00
Jenkins
29c64b1287 Merge "Support comments in whitelist files" 0.6.0 2016-01-05 17:24:51 +00:00
Davanum Srinivas
b46734734b Support comments in whitelist files
We already support comments in blacklist files. we should
do the same for whitelist files as well.

Change-Id: I5ad0c113cdb04dd1bdaa4d8bfdd1a3ab169fb0af
2016-01-05 11:45:02 -05:00
Matthew Treinish
cc64a3a585
Add tool to create a subunit stream
This commit adds a generate_subunit.py script which is used to
generate a subunit stream with a single result for a period of time.
It takes 2 mandatory args and 2 optional to specify the start time,
stop time, and optionally the status (it defaults to success) and an
id for test (if one isn't provided 'devstack' is used) The resulting
stream is written to STDOUT. There is some overlap with subunit-output
from tool from python-subunit, but this is a much smaller scope to just
just do a test_id, status, and timestamps. subunit-output doesn't support
timestamps. Eventually it'll be good to add the missing pieces to
subunit-output at which point we can likely deprecate and remove this.

The intent here is to leverage this to inject 'test results' into the
subunit2sql db to reflect failures that occur before tempest (or any
other test suite) is run. This is necessary for the openstack-health
dashboard. (otherwise it makes our failure rate look much better than
it is) This is only needed until we get a zuul mysql reporter in place
which can give us the higher level run information.

Change-Id: Icc7df33e4d73ba6322af38fbdf3aea230f2fcf4d
2016-01-04 17:30:47 -05:00
Jenkins
befba5c111 Merge "Add support to ostestr to use subunit-trace color" 0.5.0 2015-12-17 18:33:46 +00:00
Jenkins
a316fa98f8 Merge "Fail if no tests were successfully executed" 2015-12-17 18:33:40 +00:00
Jenkins
6c07c1c0c9 Merge "Fix documentation typos" 2015-12-12 23:46:07 +00:00
Matthew Treinish
2cb71893d1
Add support to ostestr to use subunit-trace color
This commit adds a new flag to the ostestr cli, --color, which
is a passthrough option to subunit-trace to enabled colorized
output.

Change-Id: Ic38e008982d8f5bca78c52f51c69b5333744ecbc
2015-12-10 18:15:37 -05:00
Masayuki Igawa
67079cd97e Add subunit_trace --color option's doc
This commit adds a document for the subunit_trace --color option.

Change-Id: I0278a20ead837d20161e4410abec0c711cc402cd
2015-12-05 23:04:49 +09:00
Masayuki Igawa
33119634b5 Fix documentation typos
This commit fixes some typos in the documentation.

Change-Id: I34ef7f863763bed2fb30421627968607bd787500
2015-12-05 22:55:06 +09:00
Masayuki Igawa
2fb3b5ecff Fix coverage section in tox.ini
This commit fixes the coverage section in tox.ini to get coverage and
also changes .gitignore to ignore the cover directory and .coverage
directories.

Change-Id: Ia58b5d109ad045833d6c37e16fd0fe3705212ed0
2015-12-04 18:26:12 +09:00
Jenkins
996fd548ff Merge "Change to always parsing classes from test_id" 2015-12-01 17:37:22 +00:00
Jenkins
39d0c08dc9 Merge "Add delete *.pyc command before executing ostestr" 2015-12-01 17:35:59 +00:00
Masayuki Igawa
c797436528 Add delete *.pyc command before executing ostestr
This commit adds a command for deleting *.pyc before executing ostestr
with tox. This patch would help that removing unnecessary *.pyc files
when we rename, move or remove *.py ones.

Change-Id: Ifa0eb18a10c7e7ee7e15ce7cc69a1b007a016a76
2015-12-01 17:24:59 +09:00
step6829
2b5c0175fc Change to always parsing classes from test_id
Currently only v1 correctly parses out the class information from the test_id.
This changes the default behavior to always parse the class and module from test_id.

Closes-Bug: #1517229

Change-Id: I6340797064f9289a7e861f853c42a763c5f5e2c2
2015-11-30 18:43:53 +00:00
Masayuki Igawa
1a3d0d9ec0 Add colored output feature to subunit-trace
This commit enables that subunit-trace shows colored output. Because
there are some people who like colored output. While this doesn't work
for the OpenStack gate for local testing it would be nice to appease
those folks and have a --color flag that adds different colors on the
console output from subunit-trace.

Change-Id: Iac48591786d10c908d63e6df94b979ded7d8dbe1
Closes-Bug: #1519044
2015-11-25 13:15:22 +09:00
Masayuki Igawa
7d94993a75 Add *.egg* to .gitignore
This commit adds "*.egg*" to .gitignore and removes unnecessary entries.
Change-Id: I3b0985b3a11eccb3e16b8ee8eebcd2ae113500ec
2015-11-25 09:47:32 +09:00
Matthew Treinish
2a22826c58
Fail if no tests were successfully executed
This commit adds another sanity check to ensure we didn't have a test
run with just skipped tests.

Change-Id: Ie4bd185c209d9e9230ca8a3f54e8a433e82d9c14
2015-11-18 18:48:24 -05:00
Christian Berendt
01fb487df1 Fix syntax of the README file
Change-Id: I3a86e2db67c4e4ab4ea579b7b7a565e3a0582b15
2015-10-01 20:25:21 +02:00
Matthew Treinish
65e1e1867c
Force utf8 encoding on subunit attachments output
On certain environments if the locale is set to ASCII when printing an
attachment things will explode because it's potentially trying to use
unicode chars outside of ASCII. This commit forces the attachment
output to be unicode encoded to avoid this issue.

Change-Id: I79ff7482ec3b1fd3ce83b8acf3137119b3db39a9
Closes-Bug: #1501415
0.4.2
2015-09-30 20:55:12 -04:00
Davanum Srinivas
d577844b7b Better blacklist - tested with Nova
So in Nova, i wanted to add a text file with a list of
test ids like so:

nova.tests.unit.api.ec2.test_api.ApiEc2TestCase
nova.tests.unit.api.ec2.test_apirequest.APIRequestTestCase
nova.tests.unit.api.ec2.test_cinder_cloud.CinderCloudTestCase
nova.tests.unit.api.ec2.test_cloud.CloudTestCase
functional

to skip those specific test cases and any functional tests and
the current code would not work, so digging through the
regexp(s) on stack overflow and found this:
http://stackoverflow.com/questions/406230/regular-expression-to-match-line-that-doesnt-contain-a-word

Works like a charm!

Change-Id: I0e947c599ab19276f35150749d559487d9790028
0.4.1
2015-09-29 21:44:55 -04:00
Assaf Muller
368a2553cd Add whitelist file support
A whitelist files allows the user to specify a list of regexes
that ostestr will expand and run. It is mutually exclusive with
blacklist, but not mutually exclusive with --regex/path.
The value of --regex/path is appended to the whitelist.

Co-Authored-By: Davanum Srinivas <davanum@gmail.com>
Change-Id: Ic397212ef3127c176a5870676f67d8a5e0de0441
0.4.0
2015-09-29 12:26:45 -04:00
Jenkins
ba77bab8fb Merge "Fix issues with the blacklist file regex generation" 2015-09-29 14:21:24 +00:00
Jenkins
140732ff9d Merge "Switch to using autogenerated ChangeLog in docs" 2015-09-28 20:15:15 +00:00
Matthew Treinish
d533445b26
Fix issues with the blacklist file regex generation
This commit fixes a couple of bugs in the blacklist file regex
generator. The first where a comment line was accidently made
mandatory. If a comment wasn't specified an IndexError would be
raised. The second was related to the variable naming in the
function's blacklist file if branch. Variable reuse there was causing
the last blacklist regex to take precendence over a regex passed
in and would be used instead.

Change-Id: Ib80a0c1781db7c8c9e4449b4773258fe3348411a
Closes-Bug: #1488700
2015-09-28 16:13:13 -04:00
John Griffith
b135c5c80e Use test_to_run var in no-discover
The use of -n or --pdb was broken if a user
specified the test by path.  The problem is
that even though in the case of -n we parse
out path and convert to import notation, we
weren't using the parsed our variable in the
call_subunit_run call.

Also, it turns out that --pdb and -n are really
both work just fine calling call_subunit_run.  So
we can remove the def call_testtools_run and just
consolidate pdb and -n into a single statement and
runner call.

I looked at using a secondary exclusive group
between no-discover and pdb, but it it shouldn't
matter if a user tries to specify both, the or
statement should evaluate correctly and things
should just work even if it's pointless to type
in `tox -epy27 -- -n --pdb project.tests.test_name`.

Change-Id: Icd61d9fb710807a508c95e8080865429a1f34fb4
Closes-Bug: #1499891
2015-09-28 11:19:50 -06:00
John Griffith
f5168086f4 Minor refactoring to make os_testr more testable
While working on some other patches and trying to add
some unit tests there were a few things in os_testr that
made it difficult to test.

Rather than try and be super tricky, just refactor os_testr
a bit.

* Refactor get_parser to handle parse_args for us
  We'll need to explicitly pass in argv here
* Move the logic of selecting/calling the test
  runner into its own helper method (_select_call_runner)
* Modify existing tests to pass args in to get_parser
* Add a new test for runner selection

This cleans up the logic a bit and makes testing a good
deal easier.

Change-Id: I40527601613e6064cf6220f218bef1876ec69cda
2015-09-28 10:39:58 -06:00
Matthew Treinish
a8ca37c523
Switch to using autogenerated ChangeLog in docs
This commit switches the docs to use the PBR generated ChangeLog
instead of a hand curated release notes section. This is a lot less
error prone and instantaneous as compared to our current method which
often leaves the release notes section stale for months at a time.

Change-Id: Iff6586fc0113fd8292967a536d5bd37cb46ec29d
2015-09-24 11:52:20 -04:00
Monty Taylor
c5fd8d37cd Change ignore-errors to ignore_errors
Needed for coverage 4.0

Change-Id: Ib15f741b0bb6d92cea2f4aa0e0ec1d1e6d973842
2015-09-21 14:42:01 +00:00
Matthew Treinish
b351bc6c8f
Handle a skipped test without a reason message
This commit fixes a bug in subunit-trace where if a test is skipped
but does not have a reason associated with the skip it would stack
trace. This checks for the existence of a reason before trying to
use it.

Change-Id: I14dd9fbb40a8c232431e5042aa46f7e521e15311
2015-08-15 14:43:44 -04:00
Jenkins
dcb8ea833c Merge "Minimize output when --abbreviate is used" 2015-08-15 18:40:31 +00:00
Davanum Srinivas
01ae2c608b Minimize output when --abbreviate is used
print '.', 'F', 'S' etc instead of verbose output when --abbreviate is
used.

Change-Id: Iafd9ca58d846373a9e441b78cabc432475a5367b
2015-08-14 21:26:53 -04:00
TerryHowe
8eb9453815 Make use of argparse groups and add some tests
This change makes use of argparse groups to generate error
messages when the user specifies invalid command line option
combinations.  For example if the user specified --pretty
and --no-pretty before it would not complain, but now it
will.

Change-Id: I07e1edb5c43ff7b0a81879f388770fb732fed43b
2015-08-11 13:01:01 -06:00
Jenkins
5a739f9ac0 Merge "Convert file names to regular expressions" 0.3.0 2015-08-06 21:58:44 +00:00
TerryHowe
aee3402c68 Convert file names to regular expressions
Add the capability to the --no-discover option to convert file
names into regular sexpressions.  Also add the --path option that
converts a file or directory to a regular expression.  Create a
mutually exclusive argparse group for --regex, --path, and
--no-discover.

This change will allow the user to specify a file name instead of a
regular expression to match a particular set of tests e.g:

    tox -e py27 -- --path os_testr/tests/test_os_testr.py

Will run os_testr.tests.test_os_testr but you can use tab complete
to generate the name.

Change-Id: Ibfca2bc023aed44b1b87a0444559ab2a00303a70
2015-08-06 14:44:19 -06:00
Matthew Treinish
2ea7c8837b Handle incomplete subunit streams
If a subunit stream is aborted in the middle (like in the case of a
segfault) this causes subunit-trace to emit a stacktrace. This commit
attempts to handle this edge case gracefully.

Related-Bug: #1482230
Change-Id: I1a8a0a8e2ab65e637c6a5212e324670b7d95d28d
2015-08-06 16:50:24 +00:00
Jenkins
fdb57bdacd Merge "Set min pbr version in setup_requires" 2015-08-06 00:35:33 +00:00
Matthew Treinish
04a393eae2
Set min pbr version in setup_requires
This commit adds a minimum version on the setuptools setup_requires
for pbr. This is required to enable markers and also to ensure a
consistent version when installing with other packages.

Change-Id: I2168d91896ba82581929a2faeebace7419b4539e
2015-08-05 18:30:06 -04:00
Kun Huang
970e74bfd8 update requirements
Current pbr requirements is blocking tempest develop mode installation.

http://paste.openstack.org/show/406537/

Change-Id: I14dfe4c66d22d742706acbd1e5a574587eb40039
2015-07-31 10:12:21 +08:00
Matthew Treinish
e43001c9e6 Add TODO entry for moving away from subprocess in ostestr
This commit adds a new entry to the os-testr TODO file to indicate the
long term goal for migrating away from using subprocess in ostestr.
Everything ostestr uses is a python project so we shouldn't need to
call out for everything, it was just faster to bootstrap the project
this way, but we should probably move away from doing this.

Change-Id: I3b2e54d72514ad92079a893fd7a835e6d446d4bc
2015-07-17 15:18:32 +00:00
Matthew Treinish
2f29ca51be
Improved docs for os-testr commands
This commit adds real docs for using the 3 currently packaged commands
in the os-testr project. As part of this change it also updates the
sphinx config to generate proper man pages for all the tooling. At a
future stage we need to ensure that these get installed properly.

Change-Id: I0055c7961203a094590f6cfeb136a2236a2f65cc
2015-07-17 11:09:23 -04:00
Jenkins
16330c0526 Merge "Disable printing percent change on run time by default" 0.2.0 2015-06-30 14:29:08 +00:00
Jenkins
3b1f0ddb6a Merge "Misc Python 3 compatibility fixes" 2015-06-29 18:09:56 +00:00
Matthew Treinish
0abbeeac4b
Dogfood things for unit tests
So it turns out we weren't actually using ostestr for running the
os-testr unit tests. We probably should use the test runner runner
wrapper we're developing to run the unit tests for the test runner
runner wrapper and the other utilities in the package.

Change-Id: I88af9104352163f2412c2a3cbaf6c88d0a937988
2015-06-23 19:31:57 -04:00
Matthew Treinish
7376e96ab3 Disable printing percent change on run time by default
This commit disables printing the percent change in run time by
default. This was a cool experiment, but isn't really useful in
practice. Especially in the gate, things are so noisy and there
is so much variance looking at the change for a single doesn't
actually mean anything. It makes more sense to make this feature
opt-in because it's not generally useful.

Change-Id: Iecb153452edfe1d7b55757d022ae0331ac563b35
2015-06-23 19:23:13 -04:00
James Page
4292155e3e Misc Python 3 compatibility fixes
Python 3 renames StringIO -> io.  Use six to deal
with this change.

Introduces new test dependency on six for StringIO.

Change-Id: Ia875b7fcbb976599053970ef79ed3f3474626bad
2015-06-23 09:49:06 +01:00
TerryHowe
de604832c3 Catch exception trying to extract test time
The database I am getting back is a gdm database and it does
not have a get method.  Catch the exception and try something
else.  If that blows up, ignore because we'd rather see the
results of our tests.

Change-Id: I2882e19d49f2fb3471669f5eb8a017c5d5ac98c2
2015-06-01 20:01:37 -06:00