560 Commits

Author SHA1 Message Date
Chris Dent
d858e8379c Add docs explaining use of new pytest technique
loader.rst has been expanded to explain both ways for loading
tests using pytest, hopefully with sufficient context to explain
why it is like it is.

With any luck this will help make the obvious cleaner solution
more apparent as we iterate into the future.
2016-11-28 21:02:38 +00:00
Chris Dent
d2175fa89b Merge branch 'master' into fix-pytest-yield 2016-11-28 20:19:29 +00:00
Chris Dent
60ccdd0e88 Merge branch 'fix-185' 2016-11-28 14:38:39 +00:00
Chris Dent
7f2c19f5b0 Merge branch 'master' into fix-185 2016-11-28 14:34:33 +00:00
Chris Dent
042f891562 Merge pull request #191 from cdent/runner-data-dir
Use the dirname of each runner testfile as the test_dir
2016-11-28 14:17:12 +00:00
Chris Dent
e005836817 Merge pull request #189 from tomviner/data-files-in-subdirs
Docs for <@file/path.txt
2016-11-28 10:12:16 +00:00
Tom Viner
59ed73d75f clarify wording of docs 2016-11-27 19:20:48 +00:00
Chris Dent
d181dae229 Add a -v or --verbose flag to gabbi-run
A value of 'all', 'headers' or 'body' will have the expected
effect on all the tests being run in the current testing session.

This is done by manipulating the 'defaults' of each test suite.

Fixes: #185
2016-11-27 15:13:03 +00:00
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
Tom Viner
968c11b3da update docs to mention filepath rather than file 2016-11-27 13:51:48 +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
79b1e8c221 Merge branch 'master' into fix-pytest-yield 2016-11-25 11:50:51 +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
17fbae067d Make sure the pytester plugin is called.
In the new model of gathering tests, the pytester plugin which
ensures that fixtures are started and stopped but not counted
as tests was not being run because test-name matching was no
longer working correctly.

These changes ensure that the plugin is run. Despite the small
change here, this took absolute ages to get right.

And it still doesn't fix the problem present in the previous
commit: The need for the test_pytest function to be present
in the namespace of the test module. So a few more iterations
remain.
2016-11-01 20:25:48 +00:00
Chris Dent
439706c464 Pass metafunc into the pytest generator
This removes a lot of code from the calling test (in this case
test_gabbits_pytest) but one problem still remains: test_pytest
still needs to exist in the test module, otherwise no tests are
created.
2016-11-01 16:19:48 +00:00
Chris Dent
6dd40c4290 Fix pytest warnings by using pytest_generate_tests
This is not done. Though it works to remove the warnings that
are created when using yield to generate the tests, it is cumbersome
for the tester to use: pytest_generate_tests needs to be in the test_*
module and that module needs to have test_pytest in itself in some
fashion. What would be better for the the user of gabbi (the test
author) to be able to only call a method with the right arguments
and for the pytest details to be hidden. This may be possible but
pushing this up for sharing and discussion first.

/cc @FND, @jasonamyers
2016-10-28 19:11:08 +02: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