Skip to content

Commit bb2a110

Browse files
authored
[azsdkcli] python test runner (#12558)
* create venv? * this * update to return a bool * assume a pre-req is that the package and dev-reqs are installed * revert
1 parent 8e710a2 commit bb2a110

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/ServiceRegistrations.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static void RegisterCommonServices(IServiceCollection services, OutputHel
5353
services.AddLanguageSpecific<ITestRunner>(new LanguageSpecificImplementations
5454
{
5555
JavaScript = typeof(JavaScriptTestRunner),
56+
Python = typeof(PythonTestRunner),
5657
});
5758

5859
// Helper classes
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Azure.Sdk.Tools.Cli.Helpers;
2+
using Azure.Sdk.Tools.Cli.Models;
3+
4+
namespace Azure.Sdk.Tools.Cli.Services.Tests;
5+
6+
public class PythonTestRunner(IProcessHelper processHelper) : ITestRunner
7+
{
8+
public async Task<bool> RunAllTests(string packagePath, CancellationToken ct = default)
9+
{
10+
var result = await processHelper.Run(new ProcessOptions(
11+
command: "pytest",
12+
args: ["tests"],
13+
workingDirectory: packagePath
14+
),
15+
ct
16+
);
17+
18+
return result.ExitCode == 0;
19+
}
20+
}

0 commit comments

Comments
 (0)