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

Tutorial: usage with pytest #129

Open
dimaqq opened this issue Jun 24, 2019 · 2 comments
Open

Tutorial: usage with pytest #129

dimaqq opened this issue Jun 24, 2019 · 2 comments

Comments

@dimaqq
Copy link

dimaqq commented Jun 24, 2019

It's awesome to have a tutorial!

At the same time, I feel that unittest framework's time has passed (not everyone agrees, it's just my opinion) and we're happily using pytest and it integrates nicely with asynctest.

Our use in a nutshell:

pytestmark = [pytest.mark.asyncio]

@asynctest.mock.patch("some.thing.patched", autospec=True)
async def test_something_or_other(patched, fixture, fixture):
    ...
@Martiusweb
Copy link
Owner

Hi,

What are you suggesting? Do you think that the examples in the tutorial should use pytest instead of unittest or both?

I use the unittest in the tutorial runner for these reasons:

  • I don't really have an experience with pytest (the unittest runner has always been sufficient for my use cases),
  • asynctest extends unittest.TestCase, while IIRC, pytest suggests a different approach to write test functions (with a decorator),
  • I like that the tutorial don't require to install an external package.

Feedbacks and suggestions are welcome!

@dimaqq
Copy link
Author

dimaqq commented Jun 25, 2019

I, personally, would rather see pytest examples instead of unittest.

At the same time, I'd gladly see pytest examples in addition to unittest when the alternative is only unittest :)

Another possibility is to keep basic examples concise without reference to a specific framework, e.g. https://hypothesis.readthedocs.io/en/latest/quickstart.html

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