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.
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
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
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
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.
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.
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
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.
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.
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.
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.
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.