[IronPython] Descriptive reports in unittest module
I am using the unittest module in IronPython 2.0. My TestClass has a function named testLoginWithInvalidUsername. I would like to attach a string to this function so that if the test fails, the string would be printed as: Failed : Testing the login functionality with invalid user name I am not asking for something that will automatically figure out the string to be printed. I am looking for a way for me to attach an attribute to the test function so that the string in the attribute gets printed. Is there something readily avaliable for doing this? Currently my test report comes out as: testDateDiffWeek (PI.GetMessages.GetMessagesTestClass) ... ok testGetMessageGUIDnull (PI.GetMessages.GetMessagesTestClass) ... FAIL Thanks, Yash ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] Modules importing each other
I use IronPython 2.0. In Program.py I have: print hello DEBUGMODE=0 . . . import LogMessage In LogMessage.py I have from Program import DEBUGMODE When I run : ipy Program.py I observe that hello is printed twice: Once when Program.py is run and next when a symbol from Program.py is imported in LogMessage. If one module imports another, does it execute all statements in it even if that module has been loaded before? What do I need to do to avoid it? Program.py and LogMessage.py are both in the same folder. Thanks, Yash ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] Does IronPython 2.0 not recognize packages?
Michael Foord wrote This will cause Python to expect the name 'Authentication' to exist in the '__init__.py' file itself - which it won't unless that module imports it. I am pretty new to Python. I put the following in __init__.py import Authentication __all__ = [Authentication] I still get the error: Traceback (most recent call last): File Program.py, line 22, in Program.py File mscorlib, line unknown, in get_Item File mscorlib, line unknown, in ThrowKeyNotFoundException KeyError: The given key was not present in the dictionary. Thanks, Yash - Yash Ganthe wrote: I am using IronPython 2.0 Release Candidate 2 Packages work fine with IronPython 2. ipy Program.py Traceback (most recent call last): File Program.py, line 22, in Program.py File mscorlib, line unknown, in get_Item File mscorlib, line unknown, in ThrowKeyNotFoundException KeyError: The given key was not present in the dictionary. Line 22 where it fails has: from PI import * I expect all modules from the PI folder to be loaded. The PI folder has __init__.py which has the following line: __all__ = [Authentication] This will cause Python to expect the name 'Authentication' to exist in the '__init__.py' file itself - which it won't unless that module imports it. Authentication.py is in the PI folder. I replaced the erring line with : sys.path.append(r'.\PI') from Authentication import * This is *very* different to having __all__ = [Authentication] in the module. Try it without the sys.path manipulation and I think you will find it still works. All the best, Michael Foord ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
[IronPython] app.config for ipy script?
I would like to invoke WCF service and hence would like to define the endpoints in a config file. If I am running the python script as : C:\Mytestsipy program.py Where should the app.config file be placed? Thanks, Yash ___ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com