Skip to content

Add meaningful message when an external process prevents tests cleanup #158

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

Merged
merged 1 commit into from
May 25, 2012
Merged

Add meaningful message when an external process prevents tests cleanup #158

merged 1 commit into from
May 25, 2012

Conversation

yorah
Copy link
Contributor

@yorah yorah commented May 25, 2012

Following #141, and the talk that we had on dahlbyk/libgit2sharp@d430855, I added a more meaningful exception message.

@yorah
Copy link
Contributor Author

yorah commented May 25, 2012

Here is an example of the output:

------ Test started: Assembly: LibGit2Sharp.Tests.dll ------

Test 'LibGit2Sharp.Tests.StatusFixture.CanRetrieveTheStatusOfANewRepository' failed: System.IO.IOException :
The directory 'D:\Projects\libgit2sharp\LibGit2Sharp.Tests\bin\Debug\TestRepos\4f6ed241.git' could not be deleted!
Most of the time, this is due to an external process accessing the files in the temporary repositories created during the test runs, and keeping a handle on the directory, thus preventing the deletion of those files.
Known and common causes include:

  • Windows Search Indexer (go to the Indexing Options, in the Windows Control Panel, and exclude the bin folder of LibGit2Sharp.Tests)
  • Antivirus (exclude the bin folder of LibGit2Sharp.Tests from the paths scanned by your real-time antivirus)

---- System.IO.IOException : The directory is not empty.

TestHelpers\DirectoryHelper.cs(56,0): at LibGit2Sharp.Tests.TestHelpers.DirectoryHelper.DeleteDirectory(String directoryPath)
TestHelpers\DirectoryHelper.cs(46,0): at LibGit2Sharp.Tests.TestHelpers.DirectoryHelper.DeleteDirectory(String directoryPath)
TestHelpers\BaseFixture.cs(84,0): at LibGit2Sharp.Tests.TestHelpers.BaseFixture.Dispose()
at Xunit.Sdk.LifetimeCommand.Execute(Object testClass)
at Xunit.Sdk.ExceptionAndOutputCaptureCommand.Execute(Object testClass)
----- Inner Stack Trace -----
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.DeleteHelper(String fullPath, String userPath, Boolean recursive)
at System.IO.Directory.Delete(String fullPath, String userPath, Boolean recursive)
at System.IO.Directory.Delete(String path, Boolean recursive)
TestHelpers\DirectoryHelper.cs(52,0): at LibGit2Sharp.Tests.TestHelpers.DirectoryHelper.DeleteDirectory(String directoryPath)

@nulltoken nulltoken merged commit d0f541b into libgit2:vNext May 25, 2012
@nulltoken
Copy link
Member

@yorah Thanks!

@dahlbyk This one is for you ;p

@dahlbyk
Copy link
Member

dahlbyk commented May 25, 2012

❤️

@nulltoken
Copy link
Member

Released as part of v0.9.5

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

Successfully merging this pull request may close these issues.

3 participants