Hypothesis: Setting `settings` for a `RuleBasedStateMachine` is tricky

Created on 13 Feb 2017  路  4Comments  路  Source: HypothesisWorks/hypothesis

This works:

class Foo(RuleBasedStateMachine):
    ...
Foo.TestCase.settings = settings(...)

However, I had to learn that by asking on the IRC channel. Also, this doesn't work but might reasonably be expected to:

class Foo(RuleBasedStateMachine):
    ...
class FooTests(Foo.TestCase):
    pass
FooTests.settings = settings(...)
enhancement

All 4 comments

As a user it would make sense for this to work:

@hypothesis.settings(...)
class Foo(RuleBasedStateMachine):
    ...

This would be a good first issue:

  • Add an early section to settings.__call__ which checks isinstance(test, stateful.GenericStateMachine) and if so, just does test.TestCase.settings = self then returns.
  • Add a test to hypothesis-python/tests/cover/test_settings.py which does this, and checks that the settings in the decorator apply while running the state machine.
  • Add the file hypothesis-python/RELEASE.rst with your notes for a minor release (see other PRs for examples) and add your name to the list of authors in CONTRIBUTING.rst.

And feel free to ask me any questions you might have, or for help if you get stuck!

I would like to give this a shot if no one is already working on it.

Go for it! This is yours for the next week 馃槃

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zac-HD picture Zac-HD  路  7Comments

rsokl picture rsokl  路  4Comments

DRMacIver picture DRMacIver  路  8Comments

whatevergeek picture whatevergeek  路  3Comments

sobolevn picture sobolevn  路  8Comments