bastibe/PySoundFile — pull request #50 by mgeier (2014-06-24 14:31:33+00:00)
Title: Re-factor test fixtures

The new py.test-based tests are great, but the fixtures seem overly complicated given the claim of py.test to be low-overhead.

There should be a fixture for a read-only file, parametrized with three options, returning either a filename, a file descriptor or a file-like object.
Same for write-only.
For `'rw'` we might need two separate groups: "existing file" and "new file".
These can then be used in further fixtures which open a `pysoundfile.SoundFile`.

So far, this is no problem with py.test.
But it would be really useful to have a way to combine two or more of them into a new fixture.
For example, it would be nice to have a new fixture (called "readable" or similar) that combines the read-only fixture (three parameters) with the "existing `'rw'` file" fixture (three parameters), thus leading to six test cases in total.

Sadly, I couldn't come up with a way to implement this.

I asked on stackoverflow, but no response until now: http://stackoverflow.com/questions/24340681/how-to-concatenate-several-parametrized-fixtures-into-a-new-fixture-in-py-test

Any ideas how this could be done?

Other possible improvements:

* use `tmpdir` when writing files (http://pytest.org/latest/tmpdir.html)
* don't open the test WAV file in `'rw'` mode, make a copy first
* use `yield_fixture` for closing files and other cleanup (http://pytest.org/latest/yieldfixture.html)