547 Commits

Author SHA1 Message Date
Chris Dent
398318ee17 Use the dirname of each runner testfile as the test_dir
When gabbi-run is passed one or more files, set the working
directory for the associated test suite as the directory of
each test file. Doing so ensures that `<@file` syntax in the
YAML has a fixed point from which to find the data files.

If data comes from STDIN then the test directory is '.' (as
it has always been).

Fixes #184
2016-11-27 14:34:17 +00:00
Chris Dent
07dc4913eb Merge pull request #188 from tomviner/data-files-in-subdirs
Allow <@ syntax to safely include subdirectories
2016-11-27 13:51:32 +00:00
Tom Viner
7b6346daac enable mock_open to work on py3.3/3.4 2016-11-27 13:42:26 +00:00
Tom Viner
bec94c5554 Allow <@ syntax to safely include subdirectories 2016-11-26 23:49:35 +00:00
Chris Dent
787e83a44b release 1.28.0
- pretty print json bodies when verbose: True
1.28.0
2016-11-25 11:44:45 +00:00
Chris Dent
1ef37f4838 Merge pull request #186 from cdent/fix-182
Pretty print JSON bodies in verbose tests
2016-11-25 11:32:45 +00:00
Chris Dent
6f5d936581 fixing duplicate word in a comment 2016-11-14 12:20:19 +00:00
Chris Dent
836a73adfa Pretty print JSON bodies in verbose tests
If a request or response body is JSON, then use the loads and dumps
methods on the JSON content handler to present it in a pretty
fashion. See the TODO in gabbi/httpclient.py for future expansion
options.

This reuses a test_verbose.yaml file added in pull request #183
that didn't seem to be doing anything.

Tests for this are in test_runner.py as it provides useful stdout
capturing infrastructure.

Fixes #182
2016-11-10 17:02:17 +00:00
Chris Dent
f27b9aba85 release 1.27.1
- fix handling of report POST data when verbose
1.27.1
2016-11-04 18:08:38 +00:00
Chris Dent
f30fe24539 Merge pull request #183 from tomviner/verbose-post-bug
Verbose post bug
2016-11-04 18:00:23 +00:00
Tom Viner
723d49f252 Support verbose with post data 2016-11-04 15:41:01 +00:00
Tom Viner
68ca5e9555 Don't compare strings via object identity 2016-11-04 15:38:57 +00:00
Chris Dent
39095289e3 Release 1.27.0
* allow gabbi-run to accept multiple filenames as command args
1.27.0
2016-10-04 14:24:12 +01:00
Chris Dent
edbc22a6dd Merge pull request #180 from FND/runner-files
gabbi-run support for multiple input files (take two)
2016-10-04 14:10:56 +01:00
Chris Dent
b1b0dfa546 Add some rudimentary docs for runner input files handling
This gets the basics in a very simplistic fashion.

What's missing is any indication of the availability of this feature
in the argparse created help (the output one sees from
gabbi-run --help). It's not clear what the best way to add this is,
since the feature is being managed outside argparse.
2016-10-04 11:58:42 +01:00
Chris Dent
6136025c08 Extract sys.stdin handling from the input_files
This is probably a personal preference not a technical one, given that
we are going to be making two separate calls to run_suite, it makes more
sense to make that choice outside of a for loop, not within it. This
makes the reason for the different calls a bit more evident and means
that everything in the input_files list is of the same type and no type
checking is required.
2016-10-04 11:36:57 +01:00
Chris Dent
c563405207 Extract argparse setup to own method
To get it into its own place and out of view from the main
processing.
2016-10-04 11:25:30 +01:00
Chris Dent
a4bd8a83c5 Remove the use of lambda and just call run_suite directly
This form, while a duplication, is more readable for an explorer.
2016-10-04 11:20:02 +01:00
FND
a0ca34bc50 Refactor file path extraction
not sure this is actually more readable though
2016-10-04 11:26:48 +02:00
FND
61aeef4608 Improve argument type detection 2016-10-04 11:26:48 +02:00
FND
8bca50bbb8 Refactor internals to encapsulate function arguments
in an attempt to appease @cdent
2016-10-04 11:26:48 +02:00
FND
ecd9877e68 Change CLI interface for input files
before:

    $ gabbi-run -f foo.yaml -f bar.yaml

after:

    $ gabbi-run -- foo.yaml bar.yaml

