Skip to content

Commit 68b72a0

Browse files
committed
bug fixes in pressure drop test to account for fileIO issues in python 3.6
1 parent ab9bdb7 commit 68b72a0

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

tests/test_pressure_drop.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@
2525

2626

2727
import os
28+
import sys
2829
import numpy as np
2930
import dassh
30-
31+
from .test_reactor import save_reactor_pytest
3132

3233
########################################################################
3334
# RODDED REGION PRESSURE DROP TESTS
@@ -82,7 +83,7 @@ def test_pressure_drop_w_spacer_grid(testdir):
8283
inp = dassh.DASSH_Input(inpath)
8384
r = dassh.Reactor(inp, path=outpath, write_output=True)
8485
r.temperature_sweep()
85-
r.save()
86+
save_reactor_pytest(r)
8687

8788
# Check results using Reactor object attributes
8889
dh = r.assemblies[0].rodded.bundle_params['de']
@@ -126,7 +127,14 @@ def test_pressure_drop_w_spacer_grid(testdir):
126127
def test_pressure_drop_output_table(testdir):
127128
"""Test output table generation"""
128129
outpath = os.path.join(testdir, 'test_results', 'single_spacer')
129-
r = dassh.reactor.load(os.path.join(outpath, 'dassh_reactor.pkl'))
130+
if sys.version_info < (3, 7):
131+
inp = dassh.DASSH_Input(
132+
os.path.join(
133+
testdir, 'test_inputs', 'input_single_spacer.txt'))
134+
r = dassh.Reactor(inp, path=outpath, write_output=True)
135+
r.temperature_sweep()
136+
else:
137+
r = dassh.reactor.load(os.path.join(outpath, 'dassh_reactor.pkl'))
130138
r.postprocess()
131139
with open(os.path.join(outpath, 'dassh.out'), 'r') as f:
132140
out = f.read()
@@ -288,11 +296,12 @@ def test_pressure_drop_w_gravity(testdir):
288296
r = dassh.Reactor(inp, path=outpath, write_output=True)
289297
r.temperature_sweep()
290298
r.postprocess()
291-
r.save()
299+
save_reactor_pytest(r)
292300

293301
# Check results using Reactor object attributes
294302
# Gravity pressure head loss = rho * g * h
295303
g = 9.80665
304+
296305
# CHECK 1: Each region
297306
for a in r.assemblies:
298307
for reg in a.region:
@@ -307,8 +316,8 @@ def test_pressure_drop_w_gravity(testdir):
307316
print('Answer:', ans)
308317
print('Diff:', diff)
309318
print(reg.coolant.density)
310-
311319
assert pass_test
320+
312321
# CHECK 2: All assemblies have same gravity head loss because
313322
# the core height is the same for all
314323
ref = sum(reg._pressure_drop['gravity'] for reg in r.assemblies[0].region)
@@ -332,12 +341,12 @@ def test_pressure_drop_csv(testdir):
332341
'input_seven_asm_gravity.txt')
333342
outpath = os.path.join(testdir, 'test_results', 'seven_asm_gravity')
334343
csvpath = os.path.join(outpath, 'pressure_drop.csv')
335-
if not os.path.exists(csvpath):
344+
if not os.path.exists(csvpath) or sys.version_info < (3, 7):
336345
inp = dassh.DASSH_Input(inpath)
337346
r = dassh.Reactor(inp, path=outpath, write_output=True)
338347
r.temperature_sweep()
339348
r.postprocess()
340-
r.save()
349+
save_reactor_pytest(r)
341350
else:
342351
r = dassh.reactor.load(os.path.join(outpath, 'dassh_reactor.pkl'))
343352

0 commit comments

Comments
 (0)