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

Unit testing improvements #132

Open
gabrieljreed opened this issue May 4, 2024 · 0 comments
Open

Unit testing improvements #132

gabrieljreed opened this issue May 4, 2024 · 0 comments
Labels
tests Tests or test workflows

Comments

@gabrieljreed
Copy link
Contributor

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.

@CyanVoxel CyanVoxel added the tests Tests or test workflows label May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests or test workflows
Projects
Status: Backlog
Development

No branches or pull requests

2 participants