nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #03223
[Bug 1029785] Re: Test loaded from remote folder failed to run with exception System.IODirectory Not Found .
** Changed in: nunitlite
Milestone: None => 0.9
--
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1029785
Title:
Test loaded from remote folder failed to run with exception
System.IODirectory Not Found .
Status in NUnit Test Framework:
Triaged
Status in NUnitLite Testing Framework:
Triaged
Status in NUnit V2 Test Framework:
Fix Released
Bug description:
When we load test from remote machine folder as
\\MachineName\TestFolderName project loads successfully.But when I
tried to run same tests it throws exception as follow
System.IODirectory Not Found :Could Not Found Part of the Path
'D:\NUnitProject\bin\Debug\MachineName\TestFolderName'.
Above scenario was working fine in NUnit-2.5.10.11092. When I tried to find out cause of this issue ,I find that there are changes in
NUnit.Core.AssemblyHelper class.Differnces between these two versions are as follow
NUnit-2.5.10.11092
public static string GetAssemblyPath(Type type)
{
return GetAssemblyPath(type.Assembly);
}
public static string GetAssemblyPath(Assembly assembly)
{
string path = assembly.CodeBase;
Uri uri = new Uri(path);
// If it wasn't loaded locally, use the Location
if (!uri.IsFile)
return assembly.Location;
if (uri.IsUnc)
return path.Substring(Uri.UriSchemeFile.Length + 1);
return uri.LocalPath;
}
public static string GetDirectoryName( Assembly assembly )
{
return System.IO.Path.GetDirectoryName(GetAssemblyPath(assembly));
}
Whereas the code in NUnit version 2.6 is as follow
#region GetAssemblyPath
public static string GetAssemblyPath(Type type)
{
return GetAssemblyPath(type.Assembly);
}
public static string GetAssemblyPath(Assembly assembly)
{
string uri = assembly.CodeBase;
if (IsFileUri(uri))
return GetAssemblyPathFromFileUri(uri);
else
return assembly.Location;
}
#endregion
#region
// Public for testing purposes
public static string GetAssemblyPathFromFileUri(string uri)
{
// Skip over the file://
int start = Uri.UriSchemeFile.Length + Uri.SchemeDelimiter.Length;
if (System.IO.Path.DirectorySeparatorChar == '\\')
{
// Handle Windows Drive specifications
if (uri[start] == '/' && uri[start + 2] == ':')
++start;
}
else
{
// Assume all Linux paths are absolute
if (uri[start] != '/')
--start;
}
return uri.Substring(start);
}
#endregion
#region GetDirectoryName
public static string GetDirectoryName( Assembly assembly )
{
return System.IO.Path.GetDirectoryName(GetAssemblyPath(assembly));
}
#endregion
#region Helper Methods
private static bool IsFileUri(string uri)
{
return uri.ToLower().StartsWith(Uri.UriSchemeFile);
}
#endregion
To manage notifications about this bug go to:
https://bugs.launchpad.net/nunit-3.0/+bug/1029785/+subscriptions
References