Skip to content

Commit 26f8597

Browse files
authored
CORBA - Check if instances have been exited (#317)
* check if instance has already been exited * check reference and not object * update ansys order
1 parent 528ecc7 commit 26f8597

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pyansys/mapdl_corba.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@
1919

2020
INSTANCES = []
2121

22-
# Ensure all instances close on exit
22+
# Ensure all instances close on exit within Windows
2323
@atexit.register
2424
def cleanup(): # pragma: no cover
2525
if os.name == 'nt':
26-
for instance in INSTANCES:
27-
instance().exit()
26+
for ref in INSTANCES:
27+
# check if object has already been collected
28+
instance = ref()
29+
if instance is not None:
30+
instance.exit()
2831

2932

3033
def tail(filename, nlines):

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
pyvista.OFF_SCREEN = True
1313

1414
# check for a valid MAPDL install with CORBA
15-
valid_rver = ['182', '190', '191', '192', '193', '194', '195', '201']
15+
valid_rver = ['202', '201', '195', '194', '193', '192', '191', '190', '182']
1616
EXEC_FILE = None
1717
for rver in valid_rver:
1818
if os.path.isfile(get_ansys_bin(rver)):
1919
EXEC_FILE = get_ansys_bin(rver)
20+
break
2021

2122
if 'PYANSYS_IGNORE_ANSYS' in os.environ:
2223
HAS_ANSYS = False

0 commit comments

Comments
 (0)