Skip to content
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

Enable XMLTestRunner to make TestResults for in-memory usage #176

Closed
wants to merge 2 commits into from

Conversation

MikeTheGreat
Copy link

Hi!

First, I want to be very clear that half the reason I'm offering this PR is to practice doing PRs. While I do think it may be useful to other people it definitely takes the XMLTestRunner in a new direction and so please do feel free to reject this :)

The goal is to have a test runner that can generate a complete TestResult object/tree, and then hand that TestResult off to something else to process (instead of forcing the 'something else' to consume XML from a file written to the local filesystem).

I was thinking about using the unittest.TextTestRunner class, but that one doesn't list the successful test runs. XMLTestRunner does list the successes, which makes it a bit better for what I wanted it for.

The Change: By setting the .output field to None the XMLTestRunner will still run all the tests but not generate the XML output, leaving client software to access the awesomely thorough TestResult purely in-memory, instead.

… all the tests but _not_ generate the XML output.

The goal is to have a test runner that can generate a complete TestResult object/tree, and then hand that TestResult off to something else to process (instead of forcing the 'something else' to consume XML).
@coveralls
Copy link

coveralls commented Oct 2, 2018

Coverage Status

Coverage decreased (-0.2%) to 99.309% when pulling dacc237 on MikeTheGreat:master into 79621f3 on xmlrunner:master.

@MikeTheGreat
Copy link
Author

My apologies for submitting broken code :(

Before pushing it I tried to test it locally by making the changes, importing this code into the other project where I wanted to use the xml test runner, and running that project. I thought it had worked but clearly couldn't have.

@MikeTheGreat
Copy link
Author

Would it be ok to ask for help on the CI fail? It passes everything except for Python 3.3, where it gives the following error message:

Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.3.6/bin/tox", line 7, in <module>
    from tox import cmdline
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/tox/__init__.py", line 32, in <module>
    from .session import cmdline  # noqa
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/tox/session.py", line 17, in <module>
    import pkg_resources
  File "/home/travis/virtualenv/python3.3.6/lib/python3.3/site-packages/pkg_resources/__init__.py", line 90, in <module>
    raise RuntimeError("Python 3.4 or later is required")
RuntimeError: Python 3.4 or later is required
The command "tox" exited with 1.

It looks like the issue may be that the 'tox' tool doesn't run on Python 3.3?

@danchr
Copy link
Contributor

danchr commented Nov 9, 2018

It looks like the issue may be that the 'tox' tool doesn't run on Python 3.3?

Indeed; see #173.

@dnozay
Copy link
Member

dnozay commented Nov 13, 2018

First, I want to be very clear that half the reason I'm offering this PR is to practice doing PRs. While I do think it may be useful to other people it definitely takes the XMLTestRunner in a new direction and so please do feel free to reject this :)

Thank you for providing details.
There isn't really a value if xmlrunner does not generate XML.

The goal is to have a test runner that can generate a complete TestResult object/tree, and then hand that TestResult off to something else to process (instead of forcing the 'something else' to consume XML from a file written to the local filesystem).

The vast majority of users of this package are using continuous integration. The tests may run in a process on a machine A (or several machines), then collected, then possibly aggregated, etc, before being stored in machine B and displayed to end-user.

@dnozay dnozay closed this Nov 13, 2018
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.

None yet

4 participants