Re: nunit tests hold onto file handles after tests aredone
"Charlie Poole" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <004101c8d237$bad14410$6401a8c0@ferrari> |
Hi David, Yeah... if only we had a FAQ. :-( NUnit does have some current problems of not releasing objects, which are fixed in the source. Some of those /could/ relate to your file problems, but there really is no guarantee that files not closed explicitly will be closed between NUnit runs. This makes some kinds of applications a bit hard to test. The simplest way to do what you want for a test directory is to delete and recreate it in SetUp or TestFixtureSetUp. In that case, it will always be there between tests, whether they pass or not. If you additionally want to delete some files when the tests pass, you currently have to put the delete at the end of each test. Charlie _____ From: [email protected] [mailto:[email protected]] On Behalf Of David Jeske Sent: Thursday, June 19, 2008 1:21 AM To: [email protected] Subject: [Nunit-users] nunit tests hold onto file handles after tests aredone Thanks for NUnit. I'm new to using it, and I have a problem which seems so common it must be a FAQ, but I don't see it mentioned anywhere... I have a number of tests which run code that open and write to files. When my program exits it lets go of the filelocks just fine. However, when the tests run in Nunit GUI (and I keep the GUI up), the files are still locked, preventing me from inspecting their contents. Every time I run a set of tests I have to control-P to reload the project to force NUnit to flush the objects and cause the file locks to be released. This seems like such a common thing that I'm surprised there isn't an option "force full GC after testing" that would cause all the objects to be disposed. Am I doing something wrong? On a related note, those same tests need a nice way to create a temporary directory to write to, and delete the directory if the test passes but leave it if the test fails. Seems like this would be pretty common, but I couldn't find any methods or addons that do this. Am I looking in the wrong places? Thanks! (and thanks for nunit) - David ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Nunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nunit-users