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

More idiomatic and consistent unit tests #580

Open
kba opened this issue Aug 28, 2020 · 1 comment
Open

More idiomatic and consistent unit tests #580

kba opened this issue Aug 28, 2020 · 1 comment

Comments

@kba
Copy link
Member

kba commented Aug 28, 2020

When we began OCR-D/core, we targeted only unittests with some enhancements over time in tests/base.py. To run the tests, we're actually using pytest, though.

We currently have ~300 tests which use various mechanisms to achieve the same task, often with nested context Managers (with TemporaryDirectory() as tempdir: and such).

@M3ssman suggested embracing pytest's features to a larger extent. For example, pytest offers decorators to achieve much of what we currently implement ourselves. For clarity and maintenance, we should refactor the test suite in a more consistent style.

This is obviously nothing that directly improves the user experience, so it is a bit of an unthankful but important task. At least for new tests, we should strive to make use of pytest's features and update the existing tests by and by.

@kba
Copy link
Member Author

kba commented Aug 28, 2020

See https://github.com/OCR-D/core/pull/581/files#diff-68b95183e452cd1438e45abf6eba00d7 on how a test looks like that makes use of pytest/unittest features.

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

No branches or pull requests

1 participant