Skip to content

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

Merged
merged 3 commits into from
Jun 29, 2017

Conversation

Nnonexistent
Copy link
Contributor

  1. xmlrunner.XMLTestRunner was hardcoded into xmlrunner.extra.djangotestrunner.XMLTestRunner. Now it's overridable attribute of xmlrunner.extra.djangotestrunner.XMLTestRunner
  2. kwargs for xmlrunner.XMLTestRunner is now generated in separate get_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.
  3. Test for patch functionality added. It fails in pre-patch version and passes now. For this mock library was added in tox dependencies, hope it's ok.
  4. Comments added across touched code.

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`
@coveralls
Copy link

coveralls commented May 5, 2017

Coverage Status

Coverage increased (+0.01%) to 99.296% when pulling 0f0fb3e on Nnonexistent:django_extensibility into 14fa2ff on xmlrunner:master.

@codecov-io
Copy link

codecov-io commented May 5, 2017

Codecov Report

Merging #148 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
tests/django_test.py 100% <100%> (ø) ⬆️
xmlrunner/extra/djangotestrunner.py 96.77% <100%> (+1.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 14fa2ff...2877243. Read the comment docs.

Copy link
Member

@dnozay dnozay left a 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...


if single_file is None: # output is a stream
output = output_dir
else: # output is a folder
Copy link
Member

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
Copy link
Member

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.


def run_suite(self, suite, **kwargs):
kwargs = self.get_test_runner_kwargs()
runner = self.test_runner(**kwargs)
Copy link
Member

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.

@coveralls
Copy link

coveralls commented May 17, 2017

Coverage Status

Coverage increased (+0.01%) to 99.296% when pulling 2877243 on Nnonexistent:django_extensibility into 14fa2ff on xmlrunner:master.

@Nnonexistent
Copy link
Contributor Author

@dnozay thanks for comments. I hope it's better now )

@dnozay dnozay merged commit 8e53812 into xmlrunner:master Jun 29, 2017
@Nnonexistent Nnonexistent deleted the django_extensibility branch June 29, 2017 10:52
@admsteck
Copy link

admsteck commented Feb 2, 2018

@dnozay I would love to have this for a project I am working on. Any chance we can get a new release?

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

Successfully merging this pull request may close these issues.

5 participants