Skip to content

time reported as zero in XML JUnit output #47

Closed

Description

@pytestbot

Originally reported by: BitBucket: luked2, GitHub: luked2


I created the following test:

import time
def test_bar():
    time.sleep(2)

When I run the test:

% py.test --junitxml=out.xml

the resulting XML shows the overall time correctly, but the time for each individual test always comes up as zero:

<?xml version="1.0" encoding="utf-8"?><testsuite name="" errors="0" failures="0" skips="0" tests="1" time="2.013" >
<testcase classname="test_foo" name="test_bar" time="0"></testcase></testsuite>

Activity

  1. pytestbot commented on May 28, 2011

    @pytestbot
    ContributorAuthor

    Original comment by BitBucket: luked2, GitHub: luked2:


    The following patch fixes the problem, but I couldn't say why.

  2. pytestbot commented on May 28, 2011

    @pytestbot
    ContributorAuthor

    Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


    fix issue47 - fix time-per-test timing output for junitxml

  3. pytestbot commented on May 28, 2011

    @pytestbot
    ContributorAuthor

    Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


    you can install the fix with "pip install -i http://pypi.testrun.org -U pytest" - thanks for your quick patch which showed me where the problem was (the memorizing/access of timings per test item was done with a wrong key).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions