-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add unit tests for SingleJob and Results classes #138
Add unit tests for SingleJob and Results classes #138
Conversation
d00f57d
to
dd015e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DummySingleJob seems instructive enough to put it somewhere with all the other job classes and not hidden away in a test, so that users can import it / so that one could create some instructive example in the docs.
unit_tests/test_basejob.py
Outdated
There is also an option to add an arbitrary wait period before the job runs to simulate a longer-running calculation. | ||
""" | ||
|
||
def __init__(self, inp=None, cmd=None, wait=0.0, **kwargs): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add type hints
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
Interesting idea. I don't think I would want to put it with the production jobs code, but perhaps it is worth creating a For now I think I will leave as-is in the tests, until there are enough useful components that it would be worth breaking them out and including them in the package, or actually used by an example. The class itself is very thin anyway at the moment. |
dd015e0
to
53d7d20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Would be nice to at some point have a pedgogical example that shows the awk_file, awk_output, grep_file, etc. similar to what is being done in the test here but more easily available to users.
Description
Add tests for the
SingleJob
andResults
classes. In addition include small refactoring.Refactorings
There are small refactorings here. Add a
StrEnum
calledJobStatus
to explicitly define the different job status types. This is now used throughout the code. Note this is backwards compatible as string comparisons should all still work as previously.In addition add type hints to the Job and Result classes
Bugfix
One small bug fix flagged by tests -
Job.load
did not actually return the loaded job, now it does.Tests
Otherwise add tests for the
SingleJob
andResults
classes. To facilitate this, add aDummySingleJob
which runs a simple shell command, possibly with a wait. This allows testing of the job file generation and dependencies.