Skip to content

Commit 2353f0a

Browse files
Make 2024 history information pass
Signed-off-by: Johannes Mueller <[email protected]>
1 parent 24a3029 commit 2353f0a

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

tools/odbclient/tests/test_odbclient.py

+28-16
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,19 @@ def join_path(filename):
4545

4646

4747
@pytest.fixture(params=["2022", "2023", "2024"])
48-
def client(datapath, request):
49-
abaqus_version = request.param
50-
abaqus_bin = shutil.which(f"abaqus{abaqus_version}")
48+
def abaqus_version(request):
49+
return request.param
50+
51+
52+
@pytest.fixture
53+
def abaqus_bin(abaqus_version):
5154
if sys.platform == 'win32':
52-
abaqus_bin = f"C:/Program Files/SIMULIA/{abaqus_version}/EstProducts/win_b64/code/bin/SMALauncher.exe"
55+
return f"C:/Program Files/SIMULIA/{abaqus_version}/EstProducts/win_b64/code/bin/SMALauncher.exe"
56+
return shutil.which(f"abaqus{abaqus_version}")
57+
5358

59+
@pytest.fixture
60+
def client(datapath, abaqus_version, abaqus_bin):
5461
python_path = os.path.join(Path.home(), ".conda", "envs", f"odbserver-{abaqus_version}")
5562
odb_file = datapath(f"beam_3d_hex_quad-{abaqus_version}.odb")
5663
return odbclient.OdbClient(odb_file, abaqus_bin=abaqus_bin, python_env_path=python_path)
@@ -188,13 +195,8 @@ def test_variable_stress_integration_point(client, datapath):
188195
pd.testing.assert_frame_equal(result, expected)
189196

190197

191-
@pytest.fixture(params=["2022", "2023", "2024"])
192-
def client_history(datapath, request):
193-
abaqus_version = request.param
194-
abaqus_bin = shutil.which(f"abaqus{abaqus_version}")
195-
if sys.platform == 'win32':
196-
abaqus_bin = f"C:/Program Files/SIMULIA/{abaqus_version}/EstProducts/win_b64/code/bin/SMALauncher.exe"
197-
198+
@pytest.fixture()
199+
def client_history(datapath, abaqus_version, abaqus_bin):
198200
python_path = os.path.join(Path.home(), ".conda", "envs", f"odbserver-{abaqus_version}")
199201
odb_file = datapath(f"history_output_test-{abaqus_version}.odb")
200202
return odbclient.OdbClient(odb_file, abaqus_bin=abaqus_bin, python_env_path=python_path)
@@ -234,14 +236,17 @@ def test_history_output_values(client_history):
234236
assert client_history.history_output_values("Step-1", 'Element ASSEMBLY.1', 'CTF1').array[1] == pytest.approx(0.09999854117631912)
235237

236238

237-
def test_history_region_description(client_history):
239+
def test_history_region_description(client_history, abaqus_version):
238240
result = client_history.history_region_description("Step-1", 'Element ASSEMBLY.1')
239-
assert result == "Output at assembly ASSEMBLY instance ASSEMBLY element 1"
241+
expected = "Output at assembly ASSEMBLY instance ASSEMBLY element 1"
242+
if abaqus_version == "2024":
243+
expected += " region _PICKEDSET21"
244+
assert result == expected
240245

241246

242-
def test_history_info(client_history):
247+
def test_history_info(client_history, abaqus_version):
243248
expected = {
244-
"Output at assembly ASSEMBLY region Whole Model": {
249+
"Output at assembly ASSEMBLY": {
245250
"History Outputs": [
246251
"ALLAE",
247252
"ALLCCDW",
@@ -326,4 +331,11 @@ def test_history_info(client_history):
326331
"Steps ": ["Step-1", "Step-2"],
327332
},
328333
}
329-
assert client_history.history_info() == expected
334+
if abaqus_version == "2024":
335+
expected["Output at assembly ASSEMBLY region Whole Model"] = expected.pop("Output at assembly ASSEMBLY")
336+
element_1 = expected.pop("Output at assembly ASSEMBLY instance ASSEMBLY element 1")
337+
expected["Output at assembly ASSEMBLY instance ASSEMBLY element 1 region _PICKEDSET21"] = element_1
338+
expected["Output at assembly ASSEMBLY instance ASSEMBLY element 1 region _PICKEDSET22"] = element_1
339+
340+
result = client_history.history_info()
341+
assert result == expected

0 commit comments

Comments
 (0)