Skip to content

Test case fixture isolation with runtests. #96

Open
@corriander

Description

@corriander

This is a similar issue to #24, but my query is about using runtests and a simple naming scheme/pattern to invoke test fixtures on a per test case basis. I'll explain by example...

My intent was to keep all my test-related stuff in a single schema (e.g. tests), with tests named something like

testcase1_test_a_thing()
testcase1_test_more()
testcase2_test_another_thing()

with fixtures:

setup_testcase1_insert_test_data()
startup_testcase2_alter_view()

Then invoke runtests('tests', '^testcase2') to just run the relevant fixtures and tests (i.e. a startup fixture followed by a single test using this example). From what I can see, this is a non-starter due to the way all fixtures are identified by findfuncs by prefix, irrespective of any pattern provided to runtests.

Am I barking up the right tree here? This seems a reasonable approach to me but I may be influenced by other testing frameworks. In principle it looks simple to restrict fixtures by name pattern as well but how to do this cleanly is less obvious... This leads me to wonder about alternative approaches (either for implementing this behaviour or my use case). At the moment I'm leaning towards severely restricting/dropping the use of text fixtures because they'd need to be universally applicable, which means I might as well not use runtests either.

Any suggestions/comments?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions