-
Notifications
You must be signed in to change notification settings - Fork 138
Ability to define custom test_runner for Django test runner #148
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
Conversation
…er` extensibility
Move test_runner kwargs generation into separate method, like in django 1.11+ (still working in prior versions) Use `test_runner` attribute instead of hardcoded `xmlrunner.XMLTestRunner`
Codecov Report
@@ Coverage Diff @@
## master #148 +/- ##
==========================================
+ Coverage 99.28% 99.29% +0.01%
==========================================
Files 17 17
Lines 1117 1136 +19
==========================================
+ Hits 1109 1128 +19
Misses 8 8
Continue to review full report at Codecov.
|
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.
thanks for the changes, a few comments...
xmlrunner/extra/djangotestrunner.py
Outdated
|
||
if single_file is None: # output is a stream | ||
output = output_dir | ||
else: # output is a folder |
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.
there is already a if single_file is not None
|
||
def run_suite(self, suite, **kwargs): | ||
dummy = kwargs # unused |
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.
this was a useful (somewhat) comment.
xmlrunner/extra/djangotestrunner.py
Outdated
|
||
def run_suite(self, suite, **kwargs): | ||
kwargs = self.get_test_runner_kwargs() | ||
runner = self.test_runner(**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.
note: i don't like naming kwargs
as it is redefined locally.
@dnozay thanks for comments. I hope it's better now ) |
@dnozay I would love to have this for a project I am working on. Any chance we can get a new release? |
xmlrunner.XMLTestRunner
was hardcoded intoxmlrunner.extra.djangotestrunner.XMLTestRunner
. Now it's overridable attribute ofxmlrunner.extra.djangotestrunner.XMLTestRunner
xmlrunner.XMLTestRunner
is now generated in separateget_test_runner_kwargs
method. It's made as in Django 1.11 but will work in Django 1.8 as well. Just follow naming convention. This was done mostly for code cleanup and separation.mock
library was added in tox dependencies, hope it's ok.