You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the codebase grows, unit testing will continue to become more important, so new changes can be introduced with a stronger guarantee to not break existing functionality. Formatting the entire codebase with ruff was great! The fact that it was done so soon will make things much easier going forward. Here are a few things I think it would be nice to have:
Code coverage
While there are a lot of valid arguments for why code coverage can be misleading, it can still be really useful when writing tests. Code coverage should definitely not be the only way to ensure good test coverage, but it's a great help. coverage is a great tool and integrates really nicely with pytest.
Type checking
While Python does not enforce typing (love it or hate it), you can prevent a lot of headaches by ensuring that all your functions are getting the right things passed to them. mypy is a great library for this and can even be installed as an extension to lint your code as you type.
Docstring testing
I know there isn't a specified docstring convention yet, but when we do get one, we can set up tests to ensure that all modules, classes, and functions have properly formatted docstrings. pydocstyle is a great example.
Continuous Integration testing
Similar to how the ruff linting is set up to run when a user opens a pull request, we can have unit tests run on a PR to ensure their changes won't break existing functionality.
Tox
tox makes it easy to manage testing environments for different python versions, platforms, and test suites. My current company manages all our unit testing through tox and it makes for a great dev experience. Tests are run the same way locally and in continuous integration.
The text was updated successfully, but these errors were encountered:
As the codebase grows, unit testing will continue to become more important, so new changes can be introduced with a stronger guarantee to not break existing functionality. Formatting the entire codebase with ruff was great! The fact that it was done so soon will make things much easier going forward. Here are a few things I think it would be nice to have:
Code coverage
While there are a lot of valid arguments for why code coverage can be misleading, it can still be really useful when writing tests. Code coverage should definitely not be the only way to ensure good test coverage, but it's a great help. coverage is a great tool and integrates really nicely with
pytest
.Type checking
While Python does not enforce typing (love it or hate it), you can prevent a lot of headaches by ensuring that all your functions are getting the right things passed to them.
mypy
is a great library for this and can even be installed as an extension to lint your code as you type.Docstring testing
I know there isn't a specified docstring convention yet, but when we do get one, we can set up tests to ensure that all modules, classes, and functions have properly formatted docstrings. pydocstyle is a great example.
Continuous Integration testing
Similar to how the ruff linting is set up to run when a user opens a pull request, we can have unit tests run on a PR to ensure their changes won't break existing functionality.
Tox
tox makes it easy to manage testing environments for different python versions, platforms, and test suites. My current company manages all our unit testing through tox and it makes for a great dev experience. Tests are run the same way locally and in continuous integration.
The text was updated successfully, but these errors were encountered: