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

Colon as a separator leads to wrong behavior when parsing to JUnit with unity_to_junit.py on Windows #628

Open
RobertZickler opened this issue Jul 14, 2022 · 1 comment

Comments

@RobertZickler
Copy link

Greetings,
when trying to use the python script for converting the test result to JUnit on windows the following happened:
The line split command is looking for : as separator.

On Linux that is working due to path without :. But Windows path always include them: C:/Program/....
So having

delimiter = Literal(':').suppress()
leads with

print(tc_result_line)

to

{
  'tc_file_name': 'C', 
  'tc_line_nr': '\\Path\\To\\My\\File\\test\\test_example.c', 
  'tc_name': '24',
   'tc_status': 'test_AverageThreeBytes_should_AverageMidRangeValues', 
  'tc_msg': 'FAIL'
}

As can be seen, every dict entry is shifted by one. Leading to an wrong behavior.

So I would suggest not using : as a separator or ignoring the first : when parsing on Windows.

Regards
Robert

@RobertZickler RobertZickler changed the title Colon as a separator leads to wrong behavior when parsing to JUnit on Windows Colon as a separator leads to wrong behavior when parsing to JUnit with unity_to_junit.py on Windows Jul 14, 2022
@lukzeg
Copy link

lukzeg commented Mar 30, 2023

Hi @RobertZickler ,

Can you share with me the *.testfail and *.testpass file? I'm asking about this as:


If test.testpass look this way:

C:/zumzum/test_name.c:8:test_case_run_name:PASS

everything should work without any trouble, as the case is handled by:
https://github.com/ThrowTheSwitch/Unity/blob/master/auto/stylize_as_junit.py#L42

            entry_one = Combine(
                oneOf(list(alphas)) + ':/' +
                Word(alphanums + '_-./'))

in case if you have:

C:\\zumzum\\test_name.c:8:test_case_run_name:PASS

The implementation should look:

            entry_one = Combine(
                oneOf(list(alphas)) + ':\\' +
                Word(alphanums + '_-./\\ '))

I will be grateful for the example of *.testfail or *.testpass file.

Kind Regards,
Lucas

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

No branches or pull requests

2 participants