generated from ansys/template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include a test for the ENS_GROUP remote object. Re-organize the code a bit to improve coverage.
- Loading branch information
1 parent
5193b62
commit 2a82489
Showing
5 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from ansys.pyensight.core import DockerLauncher, LocalLauncher | ||
|
||
import gc | ||
import pytest | ||
|
||
|
||
def test_remote_objects(tmpdir, pytestconfig: pytest.Config): | ||
data_dir = tmpdir.mkdir("datadir") | ||
use_local = pytestconfig.getoption("use_local_launcher") | ||
if use_local: | ||
launcher = LocalLauncher() | ||
else: | ||
launcher = DockerLauncher(data_directory=data_dir, use_dev=True) | ||
session = launcher.start() | ||
session.load_data(f"{session.cei_home}/ensight{session.cei_suffix}/data/guard_rail/crash.case") | ||
|
||
# call __str__ on an ENSOBJ object w/o DESCRIPTION attribute (for coverage) | ||
print(session.ensight.objs.core) | ||
|
||
if session.cei_suffix >= "242": | ||
# Create an ENS_GROUP object (a remote object) | ||
g = session.ensight.objs.core.PARTS.find('*rail*', wildcard=1, group=1) | ||
assert "ENS_GROUP" in g.__str__(), "ensobjlist.find() did not return an ENS_GROUP instance" | ||
assert "Owned" in g.__str__(), "Remote ENS_GROUP is not 'Owned'" | ||
assert "Owned" not in g.CHILDREN.__str__(), "Objects in ENS_GROUP are incorrectly 'Owned'" | ||
|
||
# Exercise the custom __del__() method | ||
g = None | ||
gc.collect() | ||
|
||
session.close() |