X Tutup
Skip to content

Commit dcee879

Browse files
committed
my runtime project
1 parent 53b5235 commit dcee879

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

src/perf_tests/Python.PerformanceTests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
3535
</ItemGroup>
3636

37+
<ItemGroup>
38+
<ProjectReference Include="..\runtime\Python.Runtime.csproj" />
39+
</ItemGroup>
40+
3741
<Target Name="GetRuntimeLibBuildOutput" BeforeTargets="Build">
3842
<MSBuild Projects="..\runtime\Python.Runtime.csproj" Properties="OutputPath=bin\for_perf\;Configuration=Release;TargetFramework=netstandard2.0" Targets="Build">
3943
<Output TaskParameter="TargetOutputs" ItemName="NewPythonRuntime" />

src/python_tests_runner/PythonTestRunner.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,28 @@ namespace Python.PythonTestsRunner
1414
{
1515
public class PythonTestRunner
1616
{
17+
private void AddEnvPath(params string[] paths)
18+
{
19+
// PC에 설정되어 있는 환경 변수를 가져온다.
20+
var envPaths = Environment.GetEnvironmentVariable("PATH").Split(Path.PathSeparator).ToList();
21+
// 중복 환경 변수가 없으면 list에 넣는다.
22+
envPaths.InsertRange(0, paths.Where(x => x.Length > 0 && !envPaths.Contains(x)).ToArray());
23+
// 환경 변수를 다시 설정한다.
24+
Environment.SetEnvironmentVariable("PATH", string.Join(Path.PathSeparator.ToString(), envPaths), EnvironmentVariableTarget.Process);
25+
Environment.SetEnvironmentVariable("PYTHONNET_PYDLL", "python38.dll");
26+
}
27+
1728
[OneTimeSetUp]
1829
public void SetUp()
1930
{
31+
string python_dir = @"D:\Utility\Python38";
32+
var PYTHON_HOME = Environment.ExpandEnvironmentVariables(python_dir);
33+
34+
// 환경 변수 설정
35+
AddEnvPath(PYTHON_HOME);
36+
37+
PythonEngine.PythonHome = PYTHON_HOME;
38+
Environment.SetEnvironmentVariable("PYTHONNET_PYDLL", "python38.dll");
2039
PythonEngine.Initialize();
2140
}
2241

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"profiles": {
3+
"Python.Test": {
4+
"commandName": "Project"
5+
}
6+
}
7+
}

0 commit comments

Comments
 (0)
X Tutup