swo / caravan

a 16S pipeline
0 stars 3 forks source link

refactor barcode testing to use parameterization for easier addition #10

Closed elsherbini closed 8 years ago

elsherbini commented 8 years ago

Learning how test parametrization works, and the power/use of fixtures.

Tests can take parameters if you use the mark.parametrize decorator. This makes it easy to run the same test with different arguments.

If you need to preprocess a parameter with some common boilerplate, you can use the indirect= parameter and that argument will be passed to a fixture of the same name.That variable will become whatever the fixture returns or yields for the test. This seems useful for when you need to spoof a file, or connect to a db, or anything that requires some "setup" and "teardown" that would clutter your test.

swo commented 8 years ago

I'm on vacation for a while; I'll have a look when I return!

On Fri, Jul 8, 2016 at 9:57 PM Joseph Elsherbini notifications@github.com wrote:

Learning how test parametrization works, and the power/use of fixtures.

Tests can take parameters if you use the mark.parametrize decorator. This makes it easy to run the same test with different arguments.

If you need to preprocess a parameter with some common boilerplate, you can use the indirect= parameter and that argument will be passed to a fixture of the same name.That variable will become whatever the fixture returns or yields for the test. This seems useful for when you need to spoof a file, or connect to a db, or anything that requires some "setup"

and "teardown" that would clutter your test.

You can view, comment on, or merge this pull request online at:

https://github.com/swo/caravan/pull/10 Commit Summary

  • refactor barcode testing to use parameterization for easier addition

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/swo/caravan/pull/10, or mute the thread https://github.com/notifications/unsubscribe/ACbmk6Yb-PCU87Nq1AMe1k_PioZoud_Xks5qTp18gaJpZM4JITcX .