fix: Process return code #4057
15 tests run, 10 passed, 0 skipped, 5 failed.
Annotations
Check failure on line 238 in tests/embedding/test_app.py
github-actions / Test Report 3.11
test_app.test_warning_message
TypeError: '<' not supported between instances of 'str' and 'int'
Raw output
test_env = <conftest.test_env.<locals>.TestEnv object at 0x7f0ad6d47890>
pytestconfig = <_pytest.config.Config object at 0x7f0ad915a6d0>
run_subprocess = <function run_subprocess.<locals>.func at 0x7f0ad6eb7e20>
rootdir = PosixPath('/__w/pymechanical/pymechanical')
@pytest.mark.embedding_scripts
@pytest.mark.python_env
def test_warning_message(test_env, pytestconfig, run_subprocess, rootdir):
"""Test Python.NET warning of the embedded instance using a test-scoped Python environment."""
# Install pymechanical
subprocess.check_call(
[test_env.python, "-m", "pip", "install", "-e", "."],
cwd=rootdir,
env=test_env.env,
)
# Install pythonnet
subprocess.check_call([test_env.python, "-m", "pip", "install", "pythonnet"], env=test_env.env)
# Initialize with pythonnet
embedded_pythonnet_py = os.path.join(rootdir, "tests", "scripts", "pythonnet_warning.py")
> process, stdout, stderr = run_subprocess(
[test_env.python, embedded_pythonnet_py, pytestconfig.getoption("ansys_version")]
)
tests/embedding/test_app.py:238:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ['/__w/pymechanical/pymechanical/tests/.test_env/bin/python', '/__w/pymechanical/pymechanical/tests/scripts/pythonnet_warning.py', '242']
env = None, check = True
def func(args, env=None, check: bool = None):
if check is None:
check = True
if os.name != "nt":
> if version < 251:
E TypeError: '<' not supported between instances of 'str' and 'int'
tests/conftest.py:191: TypeError
Check failure on line 271 in tests/embedding/test_app.py
github-actions / Test Report 3.11
test_app.test_building_gallery
TypeError: '<' not supported between instances of 'str' and 'int'
Raw output
pytestconfig = <_pytest.config.Config object at 0x7f0ad915a6d0>
run_subprocess = <function run_subprocess.<locals>.func at 0x7f0ad6c19440>
rootdir = PosixPath('/__w/pymechanical/pymechanical')
@pytest.mark.embedding_scripts
def test_building_gallery(pytestconfig, run_subprocess, rootdir):
"""Test for building gallery check.
When building the gallery, each example file creates another instance of the app.
When the BUILDING_GALLERY flag is enabled, only one instance is kept.
This is to test the bug fixed in https://github.com/ansys/pymechanical/pull/784
and will fail on PyMechanical version 0.11.0
"""
version = pytestconfig.getoption("ansys_version")
embedded_gallery_py = os.path.join(rootdir, "tests", "scripts", "build_gallery_test.py")
process, stdout, stderr = run_subprocess(
[sys.executable, embedded_gallery_py, version, "False"], None, False
)
stderr = stderr.decode()
# Assert Exception
assert "Cannot have more than one embedded mechanical instance" in stderr
> process, stdout, stderr = run_subprocess([sys.executable, embedded_gallery_py, version, "True"])
tests/embedding/test_app.py:271:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ['/env/bin/python3.11', '/__w/pymechanical/pymechanical/tests/scripts/build_gallery_test.py', '242', 'True']
env = None, check = True
def func(args, env=None, check: bool = None):
if check is None:
check = True
if os.name != "nt":
> if version < 251:
E TypeError: '<' not supported between instances of 'str' and 'int'
tests/conftest.py:191: TypeError
Check failure on line 411 in tests/embedding/test_app.py
github-actions / Test Report 3.11
test_app.test_tempfile_cleanup
TypeError: '<' not supported between instances of 'str' and 'int'
Raw output
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_tempfile_cleanup0')
run_subprocess = <function run_subprocess.<locals>.func at 0x7f0ad6c1af20>
@pytest.mark.embedding_scripts
def test_tempfile_cleanup(tmp_path: pytest.TempPathFactory, run_subprocess):
"""Test cleanup function to remove the temporary mechdb file and folder."""
temp_file = tmp_path / "tempfiletest.mechdb"
temp_folder = tmp_path / "tempfiletest_Mech_Files"
# Make temporary file
temp_file.touch()
# Make temporary folder
temp_folder.mkdir()
# Assert the file and folder exist
assert temp_file.exists()
assert temp_folder.exists()
# Run process
> process, stdout, stderr = run_subprocess(["sleep", "3"])
tests/embedding/test_app.py:411:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ['sleep', '3'], env = None, check = True
def func(args, env=None, check: bool = None):
if check is None:
check = True
if os.name != "nt":
> if version < 251:
E TypeError: '<' not supported between instances of 'str' and 'int'
tests/conftest.py:191: TypeError
Check failure on line 43 in tests/embedding/test_appdata.py
github-actions / Test Report 3.11
test_appdata.test_private_appdata
TypeError: '<' not supported between instances of 'str' and 'int'
Raw output
pytestconfig = <_pytest.config.Config object at 0x7f0ad915a6d0>
run_subprocess = <function run_subprocess.<locals>.func at 0x7f0ad6c1b240>
rootdir = PosixPath('/__w/pymechanical/pymechanical')
@pytest.mark.embedding_scripts
@pytest.mark.python_env
def test_private_appdata(pytestconfig, run_subprocess, rootdir):
"""Test embedded instance does not save ShowTriad using a test-scoped Python environment."""
version = pytestconfig.getoption("ansys_version")
embedded_py = os.path.join(rootdir, "tests", "scripts", "run_embedded_app.py")
> run_subprocess([sys.executable, embedded_py, version, "True", "Set"])
tests/embedding/test_appdata.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ['/env/bin/python3.11', '/__w/pymechanical/pymechanical/tests/scripts/run_embedded_app.py', '242', 'True', 'Set']
env = None, check = True
def func(args, env=None, check: bool = None):
if check is None:
check = True
if os.name != "nt":
> if version < 251:
E TypeError: '<' not supported between instances of 'str' and 'int'
tests/conftest.py:191: TypeError
Check failure on line 57 in tests/embedding/test_appdata.py
github-actions / Test Report 3.11
test_appdata.test_normal_appdata
TypeError: '<' not supported between instances of 'str' and 'int'
Raw output
pytestconfig = <_pytest.config.Config object at 0x7f0ad915a6d0>
run_subprocess = <function run_subprocess.<locals>.func at 0x7f0ad6c1bba0>
rootdir = PosixPath('/__w/pymechanical/pymechanical')
@pytest.mark.embedding_scripts
@pytest.mark.python_env
def test_normal_appdata(pytestconfig, run_subprocess, rootdir):
"""Test embedded instance saves ShowTriad value using a test-scoped Python environment."""
version = pytestconfig.getoption("ansys_version")
embedded_py = os.path.join(rootdir, "tests", "scripts", "run_embedded_app.py")
> run_subprocess([sys.executable, embedded_py, version, "False", "Set"])
tests/embedding/test_appdata.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ['/env/bin/python3.11', '/__w/pymechanical/pymechanical/tests/scripts/run_embedded_app.py', '242', 'False', 'Set']
env = None, check = True
def func(args, env=None, check: bool = None):
if check is None:
check = True
if os.name != "nt":
> if version < 251:
E TypeError: '<' not supported between instances of 'str' and 'int'
tests/conftest.py:191: TypeError