Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alternate approach as cases inside class #93

Closed
jnoortheen opened this issue Jun 3, 2020 · 3 comments
Closed

alternate approach as cases inside class #93

jnoortheen opened this issue Jun 3, 2020 · 3 comments

Comments

@jnoortheen
Copy link

I really like this library but it seems to require lot of boilerplate code to get running.

Can we have a class based approach as well to the existing approaches?
What do you think about the following way?.

class TestDescribeTest():
  def case_one(self, fixture1, fixture2, fixture3):
     return input, output, err
  def case_two(self, fixture2, fixture3):
    return input, output, err
  def test_function(self, input, output, err):
    # test body

I know I can just put this inside generate_tests to parameterize the test, but not sure, how to pass the parameters from the case functions and make the case functions behave like fixture functions. What are your opinions?

@smarie
Copy link
Owner

smarie commented Jun 3, 2020

@jnoortheen thanks for the feedback !

I agree with you - this is why I am in the process of making the experience closer to pytest. (See #90 )
This should happen within one or two weeks, so I suggest that we take this conversation again when it (and the associated new readme) is done. Until then, you can put the case functions in a dedicated module (I use the convention test_xxx_cases.py when your test file is test_xxx.py, it will even be the default in v2)

Sorry for delaying, and thanks for your patience !

@smarie smarie closed this as completed in 0f44859 Jul 9, 2020
@smarie
Copy link
Owner

smarie commented Jul 9, 2020

@jnoortheen sorry for taking so much time but I finally release version 2.0.0 today. It should provide a good answer to your concerns. Let me know !

@jnoortheen
Copy link
Author

It looks great Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants