question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why not just use `mypy`and "pytest`? What are the advantages of the "pytest-mypy" package?

See original GitHub issue

Sorry for my noob question, but what is the purpose of the package? I can run in a terminal locally or at a cloud’s CI/CD the following two commands:

>  mypy src/ && mypy tests/
>  pytest tests/ 

So why waste time on a new package development instead of just running two simple commands?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
LourensVeencommented, May 2, 2021

I use this plugin, and a few more for my favourite linters, to run all the checks in a single command as @dmtucker described.

This has several advantages:

  • I don’t accidentally forget to run one of them and miss an issue that I later have to go back and fix
  • External contributors unfamiliar with my setup can run a single command to check their changes, rather than having to learn about how exactly this project tests and lints and typechecks its code and do it manually
  • I call the same command on my Continuous Integration infrastructure, giving me a single place to add or remove tools that applies everywhere

I do actually use this for projects that support a range of Python versions; I just run pytest with all the plugins in an appropriate container on the CI. The checks are fast anyway, so it’s no big deal. It’s true that I should get rid of that setup and move to tox though, I just haven’t got a sufficiently round tuit yet 😃.

So thanks to @dmtucker and @dbader and the other contributors for this useful tool!

Maybe we could consider this issue a request for adding a few lines on “What is this for?” to the README?

1reaction
blubberdiblubcommented, Nov 16, 2021

FWIW, PyCharm doesn’t provide a mypy Run Configuration, but it does provide a pytest one.

Furthermore, it doesn’t have a Run Configuration to run some arbitrary executable or script in an arbitrary way without limitations or strange peculiarities. It does have a Shell Script Run Configuration that can indeed be abused to do that, however, that’s not the intent of that.

Therefore, this module can be a simple way to integrate an explicit mypy run (as opposed to another real-time background inspection) with PyCharm.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why not just use mypy and "pytest`? What are the advantages ...
I made a conclusion that pytest-mypy is a kind of alternative without any significant difference and without any valuable advantages.
Read more >
Why Use Pytest to Test Your Software Project? - Medium
Among its many advantages are that it's easy to write, supports unittest, runs in parallel, and reduces code duplication. Read on to find...
Read more >
pytest-mypy - Bountysource
Why not just use `mypy`and "pytest`? What are the advantages of the "pytest-mypy" package? $ 0. Created 1 year ago in dbader/pytest-mypy ......
Read more >
Ultimate Python Tox Guide with Practical Examples with MyPy ...
This tutorial will teach you the follwoing. What is tox and why you should use it? How you can add unit tests with...
Read more >
Effective Python Testing With Pytest
Testing your code brings a wide variety of benefits. It increases your confidence that the code behaves as you expect and ensures that ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found