### UnitTest & code coverage

44
views
1
11 days ago by
Hi!
I'm trying to set up test execution.
There is a difficult moment. Tests must be performed to configure code coverage for my application Mebel.exe, which is already a Python interpreter. Wing does not allow me to select it as an interpreter because the name must be *python*. Can I somehow to configure the execution of unit testing by calling my interpreter is named mebel.exe?

Thank You!
Community: Wing Python IDE
I made my app start using the launch configuration.
But yet I get the error.

Traceback (most recent call last):
File "C:\Program Files (x86)\Wing IDE 6.0\src/testing/runners/run_unittests_xml.py", line 177, in <module>
main(list(sys.argv))
File "C:\Program Files (x86)\Wing IDE 6.0\src/testing/runners/run_unittests_xml.py", line 87, in main
xmlout = wingtest_common.CreateOutputStream(argv)
File "C:\Program Files (x86)\Wing IDE 6.0\src/testing/runners\wingtest_common.py", line 689, in CreateOutputStream
xmlout = xml_stream_cls(raw_stream)
File "C:\Program Files (x86)\Wing IDE 6.0\src/testing/runners\wingtest_common.py", line 101, in __init__
self.write_raw('<%s>' % self._top_tag)
File "C:\Program Files (x86)\Wing IDE 6.0\src/testing/runners\wingtest_common.py", line 154, in write_raw
self._raw_stream.write(s)
TypeError: must be str, not bytes
Python: Ошибка запуска скрипта C:\Program Files (x86)\Wing IDE 6.0\src/testing/runners/run_unittests_xml.py​
written 11 days ago by Alexander Dragunkin
Does it do the same thing if you debug the test from the Testing tool instead?  If so, what is in s?  It should just be an ascii tag name so the error is not yet making sense to me.
written 11 days ago by Wingware Support
Error on the side of my application. I will look for solutions.
written 11 days ago by Alexander Dragunkin

### 2 Answers

2
11 days ago by
It should be possible to pick any file for the Python Executable, even if named something like mebel.exe.  Wing then tries to run it to validate that it's Python and shows errors if it's not.  From your comment it sounds like you got that working.  I'll follow up on the second problem above.
0
9 days ago by
Hi!

I want to understand if I can use the tests tool of the Wing IDE to run test programs in my application. I can run TestRuner.py from the Windows command prompt, run the following code.

So I can run the same code by configuring the "OS Commands" tool in the appropriate configuration.

I want to use the "Testing" tool to get a report in the corresponding WIng IDE window, but I don't think I can configure it correctly.

Maybe I'm asking stupid questions! Please forgive me!

Thank you for any tips on how to organize unit testing with code coverage by my app.

I think if you set Python Options (below Python Executable, same dialog/tab) to -m it'll run with the same arguments as from command line or OS Commands.

However, I don't know what test framework is being used.  If it's unittest, doctest, nose, or pytest then Wing should be able to run the test from the Testing tool.  If it's something else then a new test runner would be needed.  You can see the existing ones in src/testing/runners in your Wing installation, in case that helps any.
written 9 days ago by Wingware Support
Please login to add an answer/comment or follow this question.

Similar posts:
Search »