0

Unable to generate junit xml file correctly, after a failure generation of the file stops and no further tests are executed. The command works without the junit argument. I have also tried adding '-o junit_family=xunit1' but this did not resolve the issue. We are using Python 3.10.6, pytest-8.2.2, but this failed also on pytest 6.2.5.

pytest ci_common_test_suite.py -m "trial" --yamlFile=/home/my_g34_sim2.yaml --junit-xml=/home/my_g34_sim2_junit.xml --log-level=DEBUG  --getBuildInfo=no  --htmlreport=./reports/summary_criticalresult.html -s --update_jira_for_sanity yes; echo pytest_result: $?
pytest_result: $?
2024-07-10 04:32:46,312 pysnmp: running pysnmp version 5.0.3
============================= test session starts ==============================
platform linux -- Python 3.10.6, pytest-8.2.2, pluggy-1.5.0
Test order randomisation NOT enabled. Enable with --random-order or --random-order-bucket=<bucket_type>
rootdir: /home/vagupta/new/chassisx-g30
plugins: flaky-3.8.1, assume-2.4.3, pace-2024.6.13, metadata-2.0.4, order-1.2.1, random-order-1.0.4
collected 9 items / 8 deselected / 1 selected
 
src/scripts/sanity/testscripts/ci_common_suite/ci_common_test_suite.py 2024-07-10 04:32:51,903:[GX-42748]:[PASS]:show user  : {Contains: ['user-admin']}
2024-07-10 04:32:52,288:[GX-42748]:[PASS]:add user-testadmin password !@#$%^&*(  : {DoesnotContain: ['ERROR']}
2024-07-10 04:33:17,883:[GX-42748]:[FAIL]:show user  : {Contains: ['user-testadmin2', 'user-admin']}
2024-07-10 04:33:17,884:[GX-42748]:[FAIL]:Output=
 
user            user-group  display-name  max-invalid-login  suspension-time (minutes)  timeout (minutes)  password-aging-interval (days)  password-expiration-date  enabled  user-status  force-password-change  max-sessions  last-login-date       failed-logins  user-aaa-type  alarm-report-control  label
--------------  ----------  ------------  -----------------  -------------------------  -----------------  ------------------------------  ------------------------  -------  -----------  ---------------------  ------------  --------------------  -------------  -------------  --------------------  -----
user-admin      EA,NA,SA                  5                  5                          60                 0                               2100-01-01T00:00:00Z      true     enabled      false                  10            2024-07-10T04:31:20Z  0              local          allowed             
user-testadmin  MA                        5                  5                          60                 90                              2024-10-08T00:00:00Z      true     enabled      false                  10            1970-01-01T00:00:00Z  0              local          allowed             
 
 
[ ne ]
admin@GX>
 
2024-07-10 04:33:18,076:[GX-42748]:[PASS]:delete -f user-testadmin  : {DoesnotContain: ['ERROR']}
F
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/main.py", line 285, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/main.py", line 339, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/logging.py", line 807, in pytest_runtestloop
INTERNALERROR>     return (yield)  # Run all the tests.
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/main.py", line 364, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 182, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_result.py", line 100, in get_result
INTERNALERROR>     raise exc.with_traceback(exc.__traceback__)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR>     teardown.throw(outcome._exception)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/warnings.py", line 111, in pytest_runtest_protocol
INTERNALERROR>     return (yield)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR>     teardown.throw(outcome._exception)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/assertion/__init__.py", line 176, in pytest_runtest_protocol
INTERNALERROR>     return (yield)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR>     teardown.throw(outcome._exception)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/unittest.py", line 422, in pytest_runtest_protocol
INTERNALERROR>     res = yield
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR>     teardown.throw(outcome._exception)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/faulthandler.py", line 85, in pytest_runtest_protocol
INTERNALERROR>     return (yield)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/flaky/flaky_pytest_plugin.py", line 89, in pytest_runtest_protocol
INTERNALERROR>     self.runner.pytest_runtest_protocol(item, nextitem)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/runner.py", line 116, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/runner.py", line 135, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/flaky/flaky_pytest_plugin.py", line 165, in call_and_report
INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/junitxml.py", line 593, in pytest_runtest_logreport
INTERNALERROR>     reporter.append_failure(report)
INTERNALERROR>   File "/usr/local/lib/python3.10/site-packages/_pytest/junitxml.py", line 203, in append_failure
INTERNALERROR>     assert report.longrepr is not None
INTERNALERROR> AssertionError
2024-07-10 04:33:21,316:[GX-42748]:[PASS]:show alarm -a  : {}
2024-07-10 04:33:21,390:[GX-42748]:[PASS]:show inventory  : {}
rsync
2024-07-10 04:33:22,880:[GX-42748]:[PASS]:shell  : {}
2024-07-10 04:33:22,982:[GX-42748]:[PASS]:ls -ltr /var/lib/systemd/coredump/  : {}
total 0
admin@frcu-1-12:~$
2024-07-10 04:33:23,116:[GX-42748]:[PASS]:if ls -1qA /var/lib/systemd/coredump/ | grep -q .; then  echo NOT EMPTY; else  echo EMPTY; fi  : {}
2024-07-10 04:33:23,251:[GX-42748]:[PASS]:NIL  : NIL
 
================ 1 failed, 8 deselected, 21 warnings in 35.49s =================
pytest_result: 3

0

Browse other questions tagged or ask your own question.