nunit-core team mailing list archive
-
nunit-core team
-
Mailing list archive
-
Message #02859
[Bug 1029785] Re: Test loaded from remote folder failed to run with exception System.IODirectory Not Found .
** Attachment added: "RunFailed.PNG"
https://bugs.launchpad.net/bugs/1029785/+attachment/3238062/+files/RunFailed.PNG
** Description changed:
When we load test from remote machine folder as
- \\MachineName\TestFolderName load test project Successfully. But when I
- tried to run same tests it throws exception as follow
+ \\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 are as follow
+ 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)
+ public static string GetAssemblyPath(Type type)
{
- 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;
+ return GetAssemblyPath(type.Assembly);
}
- #endregion
+ public static string GetAssemblyPath(Assembly assembly)
+ {
+ string path = assembly.CodeBase;
+ Uri uri = new Uri(path);
- #region GetDirectoryName
- public static string GetDirectoryName( Assembly assembly )
- {
- return System.IO.Path.GetDirectoryName(GetAssemblyPath(assembly));
- }
- #endregion
+ // 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
+
+
+ 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(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
+ public static string GetAssemblyPath(Assembly assembly)
+ {
+ string uri = assembly.CodeBase;
- #region
+ if (IsFileUri(uri))
+ return GetAssemblyPathFromFileUri(uri);
+ else
+ return assembly.Location;
+ }
- // Public for testing purposes
- public static string GetAssemblyPathFromFileUri(string uri)
- {
- // Skip over the file://
- int start = Uri.UriSchemeFile.Length + Uri.SchemeDelimiter.Length;
+ #endregion
- 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;
- }
+ #region
- return uri.Substring(start);
- }
+ // Public for testing purposes
+ public static string GetAssemblyPathFromFileUri(string uri)
+ {
+ // Skip over the file://
+ int start = Uri.UriSchemeFile.Length + Uri.SchemeDelimiter.Length;
- #endregion
+ 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;
+ }
- #region GetDirectoryName
- public static string GetDirectoryName( Assembly assembly )
- {
- return System.IO.Path.GetDirectoryName(GetAssemblyPath(assembly));
- }
- #endregion
+ return uri.Substring(start);
+ }
- #region Helper Methods
+ #endregion
- private static bool IsFileUri(string uri)
- {
- return uri.ToLower().StartsWith(Uri.UriSchemeFile);
- }
+ #region GetDirectoryName
+ public static string GetDirectoryName( Assembly assembly )
+ {
+ return System.IO.Path.GetDirectoryName(GetAssemblyPath(assembly));
+ }
+ #endregion
- #endregion
+ #region Helper Methods
+
+ private static bool IsFileUri(string uri)
+ {
+ return uri.ToLower().StartsWith(Uri.UriSchemeFile);
+ }
+
+ #endregion
--
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 V2 Test Framework:
New
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/nunitv2/+bug/1029785/+subscriptions
Follow ups
References