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

Allow to specify a custom unittest runner #140

Merged
merged 3 commits into from Jul 7, 2015

Conversation

Projects
None yet
2 participants
@arcivanov
Contributor

arcivanov commented Jul 5, 2015

Monkeypatch unittest runner classes instead of hardcoding internal Runner and Result
Allow to specify custom TextTestRunner-based class as a runner
Allow to specify a custom Result factory runner method
Add unit test coverage

"unittest_runner" property can be set to:

  • class
  • class name
  • tuple of class/class-name and
    • name of the runner result-generating factory method
    • unbound method object with desired name
    • function with desired name

Runner class defaults to unittest.TextTestRunner
Result object factory method name defaults to "_makeResult"

Example:

project.set_property("unittest_runner", (lambda: xmlrunner.XMLTestRunner(project.get_property("dir_target")), xmlrunner.XMLTestRunner._make_result))

arcivanov added some commits Jul 5, 2015

Allow to specify a custom unittest runner
Monkeypatch unittest runner classes instead of hardcoding internal Runner and Result
Allow to specify custom TextTestRunner-based class as a runner
Allow to specify a custom result-generating runner method
Add unit test coverage

"unittest_runner" property can be set to:
	* class
	* class name
	* tuple of class/class-name and
	** name of the runner result-generating factory method
	** unbound method object with desired name
	** function with desired name

Runner class defaults to unittest.TextTestRunner
Result-generating method namedefaults to "_makeResult"

Example:
project.set_property("unittest_runner", (lambda:
	xmlrunner.XMLTestRunner(project.get_property("dir_target")),
	xmlrunner.XMLTestRunner._make_result))
@mriehl

This comment has been minimized.

Show comment
Hide comment
@mriehl

mriehl Jul 6, 2015

Member

Awesome thanks! Will review, merge and release in the next few hours.

Member

mriehl commented Jul 6, 2015

Awesome thanks! Will review, merge and release in the next few hours.

mriehl added a commit that referenced this pull request Jul 7, 2015

Merge pull request #140 from arcivanov/custom_unittest_runner
Allow to specify a custom unittest runner

@mriehl mriehl merged commit 6569e2a into pybuilder:master Jul 7, 2015

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.18%) to 71.61%
Details
@mriehl

This comment has been minimized.

Show comment
Hide comment
@mriehl

mriehl Jul 7, 2015

Member

Thanks!

Member

mriehl commented Jul 7, 2015

Thanks!

@arcivanov arcivanov deleted the arcivanov:custom_unittest_runner branch Jul 7, 2015

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