the latter is more flexible, as it supports globbing
2016-10-04 11:26:48 +02:00
FND
4c3065562d Add support for multiple input files to runner 2016-10-04 11:26:48 +02:00
FND
712ce035cf Refactor runner in preparation of support for multiple input files 2016-10-03 19:57:29 +02:00
Chris Dent
5274e71322 Use testtools.TestCase instead of TestCaseWithFixtures
It turns out that though the fixtures will be run when using the
latter the 'details' capturing (which is rather the point of using
the fixtures) will only happen when using testtools.
1.26.1
2016-09-29 11:02:41 +01:00
Chris Dent
f35df02ee8 Release 1.26.0
* switch to content-handlers
* add inner-fixtures
1.26.0
2016-09-29 09:35:51 +01:00
Chris Dent
e600d45522 Merge pull request #175 from cdent/inner-fixtures
Inner fixtures
2016-09-29 09:18:41 +01:00
Chris Dent
4910174cca Merge pull request #176 from trumant/issues/174
Closes #174 by correcting the function name typo
2016-09-28 18:25:16 +01:00
Travis Truman
f63eb9c3a0 Pluralize to remain consistent with previous function name 2016-09-28 12:48:26 -04:00
Travis Truman
52bc870c6e Closes #174 by correcting the function name typo 2016-09-28 12:46:17 -04:00
Chris Dent
df198c8849 Add doc for inner fixtures
This covers the basics without being too encouraging. We don't
want to be encouraging on this one.
2016-09-28 16:55:45 +01:00
Chris Dent
7c7d48e5d6 Fix docstring typos. 2016-09-28 16:30:07 +01:00
Chris Dent
a7d18c7983 Remove hacks for dealing with response handler global state
These are no longer needed.
2016-09-26 21:15:26 +01:00
Chris Dent
682d2162a9 Merge branch 'master' into inner-fixtures
Conflicts with the addition of the inner_fixtures parameter in a few
places. This is all getting a bit out of hand with far too many
parameters.
2016-09-26 21:10:03 +01:00
Chris Dent
30dc321a90 Merge pull request #134 from cdent/content-handlers
Content handlers
2016-09-26 20:56:59 +01:00
Chris Dent
4beb264842 Add the concept of an inner fixture
An inner fixture is a fixture that runs per test, rather than
per test file. As implemented these fixtures are of the class
fixtures.Fixture from the python package 'fixtures'[1].

The way in which these are useful is for capturing per-test
output (stdout, stderr, logs and the like) or otherwise performing
setUp and cleanUp before and after an individual test. In many
cases this is not something that is needed in a simple gabbi run
but in some contexts (for example those with many tests in a broadly
concurrent environment) it can be important to chunkify any stray
output that the tests produce and lump it with an individual test in
a way that doesn't get interleaved with multiple streams of output.

By default nothing changes, but if someone uses the inner_fixtures
argument to build_tests and passes some fixtures (the docs will be
updated in later commits) they will be used.

This is a first commit that is not fully working but demonstrates
the concept. The tests are not working well because of global
state in the response handlers messing with this. Will fix that
elsewhere.
2016-09-26 20:39:25 +01:00
Chris Dent
02ffb45f77 Update content-handlers to reflect json regex handling
Regex handlings was added to the right hand side of json path
expressions. This updates the content-handlers branch to support
them and merges up to master.
2016-09-26 20:34:47 +01:00
Chris Dent
0419936f5d Merge branch 'content-handlers' of github.com:cdent/gabbi into content-handlers 2016-09-26 20:00:45 +01:00
Chris Dent
acf330730e Correct group_regex in .testr.conf
Without this change, some test_intercept tests are run multiple
times but not reported.
2016-09-26 18:34:29 +01:00
Chris Dent
816d58062a Don't use usedevelop (#173)
As far as I can tell it serves no purpose.
2016-09-23 12:12:01 +01:00
FND
9203bc89c3 Fix heading level 2016-09-21 13:50:27 +02:00
Chris Dent
a9e16c7ae3 Release 1.25.0
- allow overriding of fully qualified test name via test_loader_name
1.25.0
2016-09-20 19:31:23 +01:00
Chris Dent
1b9c4dfdf0 Allow test_loader_name to override test class module (#171)
When running gabbi by default the pretty name of the test
(displayed in test results) has a 'gabbi.suitemaker' prefix. This
can be disorienting when reviewing result sets or trying to track
those results to where in a code tree the gabbi tests are loaded.

This change allows the __module__ of the test classes that are
dynamically created to be override with the test_loader_name
that is passed in to to the build_tests method. By setting this
to __name__ the test is appropriately situated in its context. The
gist of this change can be seen on the diff to test-limit.sh.

Note that this has also been tested in OpenStack Nova, which
was the source of this need. There tests which were showing up with
the name:

    gabbi.suitemaker.test_placement_api_inventory_get_that_inventory.\
      test_request

have become:

    nova.tests.functional.api.openstack.placement.\
      test_placement_api.inventory_get_that_inventory.test_request

By default nothing has changed. This change only impact situations where
test_loader_name is used.
2016-09-20 19:28:48 +01:00
Chris Dent
9cb72dbc43 Add some doc and FAQ about quieting pytest warnings (#172)
As it will take some time and effort to replace the existing yield
tests, add some hopefully helpful information on how to deal with
the warnings.
2016-09-20 19:28:19 +01:00
Chris Dent
80df8a8863 Release 1.24.1
* cast jsonpath match to string for regex match
* don't require mock in python >= 3.3
1.24.1
2016-09-06 21:55:36 +01:00
Chris Dent
448a1c3fa0 Cast json match to string when doing regex match (#167)
Otherwise a TypeError can happen. Tests are added to insure it works
as expected.

Fixes #166
2016-09-06 21:46:05 +01:00
Danek Duvall
3d559ab0b7 Add a custom move to six to make mock available for both Python 2 and 3. (#169)
Fixes #168
2016-09-06 21:44:23 +01:00
Chris Dent
2bd1c803b7 Add a FAQ about yaml anchors and aliases
They are black magic, but very useful.
2016-08-19 17:01:34 +01:00
Chris Dent
8db2f5ab27 Add the framework for including a FAQ in docs (#163)
Add a faq.rst and two simple questions to get the ball rolling
on having a gabbi faq in the docs.

This format probably won't scale in the long run, but is useful in
the short run and while the format might become lame the content
will not.
2016-08-17 12:42:34 +01:00
Jason Myers
92718ede93 Fixing link to google (#162)
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2016-08-08 13:55:32 +01:00