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

No output written to JUnit XML files #12189

Open
briceparmentier opened this issue Apr 5, 2024 · 0 comments
Open

No output written to JUnit XML files #12189

briceparmentier opened this issue Apr 5, 2024 · 0 comments
Labels
plugin: junitxml related to the junitxml builtin plugin

Comments

@briceparmentier
Copy link

Hello here!

I'm posting this following another older topic I found about someone having the same issue: #6945, but this was related to a way older version of Pytest than the one I'm running here.
I don't have anything getting written into the captured log of the JUnit XML files running Pytest. Only errors output.

I'm currently running pytest version 8.1.1, and whatever the configuration I try, I'm not getting any output from the tests into my JUnit XML files...
Here is the environment:

(venv) PS C:\workdir\test-env-python> pip list
Package         Version
--------------- -------
colorama        0.4.6
iniconfig       2.0.0
packaging       24.0
pip             24.0
pluggy          1.4.0
pytest          8.1.1
pytest-metadata 3.1.1
win32-setctime  1.1.0

I tried creating a brand new project using only pytest:
./conftest.py

import time

def pytest_configure(config):
    time_str: str = time.strftime('%Y_%m_%d_%Hh%Mm%Ss', time.localtime())
    config.option.xmlpath = f"./_reports/junit/{time_str}.xml"

./feature1/test_feature1.py

def test_feature1():
    print("test feature 1")

Running it with the command pytest -s -o junit_logging=all.

I only get the following XML file:

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
    <testsuite name="pytest" errors="0" failures="0" skipped="0" tests="1" time="0.014" timestamp="2024-04-03T15:37:00.828439" hostname="DCHHHLZ3">
        <testcase classname="feature1.test_feature1" name="test_feature1" time="0.000">
            <system-out>--------------------------------- Captured Log ---------------------------------

--------------------------------- Captured Out ---------------------------------

</system-out>
            <system-err>--------------------------------- Captured Err ---------------------------------

</system-err>
        </testcase>
    </testsuite>
</testsuites>

I also tried removing the conftest.py file and runnign the command pytest -s --junitxml=/path/to/junit.xml", but it didn't change anything...

Any idea?
Am I missing anything?
Thanks a lot in advance.

Brice

@Zac-HD Zac-HD added the plugin: junitxml related to the junitxml builtin plugin label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: junitxml related to the junitxml builtin plugin
Projects
None yet
Development

No branches or pull requests

2 participants