From b3e1a819070f5998399824913decdc5a625b237f Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Wed, 4 Oct 2023 21:15:29 +0200 Subject: [PATCH] Provide target framework as an envvar to tests. (#84) --- Turkey/Program.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Turkey/Program.cs b/Turkey/Program.cs index 6152698..957a5aa 100644 --- a/Turkey/Program.cs +++ b/Turkey/Program.cs @@ -85,6 +85,7 @@ public static async Task Run(string testRoot, Cleaner cleaner = new Cleaner(); DotNet dotnet = new DotNet(); + Version runtimeVersion = dotnet.LatestRuntimeVersion; TestOutput defaultOutput = new TestOutputFormats.NewOutput(); @@ -101,19 +102,21 @@ public static async Task Run(string testRoot, var sanitizer = new EnvironmentVariableSanitizer(); var envVars = sanitizer.SanitizeCurrentEnvironmentVariables(); - var traits = CreateTraits(dotnet.LatestRuntimeVersion, dotnet.LatestSdkVersion, platformIds, dotnet.IsMonoRuntime(dotnet.LatestRuntimeVersion), trait); + var traits = CreateTraits(runtimeVersion, dotnet.LatestSdkVersion, platformIds, dotnet.IsMonoRuntime(runtimeVersion), trait); Console.WriteLine($"Tests matching these traits will be skipped: {string.Join(", ", traits.OrderBy(s => s))}."); + envVars["TestTargetFramework"] = $"net{runtimeVersion.Major}.{runtimeVersion.Minor}"; + SystemUnderTest system = new SystemUnderTest( dotnet, - runtimeVersion: dotnet.LatestRuntimeVersion, + runtimeVersion: runtimeVersion, sdkVersion: dotnet.LatestSdkVersion, platformIds: platformIds, environmentVariables: envVars, traits: traits ); - Version packageVersion = dotnet.LatestRuntimeVersion; + Version packageVersion = runtimeVersion; string nuGetConfig = await GenerateNuGetConfigIfNeededAsync(additionalFeed, packageVersion, useSourceBuildNuGetConfig: false); if (verbose && nuGetConfig != null)