Skip to content

Commit

Permalink
update inedo.sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
gdivis committed May 3, 2022
1 parent f7fe94d commit d9de594
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Python/InedoExtension/InedoExtension.csproj
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net452;net5.0</TargetFrameworks>
<TargetFramework>net6.0</TargetFramework>
<OutputType>Library</OutputType>
<RootNamespace>Inedo.Extensions.Python</RootNamespace>
<AssemblyName>Python</AssemblyName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Inedo.SDK" Version="1.11.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Inedo.SDK" Version="2.0.0-ci.18" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="BuildMasterTestRunner.py" />
Expand Down
Expand Up @@ -27,7 +27,8 @@ public override async Task ExecuteAsync(IOperationExecutionContext context)
WorkingDirectory = context.WorkingDirectory
};

startInfo.Arguments += AH.ConcatNE(" ", this.AdditionalArguments);
if (!string.IsNullOrWhiteSpace(this.AdditionalArguments))
startInfo.Arguments += this.AdditionalArguments;

await this.WrapInVirtualEnv(context, startInfo);

Expand Down
3 changes: 2 additions & 1 deletion Python/InedoExtension/Operations/InstallPackagesOperation.cs
Expand Up @@ -35,7 +35,8 @@ public override async Task ExecuteAsync(IOperationExecutionContext context)
startInfo.Arguments += " -r requirements.txt";
}

startInfo.Arguments += AH.ConcatNE(" ", this.AdditionalArguments);
if (!string.IsNullOrWhiteSpace(this.AdditionalArguments))
startInfo.Arguments += this.AdditionalArguments;

await this.WrapInVirtualEnv(context, startInfo);
await this.ExecuteCommandLineAsync(context, startInfo);
Expand Down
16 changes: 12 additions & 4 deletions Python/InedoExtension/Operations/PyUnitOperation.cs
Expand Up @@ -86,9 +86,9 @@ string getTestLog(IGrouping<TestCaseID, TestEvent> test)
var skipReason = test.FirstOrDefault(e => e.Type == EventType.Skip)?.Message;
var exceptions = test.Select(e => e.Err).Where(e => e != null).ToArray();

return "Test: " + test.Key.ID + AH.ConcatNE("\n", test.Key.Desc) +
"\n\nResult: " + AH.CoalesceString(result, "Unknown") + AH.ConcatNE(" (", skipReason, ")") +
AH.ConcatNE("\n\nOutput:\n", stdout) + AH.ConcatNE("\n\nError:\n", stderr) +
return "Test: " + test.Key.ID + ConcatNE("\n", test.Key.Desc) +
"\n\nResult: " + AH.CoalesceString(result, "Unknown") + ConcatNE(" (", skipReason, ")") +
ConcatNE("\n\nOutput:\n", stdout) + ConcatNE("\n\nError:\n", stderr) +
(exceptions.Any() ? "\n\nExceptions:\n\n" + string.Join("\n\n", exceptions) : string.Empty) +
"\n";
}
Expand All @@ -104,6 +104,14 @@ TimeSpan getDuration(IGrouping<TestCaseID, TestEvent> test)
var end = (test.FirstOrDefault(e => e.Type == EventType.StopCase) ?? test.Last()).Time;
return TimeSpan.FromSeconds(end - start);
}

static string ConcatNE(string a, string b, string c = "")
{
if (!string.IsNullOrEmpty(b))
return a + b + c;
else
return string.Empty;
}
}

private async Task RunTestsAsync(IOperationExecutionContext context)
Expand Down Expand Up @@ -150,7 +158,7 @@ protected override void LogProcessOutput(string text)
{
if (text.StartsWith("__BuildMasterPythonTestRunner__"))
{
this.Events.Add(JsonConvert.DeserializeObject<TestEvent>(text.Substring("__BuildMasterPythonTestRunner__".Length)));
this.Events.Add(JsonConvert.DeserializeObject<TestEvent>(text["__BuildMasterPythonTestRunner__".Length..]));
return;
}

Expand Down

0 comments on commit d9de594

Please sign in to comment.