feat: add globals
kwarg to app and adjust ideconfig
behavior
#5516
GitHub Actions / Test Report 3.11
failed
Jan 30, 2025 in 0s
18 tests run, 15 passed, 0 skipped, 3 failed.
Annotations
Check failure on line 492 in tests/embedding/test_app.py
github-actions / Test Report 3.11
test_app.test_attribute_error
AssertionError: assert 'Unable to resolve Mechanical assemblies.' in 'usage: run_embedded_app.py [-h] [--version VERSION]\n [--private_appdata PRIVATE_APPDATA]\n [--action ACTION] [--update_globals UPDATE_GLOBALS]\n [--debug]\nrun_embedded_app.py: error: unrecognized arguments: 251\n'
+ where 'usage: run_embedded_app.py [-h] [--version VERSION]\n [--private_appdata PRIVATE_APPDATA]\n [--action ACTION] [--update_globals UPDATE_GLOBALS]\n [--debug]\nrun_embedded_app.py: error: unrecognized arguments: 251\n' = <built-in method decode of bytes object at 0x7f2173536470>()
+ where <built-in method decode of bytes object at 0x7f2173536470> = b'usage: run_embedded_app.py [-h] [--version VERSION]\n [--private_appdata PRIVATE_APPDATA]\n [--action ACTION] [--update_globals UPDATE_GLOBALS]\n [--debug]\nrun_embedded_app.py: error: unrecognized arguments: 251\n'.decode
Raw output
tmp_path = PosixPath('/tmp/pytest-of-root/pytest-0/test_attribute_error0')
pytestconfig = <_pytest.config.Config object at 0x7f21757a2d10>
rootdir = PosixPath('/__w/pymechanical/pymechanical')
run_subprocess = <function run_subprocess.<locals>.func at 0x7f2173485f80>
@pytest.mark.embedding_scripts
def test_attribute_error(tmp_path: pytest.TempPathFactory, pytestconfig, rootdir, run_subprocess):
"""Test cleanup function to remove the temporary mechdb file and folder."""
# Change directory to tmp_path
os.chdir(tmp_path)
# Get the version
version = pytestconfig.getoption("ansys_version")
# Create the Ansys folder in tmp_path and assert it exists
temp_folder = tmp_path / "Ansys"
temp_folder.mkdir()
assert temp_folder.exists()
# Copy the run_embedded_app.py script to tmp_path
embedded_py = os.path.join(rootdir, "tests", "scripts", "run_embedded_app.py")
tmp_file_script = tmp_path / "run_embedded_app.py"
shutil.copyfile(embedded_py, tmp_file_script)
# Run the script and assert the AttributeError is raised
stdout, stderr = subprocess.Popen(
[sys.executable, tmp_file_script, version], stdout=subprocess.PIPE, stderr=subprocess.PIPE
).communicate()
# Assert the AttributeError is raised
> assert "Unable to resolve Mechanical assemblies." in stderr.decode()
E AssertionError: assert 'Unable to resolve Mechanical assemblies.' in 'usage: run_embedded_app.py [-h] [--version VERSION]\n [--private_appdata PRIVATE_APPDATA]\n [--action ACTION] [--update_globals UPDATE_GLOBALS]\n [--debug]\nrun_embedded_app.py: error: unrecognized arguments: 251\n'
E + where 'usage: run_embedded_app.py [-h] [--version VERSION]\n [--private_appdata PRIVATE_APPDATA]\n [--action ACTION] [--update_globals UPDATE_GLOBALS]\n [--debug]\nrun_embedded_app.py: error: unrecognized arguments: 251\n' = <built-in method decode of bytes object at 0x7f2173536470>()
E + where <built-in method decode of bytes object at 0x7f2173536470> = b'usage: run_embedded_app.py [-h] [--version VERSION]\n [--private_appdata PRIVATE_APPDATA]\n [--action ACTION] [--update_globals UPDATE_GLOBALS]\n [--debug]\nrun_embedded_app.py: error: unrecognized arguments: 251\n'.decode
/__w/pymechanical/pymechanical/tests/embedding/test_app.py:492: AssertionError
Check failure on line 43 in tests/embedding/test_appdata.py
github-actions / Test Report 3.11
test_appdata.test_private_appdata
SystemExit: child failed with '2' exit code
Raw output
pytestconfig = <_pytest.config.Config object at 0x7f21757a2d10>
run_subprocess = <function run_subprocess.<locals>.func at 0x7f2173487060>
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"])
/__w/pymechanical/pymechanical/tests/embedding/test_appdata.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/__w/pymechanical/pymechanical/tests/conftest.py:194: in func
process, output = ansys.mechanical.core.run._run(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ['/env/bin/python3.11', '/__w/pymechanical/pymechanical/tests/scripts/run_embedded_app.py', '251', 'True', 'Set']
env = None, check = True, display = False
def _run(args, env, check=False, display=False):
if os.name == "nt":
loop = asyncio.ProactorEventLoop() # for subprocess' pipes on Windows
asyncio.set_event_loop(loop)
else:
loop = asyncio.get_event_loop()
try:
rc, process, *output = loop.run_until_complete(_read_and_display(args, env, display))
if rc and check:
> sys.exit("child failed with '{}' exit code".format(rc))
E SystemExit: child failed with '2' exit code
/__w/pymechanical/pymechanical/src/ansys/mechanical/core/run.py:83: SystemExit
Check failure on line 57 in tests/embedding/test_appdata.py
github-actions / Test Report 3.11
test_appdata.test_normal_appdata
SystemExit: child failed with '2' exit code
Raw output
pytestconfig = <_pytest.config.Config object at 0x7f21757a2d10>
run_subprocess = <function run_subprocess.<locals>.func at 0x7f21734877e0>
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"])
/__w/pymechanical/pymechanical/tests/embedding/test_appdata.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/__w/pymechanical/pymechanical/tests/conftest.py:194: in func
process, output = ansys.mechanical.core.run._run(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ['/env/bin/python3.11', '/__w/pymechanical/pymechanical/tests/scripts/run_embedded_app.py', '251', 'False', 'Set']
env = None, check = True, display = False
def _run(args, env, check=False, display=False):
if os.name == "nt":
loop = asyncio.ProactorEventLoop() # for subprocess' pipes on Windows
asyncio.set_event_loop(loop)
else:
loop = asyncio.get_event_loop()
try:
rc, process, *output = loop.run_until_complete(_read_and_display(args, env, display))
if rc and check:
> sys.exit("child failed with '{}' exit code".format(rc))
E SystemExit: child failed with '2' exit code
/__w/pymechanical/pymechanical/src/ansys/mechanical/core/run.py:83: SystemExit
Loading