Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 22, 2023. It is now read-only.
/pythonnetPublic archive
forked frompythonnet/pythonnet

Commite200cae

Browse files
committed
Add PYTHONPATH/PYTHONHOME default value tests
Current tests crash on 64bit python on windows, and resultsget truncated on Linux.When working, PYTHONHOME should match ENV VAR if set.AppVeyor has been updated to test against not blank
1 parent6f3f357 commite200cae

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

‎appveyor.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ init:
2727
# Put desired Python version first in PATH
2828
-set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%
2929

30+
# Needed for test `GetPythonHomeDefault`
31+
-set PYTHONHOME=%PYTHON%
32+
3033
install:
3134
-pip install --upgrade -r requirements.txt --quiet
3235

‎src/embed_tests/TestPythonEngineProperties.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,44 @@ public static void GetVersionDoesntCrash()
6666
Assert.IsTrue(s.Contains(","));
6767
}
6868
}
69+
70+
[Test]
71+
publicstaticvoidGetPythonPathDefault()
72+
{
73+
PythonEngine.Initialize();
74+
strings=PythonEngine.PythonPath;
75+
76+
StringAssert.Contains("python",s.ToLower());
77+
PythonEngine.Shutdown();
78+
}
79+
80+
[Test]
81+
publicstaticvoidGetProgramNameDefault()
82+
{
83+
PythonEngine.Initialize();
84+
strings=PythonEngine.PythonHome;
85+
86+
Assert.NotNull(s);
87+
PythonEngine.Shutdown();
88+
}
89+
90+
/// <summary>
91+
/// Test default behavior of PYTHONHOME. If ENVVAR is set it will
92+
/// return the same value. If not, returns EmptyString.
93+
/// </summary>
94+
/// <remarks>
95+
/// AppVeyor.yml has been update to tests with ENVVAR set.
96+
/// </remarks>
97+
[Test]
98+
publicstaticvoidGetPythonHomeDefault()
99+
{
100+
stringenvPythonHome=Environment.GetEnvironmentVariable("PYTHONHOME")??"";
101+
102+
PythonEngine.Initialize();
103+
stringenginePythonHome=PythonEngine.PythonHome;
104+
105+
Assert.AreEqual(envPythonHome,enginePythonHome);
106+
PythonEngine.Shutdown();
107+
}
69108
}
70109
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp