-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
[Suggestion] use pytest style tests (w/ fixtures etc) #326
Comments
This sounds like a good idea for the long term, but I have no extensive experience with more sophisticated use of testing frameworks. We would need to things to get started:
|
One thing to note is that we will soon start working on Public Transport assignment (and its corresponding file/database structure, #305), so that could be a good place to begin from scratch if you are willing/able to review some of those PRs to see how is the testing system being used |
as a proof of concept/value I have add some pytest-style tests to #327. It makes use of fixtures to setup/teardown tests. Short summary of what is a fixture:
the MR also makes use of the builtin fixture If it's premature I can revert those tests back to unittest (but I like working with pytest much more, so I thought I'd just give it a go ;) ) As for test guidelines, I'm not quite sure what would be required in those guidelines. I can think of a few things though:
|
@elfjes , as you guys have been doing quite a bit of work on AequilibraE, you should be aware of this: https://www.linkedin.com/feed/update/urn:li:activity:6978111166732525568/ |
Aequilibrae currently uses pytest as a test runner, but does not make use of any of the (very useful) features of this package, such as fixtures and the assert (rewriting) system, since all tests are still in
unittest
style. I can see the following benefits of migrating to pytest style testing:assert something
instead ofself.assert*
is an (arbritrarily) nicer apiWould you be willing to migrate to using pytest proper? If so, what would be the prefered way of implementation? My suggestion would be
In my experience, converting from unittest to pytest can be relatively time consuming, especially if you want to do it correctly with differently scoped fixtures (but the resulting code is much more maintainable and extensible).
The text was updated successfully, but these errors were encountered: