From b81930006151660e1f0b1c0352b744a216298176 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Mon, 24 Feb 2014 17:21:48 -0500 Subject: [PATCH 01/51] converted a couple of tests over to CTest framework, works in serial so far --- src/CMakeLists.txt | 18 ++++++- tests/test_basic/test_basic.py | 49 ++++++++++------- .../test_confidence_intervals.py | 54 ++++++++++++------- 3 files changed, 82 insertions(+), 39 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2781f4d27d..20162b94e7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -211,4 +211,20 @@ if(PYTHONINTERP_FOUND) install(CODE "execute_process( COMMAND ${PYTHON_EXECUTABLE} setup.py install --user WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/utils)") -endif() \ No newline at end of file +endif() + +#=============================================================================== +# Regression tests +#=============================================================================== + +enable_testing() + +set(TESTS test_basic test_confidence_intervals) + +foreach(test ${TESTS}) + + add_test(NAME ${test} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../tests/${test} + COMMAND ${PYTHON_EXECUTABLE} ${test}.py --exe $) + +endforeach(test) diff --git a/tests/test_basic/test_basic.py b/tests/test_basic/test_basic.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_basic/test_basic.py +++ b/tests/test_basic/test_basic.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_confidence_intervals/test_confidence_intervals.py b/tests/test_confidence_intervals/test_confidence_intervals.py index a8372834f7..22932a02cd 100644 --- a/tests/test_confidence_intervals/test_confidence_intervals.py +++ b/tests/test_confidence_intervals/test_confidence_intervals.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_created_output(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') - output.append(pwd + '/tallies.out') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') + output.append(cwd + '/tallies.out') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_created_output() + test_results() + teardown() From c358e7561380883f9708655eaa975c8e48d6eacf Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Mon, 24 Feb 2014 18:06:14 -0500 Subject: [PATCH 02/51] ctests now allow for MPI testing as well if MPI executable is determined --- src/CMakeLists.txt | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 20162b94e7..d180a7da2f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,15 +26,20 @@ endif() # MPI for distributed-memory parallelism / HDF5 for binary output #=============================================================================== +set(MPI_ENABLED FALSE) if($ENV{FC} MATCHES "mpi.*") message("-- Detected MPI wrapper: $ENV{FC}") add_definitions(-DMPI) + set(MPI_ENABLED TRUE) + get_filename_component(MPI_DIR $ENV{FC} PATH) elseif($ENV{FC} MATCHES "h5fc$") message("-- Detected HDF5 wrapper: $ENV{FC}") add_definitions(-DHDF5) elseif($ENV{FC} MATCHES "h5pfc$") message("-- Detected parallel HDF5 wrapper: $ENV{FC}") add_definitions(-DMPI -DHDF5) + set(MPI_ENABLED TRUE) + get_filename_component(MPI_DIR $ENV{FC} PATH) endif() #=============================================================================== @@ -217,14 +222,31 @@ endif() # Regression tests #=============================================================================== +# This allows mpi test to work enable_testing() +# Get a list of all the tests to run set(TESTS test_basic test_confidence_intervals) +# Loop through all the tests foreach(test ${TESTS}) - add_test(NAME ${test} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../tests/${test} - COMMAND ${PYTHON_EXECUTABLE} ${test}.py --exe $) + # Check serial/parallel + if (${MPI_ENABLED}) + + # Preform a parallel test + add_test(NAME ${test} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../tests/${test} + COMMAND ${PYTHON_EXECUTABLE} ${test}.py --exe $ + --mpi_exec ${MPI_DIR}/mpiexec) + + else(${MPI_ENABLED}) + + # Perform a serial test + add_test(NAME ${test} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../tests/${test} + COMMAND ${PYTHON_EXECUTABLE} ${test}.py --exe $) + + endif(${MPI_ENABLED}) endforeach(test) From 0e93ef7a6eaf0fde33e3ed17896ca2c11e1550bb Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Mon, 24 Feb 2014 18:24:30 -0500 Subject: [PATCH 03/51] added commented out GLOB for all tests later on --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d180a7da2f..bc6eca32a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -227,6 +227,7 @@ enable_testing() # Get a list of all the tests to run set(TESTS test_basic test_confidence_intervals) +#file(GLOB TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/test_*) # Loop through all the tests foreach(test ${TESTS}) From 6cad5af528856d83cd0196b4095b7af000d09885 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Mon, 24 Feb 2014 22:52:00 -0500 Subject: [PATCH 04/51] cmake now looks for all tests and determines to run cmfd --- src/CMakeLists.txt | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bc6eca32a2..f19c95c11d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -133,7 +133,9 @@ endif() # PETSc for CMFD functionality #=============================================================================== +set (PETSC_ENABLED FALSE) if(petsc) + set(PETSC_ENABLED TRUE) find_package(PETSc REQUIRED HINTS $ENV{PETSC_DIR}/conf) find_library(libpetsc petsc $ENV{PETSC_DIR}/lib) @@ -226,27 +228,38 @@ endif() enable_testing() # Get a list of all the tests to run -set(TESTS test_basic test_confidence_intervals) -#file(GLOB TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/test_*) +file(GLOB_RECURSE TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/test_*.py) + +# Check to see if PETSC is compiled for CMFD tests +if (${PETSC_ENABLED} EQUAL FALSE) + file(GLOB_RECURSE CMFD_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/test_cmfd*.py) + foreach(cmfd_test in ${CMFD_TESTS}) + list(REMOVE_ITEM TESTS ${cmfd_test}) + endforeach(cmfd_test) +endif(${PETSC_ENABLED} EQUAL FALSE) # Loop through all the tests foreach(test ${TESTS}) + # Get test information + get_filename_component(TEST_NAME ${test} NAME) + get_filename_component(TEST_PATH ${test} PATH) + # Check serial/parallel if (${MPI_ENABLED}) # Preform a parallel test - add_test(NAME ${test} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../tests/${test} - COMMAND ${PYTHON_EXECUTABLE} ${test}.py --exe $ + add_test(NAME ${TEST_NAME} + WORKING_DIRECTORY ${TEST_PATH} + COMMAND ${PYTHON_EXECUTABLE} ${TEST_NAME} --exe $ --mpi_exec ${MPI_DIR}/mpiexec) else(${MPI_ENABLED}) # Perform a serial test - add_test(NAME ${test} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../tests/${test} - COMMAND ${PYTHON_EXECUTABLE} ${test}.py --exe $) + add_test(NAME ${TEST_NAME} + WORKING_DIRECTORY ${TEST_PATH} + COMMAND ${PYTHON_EXECUTABLE} ${TEST_NAME} --exe $) endif(${MPI_ENABLED}) From 6124f2d12fa2565722d407a13ef300b0d1be8827 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Mon, 24 Feb 2014 23:08:59 -0500 Subject: [PATCH 05/51] If Petsc option is not set then remove CMFD tests --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f19c95c11d..1217811411 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -231,12 +231,12 @@ enable_testing() file(GLOB_RECURSE TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/test_*.py) # Check to see if PETSC is compiled for CMFD tests -if (${PETSC_ENABLED} EQUAL FALSE) +if (NOT ${PETSC_ENABLED}) file(GLOB_RECURSE CMFD_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/../tests/test_cmfd*.py) foreach(cmfd_test in ${CMFD_TESTS}) list(REMOVE_ITEM TESTS ${cmfd_test}) endforeach(cmfd_test) -endif(${PETSC_ENABLED} EQUAL FALSE) +endif(NOT ${PETSC_ENABLED}) # Loop through all the tests foreach(test ${TESTS}) From 6f0ce383bee5d9da4563faf22bc61a08050e6d24 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 08:24:20 -0500 Subject: [PATCH 06/51] converted CMFD tests --- tests/test_cmfd_feed/test_cmfd_feed.py | 80 ++++++++++------------ tests/test_cmfd_jfnk/test_cmfd_jfnk.py | 79 ++++++++++----------- tests/test_cmfd_nofeed/test_cmfd_nofeed.py | 78 ++++++++++----------- 3 files changed, 108 insertions(+), 129 deletions(-) diff --git a/tests/test_cmfd_feed/test_cmfd_feed.py b/tests/test_cmfd_feed/test_cmfd_feed.py index 1388ca85a5..bafce9f444 100644 --- a/tests/test_cmfd_feed/test_cmfd_feed.py +++ b/tests/test_cmfd_feed/test_cmfd_feed.py @@ -4,70 +4,62 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp import glob +from optparse import OptionParser -from nose.plugins.skip import SkipTest - -from nose_mpi import NoseMPI - - -pwd = os.path.dirname(__file__) - -skipAll = False - - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) - global skipAll - skipAll = False - +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], - stderr=STDOUT, stdout=PIPE) + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], + stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) - output = proc.communicate()[0] - print(output) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) + print(proc.communicate()[0]) returncode = proc.returncode - if 'CMFD is not available' in output: - global skipAll - skipAll = True - raise SkipTest - assert returncode == 0 - + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - if skipAll: - raise SkipTest - statepoint = glob.glob(pwd + '/statepoint.20.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.20.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - if skipAll: - raise SkipTest - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - if skipAll: - raise SkipTest - statepoint = glob.glob(pwd + '/statepoint.20.*') + statepoint = glob.glob(cwd + '/statepoint.20.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.20.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.20.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_cmfd_jfnk/test_cmfd_jfnk.py b/tests/test_cmfd_jfnk/test_cmfd_jfnk.py index 1388ca85a5..1386da3fee 100644 --- a/tests/test_cmfd_jfnk/test_cmfd_jfnk.py +++ b/tests/test_cmfd_jfnk/test_cmfd_jfnk.py @@ -4,70 +4,63 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp import glob +from optparse import OptionParser -from nose.plugins.skip import SkipTest - -from nose_mpi import NoseMPI - - -pwd = os.path.dirname(__file__) - -skipAll = False - - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) - global skipAll - skipAll = False - +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], - stderr=STDOUT, stdout=PIPE) + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], + stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) - output = proc.communicate()[0] - print(output) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) + print(proc.communicate()[0]) returncode = proc.returncode - if 'CMFD is not available' in output: - global skipAll - skipAll = True - raise SkipTest - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - if skipAll: - raise SkipTest - statepoint = glob.glob(pwd + '/statepoint.20.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.20.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - if skipAll: - raise SkipTest - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - if skipAll: - raise SkipTest - statepoint = glob.glob(pwd + '/statepoint.20.*') + statepoint = glob.glob(cwd + '/statepoint.20.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.20.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.20.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_cmfd_nofeed/test_cmfd_nofeed.py b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py index be7ec194a5..1386da3fee 100644 --- a/tests/test_cmfd_nofeed/test_cmfd_nofeed.py +++ b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py @@ -4,69 +4,63 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp import glob +from optparse import OptionParser -from nose.plugins.skip import SkipTest - -from nose_mpi import NoseMPI - -pwd = os.path.dirname(__file__) - -skipAll = False - - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) - global skipAll - skipAll = False - +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], - stderr=STDOUT, stdout=PIPE) + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], + stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) - output = proc.communicate()[0] - print(output) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) + print(proc.communicate()[0]) returncode = proc.returncode - if 'CMFD is not available' in output: - global skipAll - skipAll = True - raise SkipTest - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - if skipAll: - raise SkipTest - statepoint = glob.glob(pwd + '/statepoint.20.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.20.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - if skipAll: - raise SkipTest - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - if skipAll: - raise SkipTest - statepoint = glob.glob(pwd + '/statepoint.20.*') + statepoint = glob.glob(cwd + '/statepoint.20.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.20.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.20.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() From 7dc74d067b6be039fd1664ee7bb8c18b1d69485a Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 09:31:52 -0500 Subject: [PATCH 07/51] started new python script to run all tests with all compile options --- tests/run_tests.py | 236 ++++++++++++++++++--------------------------- 1 file changed, 92 insertions(+), 144 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 610ad2422b..38e2cb5b76 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -3,156 +3,104 @@ from __future__ import print_function import os -import sys -import nose -import glob -import shutil -from subprocess import call +from subprocess import call +from collections import OrderedDict -from nose_mpi import NoseMPI +# Compiler paths +FC_DEFAULT='gfortran' +MPI_DIR='/opt/mpich/3.0.4-gnu' +HDF5_DIR='/opt/hdf5/1.8.12-gnu' +PHDF5_DIR='/opt/phdf5/1.8.12-gnu' +PETSC_DIR='/opt/petsc/3.4.3-gnu' +# Define test data structure +tests = OrderedDict() -def run_compile(): - print('-'*17) - print('Compilation tests') - print('-'*17) +class Test(object): + def __init__(self, debug=False, optimize=False, mpi=False, openmp=False, + hdf5=False, petsc=False): + self.debug = debug + self.optimize = optimize + self.mpi = mpi + self.openmp = openmp + self.hdf5 = hdf5 + self.petsc = petsc + self.success = True + self.setup_cmake() - # clean up all previous executables - openmc_exe = glob.glob(pwd + '/../src/openmc*') - for exe in openmc_exe: - os.remove(exe) + def setup_cmake(self): + # Default cmake + self.cmake = ['cmake','-H.','-Bbuild'] - # run compile test - result = nose.run(argv=['nosetests', 'test_compile'] + flags) - if not result: - print('Did not pass compile tests.') - results.append(('compile', result)) - - -def run_suite(name=None, mpi=False): - print('-'*(len(name) + 6)) - print(name + ' tests') - print('-'*(len(name) + 6)) - - # Set arguments list. Note that the first argument is a dummy argument (the - # script name). It's not actually recursively calling run_tests.py - argv = ['nosetests', '--exclude', 'test_compile'] + flags - - # Add MPI plugin if set - if mpi: - plugins = [NoseMPI()] - argv += ['--mpi-np', '3', '--mpi-exec', mpiexec] - else: - plugins = None - - try: - os.chdir(pwd) - shutil.copyfile(pwd + '/../src/openmc-' + name, pwd + '/../src/openmc') - result = nose.run(argv=argv, addplugins=plugins) - except OSError: - result = False - print('No OpenMC executable found for ' + name + ' tests') - if not result: - print('Did not pass ' + name + ' tests') - results.append((name, result)) - -# set mpiexec path -if 'COMPILER' in os.environ: - compiler = os.environ['COMPILER'] -else: - compiler = 'gnu' -mpiexec = '/opt/mpich/3.0.4-{0}/bin/mpiexec'.format(compiler) - -# get current working directory -pwd = os.getcwd() -sys.path.append(pwd) - -# Set list of tests, either default or from command line -flags = [] -tests = ['compile', 'normal', 'debug', 'optimize', - 'omp', 'omp-debug', 'omp-optimize', - 'hdf5', 'hdf5-debug', 'hdf5-optimize', - 'omp-hdf5', 'omp-hdf5-debug', 'omp-hdf5-optimize', - 'mpi', 'mpi-debug', 'mpi-optimize', - 'mpi-omp', 'mpi-omp-debug', 'mpi-omp-optimize', - 'phdf5', 'phdf5-debug', 'phdf5-optimize', - 'phdf5-omp', 'phdf5-omp-debug', 'phdf5-omp-optimize', - 'petsc', 'petsc-debug', 'petsc-optimize', - 'phdf5-petsc', 'phdf5-petsc-debug', 'phdf5-petsc-optimize', - 'omp-phdf5-petsc', 'omp-phdf5-petsc-debug', - 'omp-phdf5-petsc-optimize'] -if len(sys.argv) > 1: - flags = [i for i in sys.argv[1:] if i.startswith('-')] - tests_ = [i for i in sys.argv[1:] if not i.startswith('-')] - - # Check for special subsets of tests - tests__ = [] - for i in tests_: - - # All tests will run all the tests except for compile unless - # it is also specified on the command line. Note that specifying - # compile all-tests is the same as not specifying any args - if i == 'all-tests': - tests__ = tests - try: - idx = tests_.index('compile') # check for compile test - except ValueError: - del tests__[0] - finally: - break # don't need to check for anything else - - # This checks for any subsets of tests. The string after - # all-XXXX will be used to search through all tests. - # Specifying XXXX=normal will run tests that don't contain - # debug or optimize substring. - if i.startswith('all-'): - suffix = i.split('all-')[1] - if suffix == 'normal': - for j in tests: - if j.rfind('debug') == -1 and \ - j.rfind('optimize') == -1: - tests__.append(j) - else: - for j in tests: - if j.rfind(suffix) != -1: - if suffix == 'omp' and j == 'compile': - continue - tests__.append(j) + # Check for MPI/HDF5 + if self.mpi and not self.hdf5: + self.fc = MPI_DIR+'/bin/mpif90' + elif not self.mpi and self.hdf5: + self.fc = HDF5_DIR+'/bin/h5fc' + elif self.mpi and self.hdf5: + self.fc = PHDF5_DIR+'/bin/h5pfc' else: - tests__.append(i) # append specific test (e.g., mpi-debug) - tests = tests__ if tests__ else tests + self.fc = FC_DEFAULT -# Run tests -results = [] -for name in tests: - if name == 'compile': - run_compile() - elif name in ['normal', 'debug', 'optimize', - 'hdf5', 'hdf5-debug', 'hdf5-optimize', - 'omp', 'omp-debug', 'omp-optimize', - 'omp-hdf5', 'omp-hdf5-debug', 'omp-hdf5-optimize']: - run_suite(name=name) - elif name in ['mpi', 'mpi-debug', 'mpi-optimize', - 'mpi-omp', 'mpi-omp-debug', 'mpi-omp-optimize', - 'phdf5', 'phdf5-debug', 'phdf5-optimize', - 'phdf5-omp', 'phdf5-omp-debug', 'phdf5-omp-optimize', - 'petsc', 'petsc-debug', 'petsc-optimize', - 'phdf5-petsc', 'phdf5-petsc-debug', 'phdf5-petsc-optimize', - 'omp-phdf5-petsc', 'omp-phdf5-petsc-debug', - 'omp-phdf5-petsc-optimize']: - run_suite(name=name, mpi=True) + # Set rest of options + if self.debug: + self.cmake.append('-Ddebug=on') + if self.optimize: + self.cmake.append('-Doptimize=on') + if self.openmp: + self.cmake.append('-Dopenmp=on') + if self.petsc: + self.cmake.append('-Dpetsc=on') + os.environ['PETSC_DIR'] = PETSC_DIR -# print out summary of results -print('\n' + '='*54) -print('Summary of Compilation Option Testing:\n') + def run_cmake(self): + os.environ['FC'] = self.fc + rc = call(self.cmake) + if rc != 0: + self.sucess = False -OK = '\033[92m' -FAIL = '\033[91m' -ENDC = '\033[0m' -BOLD = '\033[1m' -for name, result in results: - print(name + '.'*(50 - len(name)), end='') - if result: - print(BOLD + OK + '[OK]' + ENDC) - else: - print(BOLD + FAIL + '[FAILED]' + ENDC) +def add_test(name, debug=False, optimize=False, mpi=False, openmp=False,\ + hdf5=False, petsc=False): + tests.update({name:Test(debug, optimize, mpi, openmp, hdf5, petsc)}) + +# List of tests +add_test('normal') +add_test('debug', debug=True) +add_test('optimize', optimize=True) +add_test('omp-normal', openmp=True) +add_test('omp-debug', openmp=True, debug=True) +add_test('omp-optimize', openmp=True, optimize=True) +add_test('hdf5-normal', hdf5=True) +add_test('hdf5-debug', hdf5=True, debug=True) +add_test('hdf5-optimize', hdf5=True, optimize=True) +add_test('omp-hdf5-normal', openmp=True, hdf5=True) +add_test('omp-hdf5-debug', openmp=True, hdf5=True, debug=True) +add_test('omp-hdf5-optimize', openmp=True, hdf5=True, optimize=True) +add_test('mpi-normal', mpi=True) +add_test('mpi-debug', mpi=True, debug=True) +add_test('mpi-optimize', mpi=True, optimize=True) +add_test('mpi-omp-normal', mpi=True, openmp=True) +add_test('mpi-omp-debug', mpi=True, openmp=True, debug=True) +add_test('mpi-omp-optimize', mpi=True, openmp=True, optimize=True) +add_test('phdf5-normal', mpi=True, hdf5=True) +add_test('phdf5-debug', mpi=True, hdf5=True, debug=True) +add_test('phdf5-optimize', mpi=True, hdf5=True, optimize=True) +add_test('phdf5-omp-normal', mpi=True, hdf5=True, openmp=True) +add_test('phdf5-omp-debug', mpi=True, hdf5=True, openmp=True, debug=True) +add_test('phdf5-omp-optimize', mpi=True, hdf5=True, openmp=True, optimize=True) +add_test('petsc-normal', petsc=True, mpi=True) +add_test('petsc-debug', petsc=True, mpi=True, debug=True) +add_test('petsc-optimize', petsc=True, mpi=True, optimize=True) +add_test('phdf5-petsc-normal', mpi=True, hdf5=True, petsc=True) +add_test('phdf5-petsc-debug', mpi=True, hdf5=True, petsc=True, debug=True) +add_test('phdf5-petsc-optimize', mpi=True, hdf5=True, petsc=True, optimize=True) +add_test('omp-phdf5-petsc-normal', openmp=True, mpi=True, hdf5=True, petsc=True) +add_test('omp-phdf5-petsc-debug', openmp=True, mpi=True, hdf5=True, petsc=True, debug=True) +add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=True, optimize=True) + +# Call tests +os.chdir('../src') +call(['make','distclean']) +for test in iter(tests): + tests[test].run_cmake() + call(['make','distclean']) From ce7a23f8fdc6e4dc78ad1c0b5376399434a7185d Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 10:00:44 -0500 Subject: [PATCH 08/51] tests can be specified from command line --- tests/run_tests.py | 91 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 86 insertions(+), 5 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 38e2cb5b76..da916d9541 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -3,6 +3,7 @@ from __future__ import print_function import os +import sys from subprocess import call from collections import OrderedDict @@ -57,16 +58,30 @@ class Test(object): os.environ['FC'] = self.fc rc = call(self.cmake) if rc != 0: - self.sucess = False + self.success = False + + def run_make(self): + if not self.success: + return + rc = call(['make','-j', '-s','-C','build']) + if rc != 0: + self.success = False + + def run_ctests(self): + if not self.success: + return + rc = call(['make','test','-C','build']) + if rc != 0: + self.success = False def add_test(name, debug=False, optimize=False, mpi=False, openmp=False,\ hdf5=False, petsc=False): tests.update({name:Test(debug, optimize, mpi, openmp, hdf5, petsc)}) # List of tests -add_test('normal') -add_test('debug', debug=True) -add_test('optimize', optimize=True) +add_test('basic-normal') +add_test('basic-debug', debug=True) +add_test('basic-optimize', optimize=True) add_test('omp-normal', openmp=True) add_test('omp-debug', openmp=True, debug=True) add_test('omp-optimize', openmp=True, optimize=True) @@ -98,9 +113,75 @@ add_test('omp-phdf5-petsc-normal', openmp=True, mpi=True, hdf5=True, petsc=True) add_test('omp-phdf5-petsc-debug', openmp=True, mpi=True, hdf5=True, petsc=True, debug=True) add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=True, optimize=True) -# Call tests +# Change to source directory and clean it up os.chdir('../src') call(['make','distclean']) + +# Process command line arguments +if len(sys.argv) > 1: + flags = [i for i in sys.argv[1:] if i.startswith('-')] + tests_ = [i for i in sys.argv[1:] if not i.startswith('-')] + + # Check for special subsets of tests + tests__ = [] + for i in tests_: + + # This checks for any subsets of tests. The string after + # all-XXXX will be used to search through all tests. + if i.startswith('all-'): + suffix = i.split('all-')[1] + for j in tests: + if j.rfind(suffix) != -1: + try: + tests__.index(j) + except ValueError: + tests__.append(j) + + # Test name specified on command line + else: + try: + tests__.index(i) + except ValueError: + tests__.append(i) # append specific test (e.g., mpi-debug) + + # Delete items of dictionary that are not in tests__ + for key in iter(tests): + try: + tests__.index(key) + except ValueError: + del tests[key] + +# Begin testing for test in iter(tests): + print('-'*(len(test) + 6)) + print(test + ' tests') + print('-'*(len(test) + 6)) + + + # Run CMAKE to configure build tests[test].run_cmake() + + # Build OpenMC + tests[test].run_make() + + # Run tests + tests[test].run_ctests() + + # Clean up build call(['make','distclean']) + +# Print out summary of results +print('\n' + '='*54) +print('Summary of Compilation Option Testing:\n') + +OK = '\033[92m' +FAIL = '\033[91m' +ENDC = '\033[0m' +BOLD = '\033[1m' + +for test in iter(tests): + print(test + '.'*(50 - len(test)), end='') + if tests[test].success: + print(BOLD + OK + '[OK]' + ENDC) + else: + print(BOLD + FAIL + '[FAILED]' + ENDC) From e39cfd2bd4efbdcdb97d5b99a1bbd0789fb9cedb Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 10:09:34 -0500 Subject: [PATCH 09/51] Added failure message to output --- tests/run_tests.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/run_tests.py b/tests/run_tests.py index da916d9541..36b9a7901e 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -27,6 +27,7 @@ class Test(object): self.hdf5 = hdf5 self.petsc = petsc self.success = True + self.msg = None self.setup_cmake() def setup_cmake(self): @@ -59,6 +60,7 @@ class Test(object): rc = call(self.cmake) if rc != 0: self.success = False + self.msg = 'Failed on cmake.' def run_make(self): if not self.success: @@ -66,6 +68,7 @@ class Test(object): rc = call(['make','-j', '-s','-C','build']) if rc != 0: self.success = False + self.msg = 'Failed on make.' def run_ctests(self): if not self.success: @@ -73,6 +76,7 @@ class Test(object): rc = call(['make','test','-C','build']) if rc != 0: self.success = False + self.msg = 'Failed on testing.' def add_test(name, debug=False, optimize=False, mpi=False, openmp=False,\ hdf5=False, petsc=False): @@ -185,3 +189,4 @@ for test in iter(tests): print(BOLD + OK + '[OK]' + ENDC) else: print(BOLD + FAIL + '[FAILED]' + ENDC) + print(' '*len(test)+tests[test].msg) From c6286abced19cc379e8aa97f30882f0947099a73 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 10:24:51 -0500 Subject: [PATCH 10/51] changed build destination and now copy log file if failure occurs --- tests/run_tests.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 36b9a7901e..7d518673ad 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -4,6 +4,7 @@ from __future__ import print_function import os import sys +import shutil from subprocess import call from collections import OrderedDict @@ -32,7 +33,7 @@ class Test(object): def setup_cmake(self): # Default cmake - self.cmake = ['cmake','-H.','-Bbuild'] + self.cmake = ['cmake','-H../src','-Bbuild'] # Check for MPI/HDF5 if self.mpi and not self.hdf5: @@ -117,10 +118,6 @@ add_test('omp-phdf5-petsc-normal', openmp=True, mpi=True, hdf5=True, petsc=True) add_test('omp-phdf5-petsc-debug', openmp=True, mpi=True, hdf5=True, petsc=True, debug=True) add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=True, optimize=True) -# Change to source directory and clean it up -os.chdir('../src') -call(['make','distclean']) - # Process command line arguments if len(sys.argv) > 1: flags = [i for i in sys.argv[1:] if i.startswith('-')] @@ -156,6 +153,7 @@ if len(sys.argv) > 1: del tests[key] # Begin testing +call(['rm','-rf','build']) for test in iter(tests): print('-'*(len(test) + 6)) print(test + ' tests') @@ -171,8 +169,13 @@ for test in iter(tests): # Run tests tests[test].run_ctests() + # Copy test log file if failed + if tests[test].msg == 'Failed on testing.': + shutil.copy('build/Testing/Temporary/LastTest.log', + 'LastTest_{0}.log'.format(test)) + # Clean up build - call(['make','distclean']) + call(['rm','-rf','build']) # Print out summary of results print('\n' + '='*54) From 0fadcc90cb8ac833e03ace02b4a63685fa4ef953 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 10:25:37 -0500 Subject: [PATCH 11/51] removed nose test plugins --- tests/nose_mpi.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 tests/nose_mpi.py diff --git a/tests/nose_mpi.py b/tests/nose_mpi.py deleted file mode 100644 index 70cea8936e..0000000000 --- a/tests/nose_mpi.py +++ /dev/null @@ -1,41 +0,0 @@ -import os -import logging -from nose.plugins import Plugin - -log = logging.getLogger('nose.plugins.nose_mpi') - -class NoseMPI(Plugin): - - mpi_np = "0" - mpi_exec = "/opt/mpich/3.0.4-gnu/bin/mpiexec" - - def options(self, parser, env=os.environ): - """Define the command line options for plugin.""" - super(NoseMPI, self).options(parser, env) - - parser.add_option( - "--mpi-np", dest="mpi_np", default=0, - help="Number of MPI processors to execute OpenMC executable.") - - parser.add_option( - "--mpi-exec", dest="mpi_exec", - default="/opt/mpich/3.0.4-gnu/bin/mpiexec", - help="Absolute path to mpiexec file.") - - def configure(self, options, conf): - """Configure plugin based on command line options""" - super(NoseMPI, self).configure(options, conf) - - try: - mpi_np = int(options.mpi_np) - self.enabled = True - NoseMPI.mpi_np = options.mpi_np - except: - self.enabled = False - return - - if not os.path.exists(options.mpi_exec): - print 'Need to specify valid mpiexec path.' - exit() - - NoseMPI.mpi_exec = options.mpi_exec From 615b970fa97339307cbc36c3ae50ee12d01b68a1 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 10:25:54 -0500 Subject: [PATCH 12/51] removed compile test --- tests/test_compile/test_compile.py | 360 ----------------------------- 1 file changed, 360 deletions(-) delete mode 100644 tests/test_compile/test_compile.py diff --git a/tests/test_compile/test_compile.py b/tests/test_compile/test_compile.py deleted file mode 100644 index 882a4795c1..0000000000 --- a/tests/test_compile/test_compile.py +++ /dev/null @@ -1,360 +0,0 @@ -#!/usr/bin/env python - -"""Compilation tests - -This set of tests makes sure that OpenMC can compile for many different -combinations of compilation flags and options. By default, only the gfortran -and ifort compilers are tested. This requires that the MPI, HDF5, and PETSC -libraries are already set up appropriately in the Makefile. - -""" - -import os -from subprocess import Popen, STDOUT, PIPE -import shutil - -pwd = os.path.dirname(__file__) - -# Set default copmilers -fc = 'gfortran' -h5fc = 'h5fc' -h5pfc = 'h5pfc' -mpifc = 'mpif90' - - -def setup(): - # Change to source directory - os.chdir(pwd + '/../../src') - - -def test_normal(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -H. -Bbuild'.format(fc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-normal') - - -def test_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Ddebug=on -H. -Bbuild'.format(fc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-debug') - - -def test_profile(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dprofile=on -H. -Bbuild'.format(fc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-profile') - - -def test_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Doptimize=on -H. -Bbuild'.format(fc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-optimize') - - -def test_mpi(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -H. -Bbuild'.format(mpifc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-mpi') - - -def test_mpi_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Ddebug=on -H. -Bbuild'.format(mpifc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-mpi-debug') - - -def test_mpi_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Doptimize=on -H. -Bbuild'.format(mpifc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-mpi-optimize') - - -def test_omp(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -H. -Bbuild'.format(fc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-omp') - - -def test_omp_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -Ddebug=on '.format(fc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-omp-debug') - - -def test_omp_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -Doptimize=on '.format(fc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-omp-optimize') - - -def test_hdf5(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -H. -Bbuild'.format(h5fc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-hdf5') - - -def test_hdf5_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Ddebug=on -H. -Bbuild'.format(h5fc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-hdf5-debug') - - -def test_hdf5_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Doptimize=on -H. -Bbuild'.format(h5fc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-hdf5-optimize') - - -def test_omp_hdf5(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -H. -Bbuild'.format(h5fc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-omp-hdf5') - - -def test_omp_hdf5_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -Ddebug=on '.format(h5fc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-omp-hdf5-debug') - - -def test_omp_hdf5_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -Doptimize=on '.format(h5fc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-omp-hdf5-optimize') - - -def test_petsc(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dpetsc=on -H. -Bbuild'.format(mpifc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-petsc') - - -def test_petsc_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dpetsc=on -Ddebug=on '.format(mpifc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-petsc-debug') - - -def test_petsc_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dpetsc=on -Doptimize=on '.format(mpifc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-petsc-optimize') - - -def test_mpi_omp(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -H. -Bbuild'.format(mpifc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-mpi-omp') - - -def test_mpi_omp_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -Ddebug=on '.format(mpifc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-mpi-omp-debug') - - -def test_mpi_omp_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -Doptimize=on '.format(mpifc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-mpi-omp-optimize') - - -def test_mpi_hdf5(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -H. -Bbuild'.format(h5pfc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-phdf5') - - -def test_mpi_hdf5_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Ddebug=on -H. -Bbuild'.format(h5pfc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-phdf5-debug') - - -def test_mpi_hdf5_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Doptimize=on -H. -Bbuild'.format(h5pfc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-phdf5-optimize') - - -def test_mpi_omp_hdf5(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -H. -Bbuild'.format(h5pfc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-phdf5-omp') - - -def test_mpi_omp_hdf5_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -Ddebug=on '.format(h5pfc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-phdf5-omp-debug') - - -def test_mpi_omp_hdf5_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dopenmp=on -Doptimize=on '.format(h5pfc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-phdf5-omp-optimize') - - -def test_mpi_hdf5_petsc(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dpetsc=on -H. -Bbuild'.format(h5pfc)) - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-phdf5-petsc') - - -def test_mpi_hdf5_petsc_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dpetsc=on -Ddebug=on '.format(h5pfc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-phdf5-petsc-debug') - - -def test_mpi_hdf5_petsc_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dpetsc=on -Doptimize=on '.format(h5pfc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-phdf5-petsc-optimize') - - -def test_mpi_omp_hdf5_petsc(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dpetsc=on -Dopenmp=on '.format(h5pfc) + - '-H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-omp-phdf5-petsc') - - -def test_mpi_omp_hdf5_petsc_debug(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dpetsc=on -Dopenmp=on '.format(h5pfc) + - '-Ddebug=on -H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-omp-phdf5-petsc-debug') - - -def test_mpi_omp_hdf5_petsc_optimize(): - shutil.rmtree('build', ignore_errors=True) - returncode = run('FC={0} cmake -Dpetsc=on -Dopenmp=on '.format(h5pfc) + - '-Doptimize=on -H. -Bbuild') - assert returncode == 0 - returncode = run('make -s -C build') - assert returncode == 0 - shutil.move('build/bin/openmc', 'openmc-omp-phdf5-petsc-optimize') - - -def run(commands): - proc = Popen(commands, shell=True, stderr=STDOUT, stdout=PIPE) - print(proc.communicate()[0]) - returncode = proc.returncode - return returncode - - -def teardown(commands): - shutil.rmtree('build', ignore_errors=True) - shutil.copy('openmc-normal', 'openmc') From 9137ecca9da13d6c7f9eaae330279489d1519f29 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 10:32:15 -0500 Subject: [PATCH 13/51] converted over density tests --- .../test_density_atombcm.py | 49 ++++++++++++------- .../test_density_atomcm3.py | 47 +++++++++++------- tests/test_density_kgm3/test_density_kgm3.py | 49 ++++++++++++------- tests/test_density_sum/test_density_sum.py | 47 +++++++++++------- 4 files changed, 122 insertions(+), 70 deletions(-) diff --git a/tests/test_density_atombcm/test_density_atombcm.py b/tests/test_density_atombcm/test_density_atombcm.py index 2fde1e6312..54733fb13c 100644 --- a/tests/test_density_atombcm/test_density_atombcm.py +++ b/tests/test_density_atombcm/test_density_atombcm.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_density_atomcm3/test_density_atomcm3.py b/tests/test_density_atomcm3/test_density_atomcm3.py index 74a644b59d..77610a8261 100644 --- a/tests/test_density_atomcm3/test_density_atomcm3.py +++ b/tests/test_density_atomcm3/test_density_atomcm3.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): output = glob.glob('statepoint.10.*') - output.append(pwd + '/results_test.dat') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_density_kgm3/test_density_kgm3.py b/tests/test_density_kgm3/test_density_kgm3.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_density_kgm3/test_density_kgm3.py +++ b/tests/test_density_kgm3/test_density_kgm3.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_density_sum/test_density_sum.py b/tests/test_density_sum/test_density_sum.py index fcafcf0f1f..d6b4ac9cfa 100644 --- a/tests/test_density_sum/test_density_sum.py +++ b/tests/test_density_sum/test_density_sum.py @@ -3,30 +3,31 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): statepoint = glob.glob('statepoint.10.*') @@ -34,11 +35,23 @@ def test_results(): compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() From 77613dc0d797f2a98a82f7f976a74bbf377e3c75 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 10:40:08 -0500 Subject: [PATCH 14/51] updated eigenvalue, energy grid and entropy tests --- .../test_eigenvalue_genperbatch.py | 49 ++++++++++++------- .../test_eigenvalue_no_inactive.py | 49 ++++++++++++------- tests/test_energy_grid/test_energy_grid.py | 49 ++++++++++++------- tests/test_entropy/test_entropy.py | 48 +++++++++++------- 4 files changed, 124 insertions(+), 71 deletions(-) diff --git a/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py b/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py index 24077bd591..1e61af4a2b 100644 --- a/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py +++ b/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.7.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.7.*') + statepoint = glob.glob(cwd + '/statepoint.7.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.7.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.7.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py b/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py +++ b/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_energy_grid/test_energy_grid.py b/tests/test_energy_grid/test_energy_grid.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_energy_grid/test_energy_grid.py +++ b/tests/test_energy_grid/test_energy_grid.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_entropy/test_entropy.py b/tests/test_entropy/test_entropy.py index 64d20b6115..404b94634f 100644 --- a/tests/test_entropy/test_entropy.py +++ b/tests/test_entropy/test_entropy.py @@ -3,42 +3,56 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() From 3b9c15d8b05de31a83308cbbc4d6394fa05a8bc6 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 10:59:27 -0500 Subject: [PATCH 15/51] converted over filter tests --- tests/test_filter_cell/test_filter_cell.py | 54 ++++++++++++------- .../test_filter_cellborn.py | 51 +++++++++++------- .../test_filter_energy/test_filter_energy.py | 54 ++++++++++++------- .../test_filter_energyout.py | 54 ++++++++++++------- .../test_filter_group_transfer.py | 54 ++++++++++++------- .../test_filter_material.py | 54 ++++++++++++------- .../test_filter_mesh_2d.py | 54 ++++++++++++------- .../test_filter_mesh_3d.py | 54 ++++++++++++------- .../test_filter_universe.py | 54 ++++++++++++------- 9 files changed, 303 insertions(+), 180 deletions(-) diff --git a/tests/test_filter_cell/test_filter_cell.py b/tests/test_filter_cell/test_filter_cell.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_filter_cell/test_filter_cell.py +++ b/tests/test_filter_cell/test_filter_cell.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_filter_cellborn/test_filter_cellborn.py b/tests/test_filter_cellborn/test_filter_cellborn.py index 151df366bd..c5cb425422 100644 --- a/tests/test_filter_cellborn/test_filter_cellborn.py +++ b/tests/test_filter_cellborn/test_filter_cellborn.py @@ -3,46 +3,57 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_filter_energy/test_filter_energy.py b/tests/test_filter_energy/test_filter_energy.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_filter_energy/test_filter_energy.py +++ b/tests/test_filter_energy/test_filter_energy.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_filter_energyout/test_filter_energyout.py b/tests/test_filter_energyout/test_filter_energyout.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_filter_energyout/test_filter_energyout.py +++ b/tests/test_filter_energyout/test_filter_energyout.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_filter_group_transfer/test_filter_group_transfer.py b/tests/test_filter_group_transfer/test_filter_group_transfer.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_filter_group_transfer/test_filter_group_transfer.py +++ b/tests/test_filter_group_transfer/test_filter_group_transfer.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_filter_material/test_filter_material.py b/tests/test_filter_material/test_filter_material.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_filter_material/test_filter_material.py +++ b/tests/test_filter_material/test_filter_material.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_filter_mesh_2d/test_filter_mesh_2d.py b/tests/test_filter_mesh_2d/test_filter_mesh_2d.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_filter_mesh_2d/test_filter_mesh_2d.py +++ b/tests/test_filter_mesh_2d/test_filter_mesh_2d.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_filter_mesh_3d/test_filter_mesh_3d.py b/tests/test_filter_mesh_3d/test_filter_mesh_3d.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_filter_mesh_3d/test_filter_mesh_3d.py +++ b/tests/test_filter_mesh_3d/test_filter_mesh_3d.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_filter_universe/test_filter_universe.py b/tests/test_filter_universe/test_filter_universe.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_filter_universe/test_filter_universe.py +++ b/tests/test_filter_universe/test_filter_universe.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() From 0b6d664bc9ed93d8bb014a4af93cf83c384d22b3 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 11:18:51 -0500 Subject: [PATCH 16/51] converted fixed source, lattice, element, output and particle restart tests --- tests/test_fixed_source/test_fixed_source.py | 54 +++++++++------ tests/test_lattice/test_lattice.py | 49 +++++++++----- .../test_lattice_multiple.py | 49 +++++++++----- .../test_natural_element.py | 49 +++++++++----- tests/test_output/test_output.py | 65 ++++++++++++------- .../test_particle_restart.py | 63 +++++++++++------- 6 files changed, 206 insertions(+), 123 deletions(-) diff --git a/tests/test_fixed_source/test_fixed_source.py b/tests/test_fixed_source/test_fixed_source.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_fixed_source/test_fixed_source.py +++ b/tests/test_fixed_source/test_fixed_source.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_lattice/test_lattice.py b/tests/test_lattice/test_lattice.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_lattice/test_lattice.py +++ b/tests/test_lattice/test_lattice.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_lattice_multiple/test_lattice_multiple.py b/tests/test_lattice_multiple/test_lattice_multiple.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_lattice_multiple/test_lattice_multiple.py +++ b/tests/test_lattice_multiple/test_lattice_multiple.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_natural_element/test_natural_element.py b/tests/test_natural_element/test_natural_element.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_natural_element/test_natural_element.py +++ b/tests/test_natural_element/test_natural_element.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_output/test_output.py b/tests/test_output/test_output.py index dc48dc37b9..4ed4255392 100644 --- a/tests/test_output/test_output.py +++ b/tests/test_output/test_output.py @@ -3,52 +3,69 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_summary_exists(): - summary = glob.glob(pwd + '/summary.*') - assert len(summary) == 1 - assert summary[0].endswith('out') or summary[0].endswith('h5') + summary = glob.glob(cwd + '/summary.*') + assert len(summary) == 1, 'Either multiple or no summary file exists.' + assert summary[0].endswith('out') or summary[0].endswith('h5'),\ + 'Summary file is not a binary or hdf5 file.' def test_cross_sections_exists(): - assert os.path.exists(pwd + '/cross_sections.out') + assert os.path.exists(cwd + '/cross_sections.out'),\ + 'Cross section output file does not exist.' def test_statepoint_exists(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') + glob.glob(pwd + '/summary.*') - output.append(pwd + '/summary.out') - output.append(pwd + '/cross_sections.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + glob.glob(cwd + '/summary.*') + output.append(cwd + '/summary.out') + output.append(cwd + '/cross_sections.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_summary_exists() + test_cross_sections_exists() + test_statepoint_exists() + test_results() + teardown() diff --git a/tests/test_particle_restart/test_particle_restart.py b/tests/test_particle_restart/test_particle_restart.py index 1cc576fa7b..4c63efe372 100644 --- a/tests/test_particle_restart/test_particle_restart.py +++ b/tests/test_particle_restart/test_particle_restart.py @@ -3,50 +3,63 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], - stderr=PIPE, stdout=PIPE) + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], + stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=PIPE, stdout=PIPE) - stdout, stderr = proc.communicate() - assert stderr != '' + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) + print(proc.communicate()[0]) + returncode = proc.returncode + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_restart(): - particle = glob.glob(pwd + '/particle_10_394.*') - assert len(particle) == 1 + particle = glob.glob(cwd + '/particle_10_394.*') + assert len(particle) == 1, 'Either multiple or no particle restart files exist.' assert particle[0].endswith('binary') or \ - particle[0].endswith('h5') + particle[0].endswith('h5'), 'Particle restart file not a binary or hdf5 file.' def test_results(): - particle = glob.glob(pwd + '/particle_10_394.*') + particle = glob.glob(cwd + '/particle_10_394.*') call(['python', 'results.py', particle[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def test_run_restart(): - particle = glob.glob(pwd + '/particle_10_394.*') - proc = Popen([pwd + '/../../src/openmc -r ' + particle[0]], - stderr=PIPE, stdout=PIPE, shell=True) + particle = glob.glob(cwd + '/particle_10_394.*') + proc = Popen([opts.exe, '-r', particle[0], cwd], stderr=PIPE, stdout=PIPE) stdout, stderr = proc.communicate() - assert stderr == '' + assert stderr == '', 'Particle restart not successful.' def teardown(): - output = glob.glob(pwd + '/statepoint.*') + \ - glob.glob(pwd + '/particle_*') + \ - [pwd + '/results_test.dat'] + output = glob.glob(cwd + '/statepoint.*') + \ + glob.glob(cwd + '/particle_*') + \ + [cwd + '/results_test.dat'] for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_restart() + test_results() + test_run_restart() + teardown() From 05a8d948cf124f0c13cbf1e25a014f4fed89f9a3 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 11:39:48 -0500 Subject: [PATCH 17/51] converted plot and ptables tests --- .../test_plot_background.py | 37 +++++++++----- tests/test_plot_basis/test_plot_basis.py | 41 ++++++++++------ tests/test_plot_colspec/test_plot_colspec.py | 37 +++++++++----- tests/test_plot_mask/test_plot_mask.py | 41 ++++++++++------ tests/test_ptables_off/test_ptables_off.py | 49 ++++++++++++------- 5 files changed, 131 insertions(+), 74 deletions(-) diff --git a/tests/test_plot_background/test_plot_background.py b/tests/test_plot_background/test_plot_background.py index d8fc18f755..fdf786314c 100644 --- a/tests/test_plot_background/test_plot_background.py +++ b/tests/test_plot_background/test_plot_background.py @@ -2,30 +2,41 @@ import os from subprocess import Popen, STDOUT, PIPE -from nose_mpi import NoseMPI +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path, '-p'], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '-p', cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path, '-p'], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, '-p', cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_plot_exists(): - assert os.path.exists(pwd + '/1_plot.ppm') + assert os.path.exists(cwd + '/1_plot.ppm'), 'Plot ppm file does not exist.' def teardown(): - output = [pwd + '/1_plot.ppm'] + output = [cwd + '/1_plot.ppm'] for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_plot_exists() + teardown() diff --git a/tests/test_plot_basis/test_plot_basis.py b/tests/test_plot_basis/test_plot_basis.py index 86a4159200..2c650d8767 100644 --- a/tests/test_plot_basis/test_plot_basis.py +++ b/tests/test_plot_basis/test_plot_basis.py @@ -2,32 +2,43 @@ import os from subprocess import Popen, STDOUT, PIPE -from nose_mpi import NoseMPI +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path, '-p'], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '-p', cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path, '-p'], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, '-p', cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_plots_exists(): - assert os.path.exists(pwd + '/1_plot.ppm') - assert os.path.exists(pwd + '/2_plot.ppm') - assert os.path.exists(pwd + '/3_plot.ppm') + assert os.path.exists(cwd + '/1_plot.ppm'), 'Plot 1 result does not exist.' + assert os.path.exists(cwd + '/2_plot.ppm'), 'Plot 2 result does not exist.' + assert os.path.exists(cwd + '/3_plot.ppm'), 'Plot 3 result does not exist.' def teardown(): - output = [pwd + '/1_plot.ppm', pwd + '/2_plot.ppm', pwd + '/3_plot.ppm'] + output = [cwd + '/1_plot.ppm', cwd + '/2_plot.ppm', cwd + '/3_plot.ppm'] for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_plots_exists() + teardown() diff --git a/tests/test_plot_colspec/test_plot_colspec.py b/tests/test_plot_colspec/test_plot_colspec.py index d8fc18f755..fdf786314c 100644 --- a/tests/test_plot_colspec/test_plot_colspec.py +++ b/tests/test_plot_colspec/test_plot_colspec.py @@ -2,30 +2,41 @@ import os from subprocess import Popen, STDOUT, PIPE -from nose_mpi import NoseMPI +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path, '-p'], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '-p', cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path, '-p'], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, '-p', cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_plot_exists(): - assert os.path.exists(pwd + '/1_plot.ppm') + assert os.path.exists(cwd + '/1_plot.ppm'), 'Plot ppm file does not exist.' def teardown(): - output = [pwd + '/1_plot.ppm'] + output = [cwd + '/1_plot.ppm'] for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_plot_exists() + teardown() diff --git a/tests/test_plot_mask/test_plot_mask.py b/tests/test_plot_mask/test_plot_mask.py index 86a4159200..2c650d8767 100644 --- a/tests/test_plot_mask/test_plot_mask.py +++ b/tests/test_plot_mask/test_plot_mask.py @@ -2,32 +2,43 @@ import os from subprocess import Popen, STDOUT, PIPE -from nose_mpi import NoseMPI +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path, '-p'], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '-p', cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path, '-p'], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, '-p', cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_plots_exists(): - assert os.path.exists(pwd + '/1_plot.ppm') - assert os.path.exists(pwd + '/2_plot.ppm') - assert os.path.exists(pwd + '/3_plot.ppm') + assert os.path.exists(cwd + '/1_plot.ppm'), 'Plot 1 result does not exist.' + assert os.path.exists(cwd + '/2_plot.ppm'), 'Plot 2 result does not exist.' + assert os.path.exists(cwd + '/3_plot.ppm'), 'Plot 3 result does not exist.' def teardown(): - output = [pwd + '/1_plot.ppm', pwd + '/2_plot.ppm', pwd + '/3_plot.ppm'] + output = [cwd + '/1_plot.ppm', cwd + '/2_plot.ppm', cwd + '/3_plot.ppm'] for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_plots_exists() + teardown() diff --git a/tests/test_ptables_off/test_ptables_off.py b/tests/test_ptables_off/test_ptables_off.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_ptables_off/test_ptables_off.py +++ b/tests/test_ptables_off/test_ptables_off.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() From 1210f1044081534a33ee244b35dd559d862de357 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 11:48:58 -0500 Subject: [PATCH 18/51] converted reflective, rotation and sab tests --- .../test_reflective_cone.py | 49 ++++++++++++------- .../test_reflective_cylinder.py | 49 ++++++++++++------- .../test_reflective_plane.py | 49 ++++++++++++------- .../test_reflective_sphere.py | 49 ++++++++++++------- tests/test_rotation/test_rotation.py | 49 ++++++++++++------- tests/test_salphabeta/test_salphabeta.py | 49 ++++++++++++------- .../test_salphabeta_multiple.py | 49 ++++++++++++------- 7 files changed, 217 insertions(+), 126 deletions(-) diff --git a/tests/test_reflective_cone/test_reflective_cone.py b/tests/test_reflective_cone/test_reflective_cone.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_reflective_cone/test_reflective_cone.py +++ b/tests/test_reflective_cone/test_reflective_cone.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_reflective_cylinder/test_reflective_cylinder.py b/tests/test_reflective_cylinder/test_reflective_cylinder.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_reflective_cylinder/test_reflective_cylinder.py +++ b/tests/test_reflective_cylinder/test_reflective_cylinder.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_reflective_plane/test_reflective_plane.py b/tests/test_reflective_plane/test_reflective_plane.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_reflective_plane/test_reflective_plane.py +++ b/tests/test_reflective_plane/test_reflective_plane.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_reflective_sphere/test_reflective_sphere.py b/tests/test_reflective_sphere/test_reflective_sphere.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_reflective_sphere/test_reflective_sphere.py +++ b/tests/test_reflective_sphere/test_reflective_sphere.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_rotation/test_rotation.py b/tests/test_rotation/test_rotation.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_rotation/test_rotation.py +++ b/tests/test_rotation/test_rotation.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_salphabeta/test_salphabeta.py b/tests/test_salphabeta/test_salphabeta.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_salphabeta/test_salphabeta.py +++ b/tests/test_salphabeta/test_salphabeta.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_salphabeta_multiple/test_salphabeta_multiple.py b/tests/test_salphabeta_multiple/test_salphabeta_multiple.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_salphabeta_multiple/test_salphabeta_multiple.py +++ b/tests/test_salphabeta_multiple/test_salphabeta_multiple.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() From d815881d8c9d03f099e6d4c236729cb5e38500ff Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 12:55:04 -0500 Subject: [PATCH 19/51] converted over score tests --- tests/test_score_MT/test_score_MT.py | 54 ++++++++++++------- .../test_score_absorption.py | 53 +++++++++++------- .../test_score_current/test_score_current.py | 54 ++++++++++++------- tests/test_score_events/test_score_events.py | 54 ++++++++++++------- .../test_score_fission/test_score_fission.py | 54 ++++++++++++------- tests/test_score_flux/test_score_flux.py | 54 ++++++++++++------- .../test_score_kappafission.py | 54 ++++++++++++------- .../test_score_nufission.py | 54 ++++++++++++------- .../test_score_nuscatter.py | 54 ++++++++++++------- .../test_score_scatter/test_score_scatter.py | 54 ++++++++++++------- .../test_score_scatter_n.py | 54 ++++++++++++------- .../test_score_scatter_pn.py | 54 ++++++++++++------- tests/test_score_total/test_score_total.py | 54 ++++++++++++------- 13 files changed, 441 insertions(+), 260 deletions(-) diff --git a/tests/test_score_MT/test_score_MT.py b/tests/test_score_MT/test_score_MT.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_MT/test_score_MT.py +++ b/tests/test_score_MT/test_score_MT.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_absorption/test_score_absorption.py b/tests/test_score_absorption/test_score_absorption.py index 335d649dd7..435cb80ebc 100644 --- a/tests/test_score_absorption/test_score_absorption.py +++ b/tests/test_score_absorption/test_score_absorption.py @@ -3,47 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_current/test_score_current.py b/tests/test_score_current/test_score_current.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_current/test_score_current.py +++ b/tests/test_score_current/test_score_current.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_events/test_score_events.py b/tests/test_score_events/test_score_events.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_events/test_score_events.py +++ b/tests/test_score_events/test_score_events.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_fission/test_score_fission.py b/tests/test_score_fission/test_score_fission.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_fission/test_score_fission.py +++ b/tests/test_score_fission/test_score_fission.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_flux/test_score_flux.py b/tests/test_score_flux/test_score_flux.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_flux/test_score_flux.py +++ b/tests/test_score_flux/test_score_flux.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_kappafission/test_score_kappafission.py b/tests/test_score_kappafission/test_score_kappafission.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_kappafission/test_score_kappafission.py +++ b/tests/test_score_kappafission/test_score_kappafission.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_nufission/test_score_nufission.py b/tests/test_score_nufission/test_score_nufission.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_nufission/test_score_nufission.py +++ b/tests/test_score_nufission/test_score_nufission.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_nuscatter/test_score_nuscatter.py b/tests/test_score_nuscatter/test_score_nuscatter.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_nuscatter/test_score_nuscatter.py +++ b/tests/test_score_nuscatter/test_score_nuscatter.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_scatter/test_score_scatter.py b/tests/test_score_scatter/test_score_scatter.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_scatter/test_score_scatter.py +++ b/tests/test_score_scatter/test_score_scatter.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_scatter_n/test_score_scatter_n.py b/tests/test_score_scatter_n/test_score_scatter_n.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_scatter_n/test_score_scatter_n.py +++ b/tests/test_score_scatter_n/test_score_scatter_n.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_scatter_pn/test_score_scatter_pn.py b/tests/test_score_scatter_pn/test_score_scatter_pn.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_scatter_pn/test_score_scatter_pn.py +++ b/tests/test_score_scatter_pn/test_score_scatter_pn.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_score_total/test_score_total.py b/tests/test_score_total/test_score_total.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_score_total/test_score_total.py +++ b/tests/test_score_total/test_score_total.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() From ab296fc0ce041b788c6610d225772d3627a2b9b2 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 13:01:18 -0500 Subject: [PATCH 20/51] converted seed and source tests --- tests/test_seed/test_seed.py | 49 ++++++++++++------- .../test_source_angle_mono.py | 49 ++++++++++++------- .../test_source_energy_maxwell.py | 49 ++++++++++++------- .../test_source_energy_mono.py | 49 ++++++++++++------- tests/test_source_point/test_source_point.py | 49 ++++++++++++------- 5 files changed, 155 insertions(+), 90 deletions(-) diff --git a/tests/test_seed/test_seed.py b/tests/test_seed/test_seed.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_seed/test_seed.py +++ b/tests/test_seed/test_seed.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_source_angle_mono/test_source_angle_mono.py b/tests/test_source_angle_mono/test_source_angle_mono.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_source_angle_mono/test_source_angle_mono.py +++ b/tests/test_source_angle_mono/test_source_angle_mono.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_source_energy_maxwell/test_source_energy_maxwell.py b/tests/test_source_energy_maxwell/test_source_energy_maxwell.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_source_energy_maxwell/test_source_energy_maxwell.py +++ b/tests/test_source_energy_maxwell/test_source_energy_maxwell.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_source_energy_mono/test_source_energy_mono.py b/tests/test_source_energy_mono/test_source_energy_mono.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_source_energy_mono/test_source_energy_mono.py +++ b/tests/test_source_energy_mono/test_source_energy_mono.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_source_point/test_source_point.py b/tests/test_source_point/test_source_point.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_source_point/test_source_point.py +++ b/tests/test_source_point/test_source_point.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() From a0d19daa0517d7578e9e2806de63c4e578a0e682 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 13:21:54 -0500 Subject: [PATCH 21/51] converted statepoint tests --- .../test_statepoint_batch.py | 63 +++++---- .../test_statepoint_interval.py | 77 +++++++---- .../test_statepoint_restart.py | 129 ++++++++++-------- .../test_statepoint_sourcesep.py | 58 +++++--- 4 files changed, 195 insertions(+), 132 deletions(-) diff --git a/tests/test_statepoint_batch/test_statepoint_batch.py b/tests/test_statepoint_batch/test_statepoint_batch.py index ed4f7b2a7a..7dbce32cc0 100644 --- a/tests/test_statepoint_batch/test_statepoint_batch.py +++ b/tests/test_statepoint_batch/test_statepoint_batch.py @@ -3,48 +3,63 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoints_exist(): - statepoint = glob.glob(pwd + '/statepoint.3.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - statepoint = glob.glob(pwd + '/statepoint.6.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - statepoint = glob.glob(pwd + '/statepoint.9.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.3.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint.3 files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint.3 file is not a binary or hdf5 file.' + statepoint = glob.glob(cwd + '/statepoint.6.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint.6 files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint.6 file is not a binary or hdf5 file.' + statepoint = glob.glob(cwd + '/statepoint.9.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint.9 files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint.9 file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.9.*') + statepoint = glob.glob(cwd + '/statepoint.9.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_statepoints_exist() + test_results() + teardown() diff --git a/tests/test_statepoint_interval/test_statepoint_interval.py b/tests/test_statepoint_interval/test_statepoint_interval.py index 263ab37907..de42fc4e3a 100644 --- a/tests/test_statepoint_interval/test_statepoint_interval.py +++ b/tests/test_statepoint_interval/test_statepoint_interval.py @@ -4,54 +4,71 @@ import os import glob from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoints_exist(): - statepoint = glob.glob(pwd + '/statepoint.2.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - statepoint = glob.glob(pwd + '/statepoint.4.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - statepoint = glob.glob(pwd + '/statepoint.6.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - statepoint = glob.glob(pwd + '/statepoint.8.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.2.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint.2 files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint.2 file is not a binary or hdf5 file.' + statepoint = glob.glob(cwd + '/statepoint.4.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint.4 files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint.4 file is not a binary or hdf5 file.' + statepoint = glob.glob(cwd + '/statepoint.6.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint.6 files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint.6 file is not a binary or hdf5 file.' + statepoint = glob.glob(cwd + '/statepoint.8.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint.8 files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint.8 file is not a binary or hdf5 file.' + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint.10 files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint.10 file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_statepoints_exist() + test_results() + teardown() diff --git a/tests/test_statepoint_restart/test_statepoint_restart.py b/tests/test_statepoint_restart/test_statepoint_restart.py index 544c9197ec..8b0636d6da 100644 --- a/tests/test_statepoint_restart/test_statepoint_restart.py +++ b/tests/test_statepoint_restart/test_statepoint_restart.py @@ -3,118 +3,135 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.7.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.7.*') + statepoint = glob.glob(cwd + '/statepoint.7.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Initial test results do not agree.' def test_restart_form1(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path, - '-r', statepoint[0]], - stderr=STDOUT, stdout=PIPE) + statepoint = glob.glob(cwd + '/statepoint.7.*') + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, + '-r', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path, '-r', statepoint[0]], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, '-r', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC restart 1 did not exit successfully.' def test_created_statepoint_form1(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.7.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results_form1(): - statepoint = glob.glob(pwd + '/statepoint.7.*') + statepoint = glob.glob(cwd + '/statepoint.7.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Restart 1 test results do not agree.' def test_restart_form2(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path, - '--restart', statepoint[0]], - stderr=STDOUT, stdout=PIPE) + statepoint = glob.glob(cwd + '/statepoint.7.*') + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, + '--restart', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path, '--restart', statepoint[0]], - stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, '--restart', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC restart 2 did not exit successfully.' def test_created_statepoint_form2(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.7.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results_form2(): - statepoint = glob.glob(pwd + '/statepoint.7.*') + statepoint = glob.glob(cwd + '/statepoint.7.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Restart 2 test results do not agree.' def test_restart_serial(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - openmc_path = pwd + '/../../src/openmc' - proc = Popen([openmc_path, '--restart', statepoint[0]], - stderr=STDOUT, stdout=PIPE) + statepoint = glob.glob(cwd + '/statepoint.7.*') + proc = Popen([opts.exe, '--restart', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC restart serial did not exit successfully.' def test_created_statepoint_serial(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.7.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results_serial(): - statepoint = glob.glob(pwd + '/statepoint.7.*') + statepoint = glob.glob(cwd + '/statepoint.7.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare - + assert compare, 'Restart serial test results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.7.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.7.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + test_restart_form1() + test_created_statepoint_form1() + test_results_form1() + test_restart_form2() + test_created_statepoint_form2() + test_results_form2() + test_restart_serial() + test_created_statepoint_serial() + test_results_serial() + teardown() diff --git a/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py b/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py index ca1c9966a4..b21720ef57 100644 --- a/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py +++ b/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - source = glob.glob(pwd + '/source.10.*') - assert len(statepoint) == 1 - assert source[0].endswith('binary') or source[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' + source = glob.glob(cwd + '/source.10.*') + assert len(source) == 1, 'Either multiple or no source files exist.' + assert source[0].endswith('binary') or source[0].endswith('h5'),\ + 'Source file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output += glob.glob(pwd + '/source.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output += glob.glob(cwd + '/source.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_statepoint_exists() + test_results() + teardown() From e915e5db181e9b7a09198910ec23a9e823d73b68 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 13:41:24 -0500 Subject: [PATCH 22/51] converted rest of tests --- .../test_survival_biasing.py | 49 +++++++----- .../test_tally_assumesep.py | 54 +++++++++----- tests/test_trace/test_trace.py | 49 +++++++----- tests/test_track_output/test_track_output.py | 74 ++++++++++--------- tests/test_translation/test_translation.py | 49 +++++++----- tests/test_uniform_fs/test_uniform_fs.py | 49 +++++++----- tests/test_universe/test_universe.py | 49 +++++++----- tests/test_void/test_void.py | 49 +++++++----- 8 files changed, 260 insertions(+), 162 deletions(-) diff --git a/tests/test_survival_biasing/test_survival_biasing.py b/tests/test_survival_biasing/test_survival_biasing.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_survival_biasing/test_survival_biasing.py +++ b/tests/test_survival_biasing/test_survival_biasing.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_tally_assumesep/test_tally_assumesep.py b/tests/test_tally_assumesep/test_tally_assumesep.py index 151df366bd..435cb80ebc 100644 --- a/tests/test_tally_assumesep/test_tally_assumesep.py +++ b/tests/test_tally_assumesep/test_tally_assumesep.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(pwd + '/tallies.out') + assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/tallies.out') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/tallies.out') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_output_exists() + test_results() + teardown() diff --git a/tests/test_trace/test_trace.py b/tests/test_trace/test_trace.py index a518ab7731..d9511551ac 100644 --- a/tests/test_trace/test_trace.py +++ b/tests/test_trace/test_trace.py @@ -3,44 +3,57 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) stdout = proc.communicate()[0] print(stdout) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' assert stdout.find('Simulating Particle 453') != -1 def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_track_output/test_track_output.py b/tests/test_track_output/test_track_output.py index 0e7674154c..25c9449c51 100644 --- a/tests/test_track_output/test_track_output.py +++ b/tests/test_track_output/test_track_output.py @@ -4,38 +4,32 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp import glob +from optparse import OptionParser -from nose.plugins.skip import SkipTest - -from nose_mpi import NoseMPI - -pwd = os.path.dirname(__file__) - - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) - +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], - stderr=STDOUT, stdout=PIPE) + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], + stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) - returncode = proc.wait() + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) - assert returncode == 0 - + returncode = proc.returncode + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_outputs(): - outputs = [glob.glob(''.join((pwd, '/track_1_1_1.*')))] - outputs.append(glob.glob(''.join((pwd, '/track_1_1_2.*')))) + outputs = [glob.glob(''.join((cwd, '/track_1_1_1.*')))] + outputs.append(glob.glob(''.join((cwd, '/track_1_1_2.*')))) for files in outputs: - assert len(files) == 1 - assert files[0].endswith('binary') or files[0].endswith('h5') - + assert len(files) == 1, 'Multiple or no track files detected.' + assert files[0].endswith('binary') or files[0].endswith('h5'),\ + 'Track files not a binary or hdf5 file' def test_outputs(): # If vtk python module is not available, we can't run track.py so skip this @@ -43,23 +37,35 @@ def test_outputs(): try: import vtk except ImportError: - raise SkipTest + print('----------------Skipping test-------------') + return call(['../../src/utils/track.py', '-o', 'poly'] + - glob.glob(''.join((pwd, '/track*')))) - poly = ''.join((pwd, '/poly.pvtp')) - assert os.path.isfile(poly) - metric = ''.join((pwd, '/true_poly.pvtp')) + glob.glob(''.join((cwd, '/track*')))) + poly = ''.join((cwd, '/poly.pvtp')) + assert os.path.isfile(poly), 'poly.pvtp file not found.' + metric = ''.join((cwd, '/true_poly.pvtp')) compare = filecmp.cmp(poly, metric) if not compare: os.rename('poly.pvtp', 'error_poly.pvtp') - assert compare - + assert compare, 'Results to not agree' def teardown(): - temp_files = glob.glob(''.join((pwd, '/statepoint*'))) - temp_files = temp_files + glob.glob(''.join((pwd, '/track*'))) - temp_files = temp_files + glob.glob(''.join((pwd, '/poly*'))) + temp_files = glob.glob(''.join((cwd, '/statepoint*'))) + temp_files = temp_files + glob.glob(''.join((cwd, '/track*'))) + temp_files = temp_files + glob.glob(''.join((cwd, '/poly*'))) for f in temp_files: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_outputs() + test_outputs() + teardown() diff --git a/tests/test_translation/test_translation.py b/tests/test_translation/test_translation.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_translation/test_translation.py +++ b/tests/test_translation/test_translation.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_uniform_fs/test_uniform_fs.py b/tests/test_uniform_fs/test_uniform_fs.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_uniform_fs/test_uniform_fs.py +++ b/tests/test_uniform_fs/test_uniform_fs.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_universe/test_universe.py b/tests/test_universe/test_universe.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_universe/test_universe.py +++ b/tests/test_universe/test_universe.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() diff --git a/tests/test_void/test_void.py b/tests/test_void/test_void.py index 64d20b6115..54733fb13c 100644 --- a/tests/test_void/test_void.py +++ b/tests/test_void/test_void.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + teardown() From 22b298f9c12225dabfc0449e38a429265705179b Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 25 Feb 2014 17:09:59 -0500 Subject: [PATCH 23/51] MPI_DIR is not a env. var in CMakeLists for testing --- src/CMakeLists.txt | 4 +--- tests/run_tests.py | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1217811411..3ceaaaaceb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,7 +31,6 @@ if($ENV{FC} MATCHES "mpi.*") message("-- Detected MPI wrapper: $ENV{FC}") add_definitions(-DMPI) set(MPI_ENABLED TRUE) - get_filename_component(MPI_DIR $ENV{FC} PATH) elseif($ENV{FC} MATCHES "h5fc$") message("-- Detected HDF5 wrapper: $ENV{FC}") add_definitions(-DHDF5) @@ -39,7 +38,6 @@ elseif($ENV{FC} MATCHES "h5pfc$") message("-- Detected parallel HDF5 wrapper: $ENV{FC}") add_definitions(-DMPI -DHDF5) set(MPI_ENABLED TRUE) - get_filename_component(MPI_DIR $ENV{FC} PATH) endif() #=============================================================================== @@ -252,7 +250,7 @@ foreach(test ${TESTS}) add_test(NAME ${TEST_NAME} WORKING_DIRECTORY ${TEST_PATH} COMMAND ${PYTHON_EXECUTABLE} ${TEST_NAME} --exe $ - --mpi_exec ${MPI_DIR}/mpiexec) + --mpi_exec $ENV{MPI_DIR}/bin/mpiexec) else(${MPI_ENABLED}) diff --git a/tests/run_tests.py b/tests/run_tests.py index 7d518673ad..9d686b68a6 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -55,6 +55,8 @@ class Test(object): if self.petsc: self.cmake.append('-Dpetsc=on') os.environ['PETSC_DIR'] = PETSC_DIR + if self.mpi: + os.environ['MPI_DIR'] = MPI_DIR def run_cmake(self): os.environ['FC'] = self.fc From 94535a0fbeb0c96e6bc9d4e84126b46a75ea68f2 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 11 Mar 2014 18:59:37 -0400 Subject: [PATCH 24/51] converted new tests to ctest format --- tests/test_source_file/test_source_file.py | 71 +++++---- .../test_sourcepoint_batch.py | 49 +++--- .../test_sourcepoint_interval.py | 49 +++--- .../test_sourcepoint_latest.py | 58 ++++--- .../test_sourcepoint_restart.py | 143 ++++++++++-------- 5 files changed, 222 insertions(+), 148 deletions(-) diff --git a/tests/test_source_file/test_source_file.py b/tests/test_source_file/test_source_file.py index 85a33c0313..3eca852d57 100644 --- a/tests/test_source_file/test_source_file.py +++ b/tests/test_source_file/test_source_file.py @@ -3,10 +3,15 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() settings1=""" @@ -45,57 +50,67 @@ settings2 = """ """ -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) - def test_run1(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - source = glob.glob(pwd + '/source.10.*') - assert len(statepoint) == 1 - assert source[0].endswith('binary') or source[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' + source = glob.glob(cwd + '/source.10.*') + assert len(statepoint) == 1, 'Either multple or no source files exist.' + assert source[0].endswith('binary') or source[0].endswith('h5'),\ + 'Source file is not a binary or hdf5 file.' def test_run2(): - openmc_path = pwd + '/../../src/openmc' - source = glob.glob(pwd + '/source.10.*') + openmc_path = cwd + '/../../src/openmc' + source = glob.glob(cwd + '/source.10.*') with open('settings.xml','w') as fh: fh.write(settings2.format(source[0].split('.')[2])) - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): with open('settings.xml','w') as fh: fh.write(settings1) - output = glob.glob(pwd + '/statepoint.10.*') - output += glob.glob(pwd + '/source.10.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output += glob.glob(cwd + '/source.10.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run1() + test_statepoint_exists() + test_run2() + test_results() + teardown() diff --git a/tests/test_sourcepoint_batch/test_sourcepoint_batch.py b/tests/test_sourcepoint_batch/test_sourcepoint_batch.py index 78d202e405..f62ddacf9e 100644 --- a/tests/test_sourcepoint_batch/test_sourcepoint_batch.py +++ b/tests/test_sourcepoint_batch/test_sourcepoint_batch.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(pwd + '/statepoint.*') - assert len(statepoint) == 5 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.*') + assert len(statepoint) == 5, '5 statepoint files must exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file detected that is not binary or hdf5.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.8.*') + statepoint = glob.glob(cwd + '/statepoint.8.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do no agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_statepoint_exists() + test_results() + teardown() diff --git a/tests/test_sourcepoint_interval/test_sourcepoint_interval.py b/tests/test_sourcepoint_interval/test_sourcepoint_interval.py index 78d202e405..52aa3b2d24 100644 --- a/tests/test_sourcepoint_interval/test_sourcepoint_interval.py +++ b/tests/test_sourcepoint_interval/test_sourcepoint_interval.py @@ -3,42 +3,55 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(pwd + '/statepoint.*') - assert len(statepoint) == 5 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.*') + assert len(statepoint) == 5, '5 statepoint files must exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file detected that is not binary or hdf5.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.8.*') + statepoint = glob.glob(cwd + '/statepoint.8.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_statepoint_exists() + test_results() + teardown() diff --git a/tests/test_sourcepoint_latest/test_sourcepoint_latest.py b/tests/test_sourcepoint_latest/test_sourcepoint_latest.py index d26533843f..cdf6d560b4 100644 --- a/tests/test_sourcepoint_latest/test_sourcepoint_latest.py +++ b/tests/test_sourcepoint_latest/test_sourcepoint_latest.py @@ -3,46 +3,60 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - source = glob.glob(pwd + '/source.*') - assert len(source) == 1 - assert source[0].endswith('binary') or source[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Either multiple or no statepoint file exists.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' + source = glob.glob(cwd + '/source.*') + assert len(source) == 1, 'Either multple or no source file exists.' + assert source[0].endswith('binary') or source[0].endswith('h5'),\ + 'Source file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.10.*') - output += glob.glob(pwd + '/source.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.10.*') + output += glob.glob(cwd + '/source.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_statepoint_exists() + test_results() + teardown() diff --git a/tests/test_sourcepoint_restart/test_sourcepoint_restart.py b/tests/test_sourcepoint_restart/test_sourcepoint_restart.py index 0eaf1198cc..a67f078da6 100644 --- a/tests/test_sourcepoint_restart/test_sourcepoint_restart.py +++ b/tests/test_sourcepoint_restart/test_sourcepoint_restart.py @@ -3,127 +3,146 @@ import os from subprocess import Popen, STDOUT, PIPE, call import filecmp -from nose_mpi import NoseMPI import glob +from optparse import OptionParser -pwd = os.path.dirname(__file__) - -def setup(): - os.putenv('PWD', pwd) - os.chdir(pwd) +parser = OptionParser() +parser.add_option('--mpi_exec', dest='mpi_exec', default='') +parser.add_option('--mpi_np', dest='mpi_np', default='3') +parser.add_option('--exe', dest='exe') +(opts, args) = parser.parse_args() +cwd = os.getcwd() def test_run(): - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path], + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(pwd + '/statepoint.*') - assert len(statepoint) == 2 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') - sourcepoint = glob.glob(pwd + '/source.7.*') - assert len(sourcepoint) == 1 - assert sourcepoint[0].endswith('binary') or sourcepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.*') + assert len(statepoint) == 2, '2 statepoint files must exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file must either be binary or hdf5.' + sourcepoint = glob.glob(cwd + '/source.7.*') + assert len(sourcepoint) == 1, 'Either multiple or no source files found.' + assert sourcepoint[0].endswith('binary') or sourcepoint[0].endswith('h5'),\ + 'Source file must either be binary or hdf5.' def test_results(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Results do not agree.' os.remove(statepoint[0]) def test_restart_form1(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - sourcepoint = glob.glob(pwd + '/source.7.*') - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path, - '-r', statepoint[0], sourcepoint[0]], - stderr=STDOUT, stdout=PIPE) + statepoint = glob.glob(cwd + '/statepoint.7.*') + sourcepoint = glob.glob(cwd + '/source.7.*') + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, + '-r', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path, '-r', statepoint[0], sourcepoint[0]], stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, '-r', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC restart 1 did not exit successfully.' def test_created_statepoint_form1(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Batch 10 statepoint file does not exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file must be a binary or hdf5 file.' def test_results_form1(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Restart 1 results do not agree.' os.remove(statepoint[0]) def test_restart_form2(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - sourcepoint = glob.glob(pwd + '/source.7.*') - openmc_path = pwd + '/../../src/openmc' - if int(NoseMPI.mpi_np) > 0: - proc = Popen([NoseMPI.mpi_exec, '-np', NoseMPI.mpi_np, openmc_path, - '--restart', statepoint[0], sourcepoint[0]], - stderr=STDOUT, stdout=PIPE) + statepoint = glob.glob(cwd + '/statepoint.7.*') + sourcepoint = glob.glob(cwd + '/source.7.*') + if opts.mpi_exec != '': + proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, + '--restart', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) else: - proc = Popen([openmc_path, '--restart', statepoint[0], sourcepoint[0]], - stderr=STDOUT, stdout=PIPE) + proc = Popen([opts.exe, '--restart', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC restart 2 did not exit successfully.' def test_created_statepoint_form2(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Batch 10 statepoint file does not exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file not a binary or hdf5 file.' def test_results_form2(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Restart 2 results do not agree.' os.remove(statepoint[0]) def test_restart_serial(): - statepoint = glob.glob(pwd + '/statepoint.7.*') - sourcepoint = glob.glob(pwd + '/source.7.*') - openmc_path = pwd + '/../../src/openmc' - proc = Popen([openmc_path, '--restart', statepoint[0], sourcepoint[0]], - stderr=STDOUT, stdout=PIPE) + statepoint = glob.glob(cwd + '/statepoint.7.*') + sourcepoint = glob.glob(cwd + '/source.7.*') + proc = Popen([opts.exe, '--restart', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode - assert returncode == 0 + assert returncode == 0, 'OpenMC restart serial did not exit successfully.' def test_created_statepoint_serial(): - statepoint = glob.glob(pwd + '/statepoint.10.*') - assert len(statepoint) == 1 - assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5') + statepoint = glob.glob(cwd + '/statepoint.10.*') + assert len(statepoint) == 1, 'Batch 10 statepoint file does not exist.' + assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ + 'Statepoint file is not a binary or hdf5 file.' def test_results_serial(): - statepoint = glob.glob(pwd + '/statepoint.10.*') + statepoint = glob.glob(cwd + '/statepoint.10.*') call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: os.rename('results_test.dat', 'results_error.dat') - assert compare + assert compare, 'Serial results do not agree.' def teardown(): - output = glob.glob(pwd + '/statepoint.*') - output += glob.glob(pwd + '/source.*') - output.append(pwd + '/results_test.dat') + output = glob.glob(cwd + '/statepoint.*') + output += glob.glob(cwd + '/source.*') + output.append(cwd + '/results_test.dat') for f in output: if os.path.exists(f): os.remove(f) + +if __name__ == '__main__': + + # test for openmc executable + if opts.exe == None: + raise Exception('Must specify OpenMC executable from command line with --exe.') + + # run tests + test_run() + test_created_statepoint() + test_results() + test_restart_form1() + test_created_statepoint_form1() + test_results_form1() + test_restart_form2() + test_created_statepoint_form2() + test_results_form2() + test_restart_serial() + test_created_statepoint_serial() + test_results_serial() + teardown() From c2ad32f089492eec11f4d1b98883233bc5fada3a Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 12 Mar 2014 10:06:53 -0400 Subject: [PATCH 25/51] fixed missing line of code removed by merge --- tests/run_tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/run_tests.py b/tests/run_tests.py index 40ab8c91b6..9d686b68a6 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -138,6 +138,7 @@ if len(sys.argv) > 1: try: tests__.index(j) except ValueError: + tests__.append(j) # Test name specified on command line else: From 7006c3a2b1a93b8b3aaecf61485344fa0456c87f Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 28 Mar 2014 17:14:27 -0400 Subject: [PATCH 26/51] Add test target to Makefile. --- src/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 9c295176a0..990f22d9d3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,7 +6,9 @@ clean: make -s -C build clean distclean: rm -fr build +test: + make -s -C build test install: make -s -C build install -.PHONY: all clean distclean install +.PHONY: all clean distclean test install From 15b7edb21b673ea53f17e436de812e5acd032dee Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 2 Apr 2014 16:47:59 -0400 Subject: [PATCH 27/51] added new command line options for better control over tests --- tests/run_tests.py | 48 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 9d686b68a6..9aa99a8e85 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -7,6 +7,13 @@ import sys import shutil from subprocess import call from collections import OrderedDict +from optparse import OptionParser + +parser = OptionParser() +parser.add_option('-j', '--parallel', dest='n_procs') +parser.add_option('-R', '--tests-regex', dest='regex_tests') +parser.add_option('-c', '--configure', dest='configs') +(opts, args) = parser.parse_args() # Compiler paths FC_DEFAULT='gfortran' @@ -68,7 +75,17 @@ class Test(object): def run_make(self): if not self.success: return - rc = call(['make','-j', '-s','-C','build']) + + # Default make string + make_list = ['make','-s'] + + # Check for parallel + if opts.n_procs != None: + make_list.append('-j') + make_list.append(opts.n_procs) + + # Run make + rc = call(make_list) if rc != 0: self.success = False self.msg = 'Failed on make.' @@ -76,7 +93,22 @@ class Test(object): def run_ctests(self): if not self.success: return - rc = call(['make','test','-C','build']) + + # Default ctest string + ctest_list = ['ctest'] + + # Check for parallel + if opts.n_procs != None: + ctest_list.append('-j') + ctest_list.append(opts.n_procs) + + # Check for subset of tests + if opts.regex_tests != None: + ctest_list.append('-R') + ctest_list.append(opts.regex_tests) + + # Run ctests + rc = call(ctest_list) if rc != 0: self.success = False self.msg = 'Failed on testing.' @@ -121,9 +153,8 @@ add_test('omp-phdf5-petsc-debug', openmp=True, mpi=True, hdf5=True, petsc=True, add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=True, optimize=True) # Process command line arguments -if len(sys.argv) > 1: - flags = [i for i in sys.argv[1:] if i.startswith('-')] - tests_ = [i for i in sys.argv[1:] if not i.startswith('-')] +if opts.configs != None: + tests_ = opts.configs.split() # Check for special subsets of tests tests__ = [] @@ -161,16 +192,21 @@ for test in iter(tests): print(test + ' tests') print('-'*(len(test) + 6)) - # Run CMAKE to configure build tests[test].run_cmake() + # Go into build directory + os.chdir('build') + # Build OpenMC tests[test].run_make() # Run tests tests[test].run_ctests() + # Leave build directory + os.chdir('..') + # Copy test log file if failed if tests[test].msg == 'Failed on testing.': shutil.copy('build/Testing/Temporary/LastTest.log', From 032a21c45fba3b90e7e6018a62170f00ae45a0b4 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 2 Apr 2014 17:21:00 -0400 Subject: [PATCH 28/51] added regular expression searching for test configurations --- tests/run_tests.py | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 9aa99a8e85..1df65e88ba 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -5,6 +5,7 @@ from __future__ import print_function import os import sys import shutil +import re from subprocess import call from collections import OrderedDict from optparse import OptionParser @@ -152,37 +153,10 @@ add_test('omp-phdf5-petsc-normal', openmp=True, mpi=True, hdf5=True, petsc=True) add_test('omp-phdf5-petsc-debug', openmp=True, mpi=True, hdf5=True, petsc=True, debug=True) add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=True, optimize=True) -# Process command line arguments +# Delete items of dictionary that don't match regular expression if opts.configs != None: - tests_ = opts.configs.split() - - # Check for special subsets of tests - tests__ = [] - for i in tests_: - - # This checks for any subsets of tests. The string after - # all-XXXX will be used to search through all tests. - if i.startswith('all-'): - suffix = i.split('all-')[1] - for j in tests: - if j.rfind(suffix) != -1: - try: - tests__.index(j) - except ValueError: - tests__.append(j) - - # Test name specified on command line - else: - try: - tests__.index(i) - except ValueError: - tests__.append(i) # append specific test (e.g., mpi-debug) - - # Delete items of dictionary that are not in tests__ for key in iter(tests): - try: - tests__.index(key) - except ValueError: + if not re.search(opts.configs, key): del tests[key] # Begin testing From 3187698adc650d34007b2f69e22c0451701dde35 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 2 Apr 2014 20:14:45 -0400 Subject: [PATCH 29/51] added usage printing --- tests/run_tests.py | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 1df65e88ba..320fd71521 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -11,9 +11,20 @@ from collections import OrderedDict from optparse import OptionParser parser = OptionParser() -parser.add_option('-j', '--parallel', dest='n_procs') -parser.add_option('-R', '--tests-regex', dest='regex_tests') -parser.add_option('-c', '--configure', dest='configs') +parser.add_option('-j', '--parallel', dest='n_procs', + help="Number of parallel jobs.") +parser.add_option('-R', '--tests-regex', dest='regex_tests', + help="Run tests matching regular expression. \ + Test names are the directories present in tests folder.\ + This uses standard regex syntax to select tests.") +parser.add_option('-C', '--build-config', dest='build_config', + help="Build configurations matching regular expression. \ + Specific build configurations can be printed out with \ + optional argument -p, --print. This uses standard \ + regex syntax to select build configurations.") +parser.add_option('-p', '--print', action="store_true", + dest="print_build_configs", default=False, + help="Print out build configurations.") (opts, args) = parser.parse_args() # Compiler paths @@ -150,13 +161,27 @@ add_test('phdf5-petsc-normal', mpi=True, hdf5=True, petsc=True) add_test('phdf5-petsc-debug', mpi=True, hdf5=True, petsc=True, debug=True) add_test('phdf5-petsc-optimize', mpi=True, hdf5=True, petsc=True, optimize=True) add_test('omp-phdf5-petsc-normal', openmp=True, mpi=True, hdf5=True, petsc=True) -add_test('omp-phdf5-petsc-debug', openmp=True, mpi=True, hdf5=True, petsc=True, debug=True) -add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=True, optimize=True) +add_test('omp-phdf5-petsc-debug', openmp=True, mpi=True, hdf5=True, petsc=True, + debug=True) +add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=True, + optimize=True) + +# Check to see if we are to just print build configuratinos +if opts.print_build_configs: + for key in iter(tests): + print('Configuration Name: {0}'.format(key)) + print(' Debug Flags:..........{0}'.format(tests[key].debug)) + print(' Optimization Flags:...{0}'.format(tests[key].optimize)) + print(' HDF5 Active:..........{0}'.format(tests[key].hdf5)) + print(' MPI Active:...........{0}'.format(tests[key].mpi)) + print(' OpenMP Active:........{0}'.format(tests[key].openmp)) + print(' PETSc Active:.........{0}\n'.format(tests[key].petsc)) + exit() # Delete items of dictionary that don't match regular expression -if opts.configs != None: +if opts.build_config != None: for key in iter(tests): - if not re.search(opts.configs, key): + if not re.search(opts.build_config, key): del tests[key] # Begin testing From 8da770c4cf6bb14658c33c852e482a90343cdc24 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 2 Apr 2014 20:27:27 -0400 Subject: [PATCH 30/51] updated test suite readme --- tests/readme.rst | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/tests/readme.rst b/tests/readme.rst index fcc4d737fc..139a6da2a8 100644 --- a/tests/readme.rst +++ b/tests/readme.rst @@ -4,29 +4,37 @@ OpenMC Test Suite The purpose of this test suite is to ensure that OpenMC compiles using various combinations of compiler flags and options and that all user input options can -be used successfully without breaking the code. The test suite is by no means -complete and should not be viewed as a comprehensive unit test suite will full -coverage. Until more effort can be put into actual unit testing, this suite is a -simple means of making sure that new features added into the code don't break -existing features. +be used successfully without breaking the code. The test suite is based on +regression or integrated testing where different types of input files are +configured and the full OpenMC code is executed. Results from simulations +are compared with expected results. The test suite is comprised of many +build configurations (e.g. debug, mpi, hdf5) and the actual tests which +reside in sub-directories in the tests directory. -The test suite is designed to run with the third-party Python package -nose_. Running the test suite is as simple as going to the tests/ directory and -running: +The test suite is designed to integrate with cmake using ctest_. To run the +full test suite run: .. sh:: - nosetests + python run_tests.py -However, usually testing is split into two parts: compilation and running. To -run the compilation tests, use: +A subset of build configurations and/or tests can be run. To see how to use +the script run: .. sh:: - nosetests test_compile + python run_tests.py --help -Then, to run all the normal tests (which require that an OpenMC executable is -already built): +As an example, say we want to run all tests with debug flags only on tests +that have cone and plot in their name. Also, we would like to run this on +4 processors. We can run: .. sh:: - nosetests --exclude-dir=test_compile + python run_tests.py -j 4 -C debug -R "cone|plot" -.. _nose: https://nose.readthedocs.org +Note that standard regular expression syntax is used for selecting build +configurations and tests. To print out a list of build configurations, we +can run: + +.. sh:: + python run_tests.py -p + +.. _ctest: http://www.cmake.org/cmake/help/v2.8.8/ctest.html From 809f1640f7e47d0bf52a2dd04cd109be6b3adfaa Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 2 Apr 2014 20:34:36 -0400 Subject: [PATCH 31/51] added initial documentation on test suite --- docs/source/devguide/workflow.rst | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index f3793628af..b3733fab8b 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -91,6 +91,50 @@ features and bug fixes. The general steps for contributing are as follows: 6. After the pull request has been thoroughly vetted, it is merged back into the *develop* branch of mit-crpg/openmc. +OpenMC Test Suite +----------------- + +The purpose of this test suite is to ensure that OpenMC compiles using various +combinations of compiler flags and options and that all user input options can +be used successfully without breaking the code. The test suite is based on +regression or integrated testing where different types of input files are +configured and the full OpenMC code is executed. Results from simulations +are compared with expected results. The test suite is comprised of many +build configurations (e.g. debug, mpi, hdf5) and the actual tests which +reside in sub-directories in the tests directory. + +The test suite is designed to integrate with cmake using ctest_. To run the +full test suite run: + +.. code-block:: sh + + python run_tests.py + +A subset of build configurations and/or tests can be run. To see how to use +the script run: + +.. code-block:: sh + + python run_tests.py --help + +As an example, say we want to run all tests with debug flags only on tests +that have cone and plot in their name. Also, we would like to run this on +4 processors. We can run: + +.. code-block:: sh + + python run_tests.py -j 4 -C debug -R "cone|plot" + +Note that standard regular expression syntax is used for selecting build +configurations and tests. To print out a list of build configurations, we +can run: + +.. code-block:: sh + + python run_tests.py -p + +.. _ctest: http://www.cmake.org/cmake/help/v2.8.8/ctest.html + Private Development ------------------- From 9c43d1ec3f5adcebb6cca409b0f26d58d6267b03 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 2 Apr 2014 20:38:51 -0400 Subject: [PATCH 32/51] fixed some syntax --- docs/source/devguide/workflow.rst | 3 +-- tests/readme.rst | 16 ++++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index b3733fab8b..78dfb6b5f3 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -38,7 +38,7 @@ following criteria must be satisfied for all proposed changes: - Changes have a clear purpose and are useful. - Compiles under all conditions (MPI, OpenMP, HDF5, etc.). This is checked as - part of the test suite (see `test_compile.py`_). + part of the test suite. - Passes the regression suite. - If appropriate, test cases are added to regression suite. - No memory leaks (checked with valgrind_). @@ -152,7 +152,6 @@ from your private repository into a public fork. .. _git: http://git-scm.com/ .. _GitHub: https://github.com/ .. _git flow: http://nvie.com/git-model -.. _test_compile.py: https://github.com/mit-crpg/openmc/blob/develop/tests/test_compile/test_compile.py .. _valgrind: http://valgrind.org/ .. _style guide: http://mit-crpg.github.io/openmc/devguide/styleguide.html .. _pull request: https://help.github.com/articles/using-pull-requests diff --git a/tests/readme.rst b/tests/readme.rst index 139a6da2a8..3a340582b7 100644 --- a/tests/readme.rst +++ b/tests/readme.rst @@ -5,7 +5,7 @@ OpenMC Test Suite The purpose of this test suite is to ensure that OpenMC compiles using various combinations of compiler flags and options and that all user input options can be used successfully without breaking the code. The test suite is based on -regression or integrated testing where different types of input files are +regression or integrated testing where different types of input files are configured and the full OpenMC code is executed. Results from simulations are compared with expected results. The test suite is comprised of many build configurations (e.g. debug, mpi, hdf5) and the actual tests which @@ -14,27 +14,31 @@ reside in sub-directories in the tests directory. The test suite is designed to integrate with cmake using ctest_. To run the full test suite run: -.. sh:: +.. code-block:: sh + python run_tests.py A subset of build configurations and/or tests can be run. To see how to use the script run: -.. sh:: +.. code-block:: sh + python run_tests.py --help As an example, say we want to run all tests with debug flags only on tests -that have cone and plot in their name. Also, we would like to run this on +that have cone and plot in their name. Also, we would like to run this on 4 processors. We can run: -.. sh:: +.. code-block:: sh + python run_tests.py -j 4 -C debug -R "cone|plot" Note that standard regular expression syntax is used for selecting build configurations and tests. To print out a list of build configurations, we can run: -.. sh:: +.. code-block:: sh + python run_tests.py -p .. _ctest: http://www.cmake.org/cmake/help/v2.8.8/ctest.html From cd2a44c428e25fca4ae3d1c932f2f8b691cde55b Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Wed, 2 Apr 2014 20:49:14 -0400 Subject: [PATCH 33/51] added more documentation on testing single build --- docs/source/devguide/workflow.rst | 5 +++-- docs/source/usersguide/install.rst | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index 78dfb6b5f3..d33a282c7a 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -91,6 +91,8 @@ features and bug fixes. The general steps for contributing are as follows: 6. After the pull request has been thoroughly vetted, it is merged back into the *develop* branch of mit-crpg/openmc. +.. _test suite: + OpenMC Test Suite ----------------- @@ -133,8 +135,6 @@ can run: python run_tests.py -p -.. _ctest: http://www.cmake.org/cmake/help/v2.8.8/ctest.html - Private Development ------------------- @@ -158,3 +158,4 @@ from your private repository into a public fork. .. _mit-crpg/openmc: https://github.com/mit-crpg/openmc .. _paid plan: https://github.com/plans .. _Bitbucket: https://bitbucket.org +.. _ctest: http://www.cmake.org/cmake/help/v2.8.8/ctest.html diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index 313372fa6b..ee196552df 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -322,6 +322,29 @@ This will build an executable named ``openmc``. .. _MinGW: http://www.mingw.org .. _SourceForge: http://sourceforge.net/projects/mingw +Testing Build +------------- + +If you have ENDF/B-VII.0 cross sections from MCNP5/X you can test your build. +There are two ways to run tests. The first is to use the Makefile present in +the source directory and run the following: + +.. code-block:: sh + + cd src + make test + +If you want more options for testing you can use ctest_ command. For example, +if we wanted to run only the plot tests with 4 processors, we run: + +.. code-block:: sh + + cd src/build + ctest -j 4 -R plot + +If you want to run the full test suite with different build options please +refer to our :ref:`test suite` documentation. + --------------------------- Cross Section Configuration --------------------------- @@ -467,3 +490,4 @@ schemas.xml file in your own OpenMC source directory. .. _GNU Emacs: http://www.gnu.org/software/emacs/ .. _validation: http://en.wikipedia.org/wiki/XML_validation .. _RELAX NG: http://relaxng.org/ +.. _ctest: http://www.cmake.org/cmake/help/v2.8.8/ctest.html From e94f84c1e213a58cbf7cfa103973cd8b1dba01e6 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Thu, 3 Apr 2014 07:40:14 -0400 Subject: [PATCH 34/51] addresses @paulromano comments for python syntax and ctest version --- docs/source/devguide/workflow.rst | 2 +- docs/source/usersguide/install.rst | 2 +- tests/readme.rst | 2 +- tests/run_tests.py | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index d33a282c7a..523fba32b2 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -158,4 +158,4 @@ from your private repository into a public fork. .. _mit-crpg/openmc: https://github.com/mit-crpg/openmc .. _paid plan: https://github.com/plans .. _Bitbucket: https://bitbucket.org -.. _ctest: http://www.cmake.org/cmake/help/v2.8.8/ctest.html +.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html diff --git a/docs/source/usersguide/install.rst b/docs/source/usersguide/install.rst index ee196552df..45e7671f52 100644 --- a/docs/source/usersguide/install.rst +++ b/docs/source/usersguide/install.rst @@ -490,4 +490,4 @@ schemas.xml file in your own OpenMC source directory. .. _GNU Emacs: http://www.gnu.org/software/emacs/ .. _validation: http://en.wikipedia.org/wiki/XML_validation .. _RELAX NG: http://relaxng.org/ -.. _ctest: http://www.cmake.org/cmake/help/v2.8.8/ctest.html +.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html diff --git a/tests/readme.rst b/tests/readme.rst index 3a340582b7..7c4d29e438 100644 --- a/tests/readme.rst +++ b/tests/readme.rst @@ -41,4 +41,4 @@ can run: python run_tests.py -p -.. _ctest: http://www.cmake.org/cmake/help/v2.8.8/ctest.html +.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html diff --git a/tests/run_tests.py b/tests/run_tests.py index 320fd71521..1e9f28238a 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -92,7 +92,7 @@ class Test(object): make_list = ['make','-s'] # Check for parallel - if opts.n_procs != None: + if opts.n_procs is not None: make_list.append('-j') make_list.append(opts.n_procs) @@ -110,12 +110,12 @@ class Test(object): ctest_list = ['ctest'] # Check for parallel - if opts.n_procs != None: + if opts.n_procs is not None: ctest_list.append('-j') ctest_list.append(opts.n_procs) # Check for subset of tests - if opts.regex_tests != None: + if opts.regex_tests is not None: ctest_list.append('-R') ctest_list.append(opts.regex_tests) @@ -179,14 +179,14 @@ if opts.print_build_configs: exit() # Delete items of dictionary that don't match regular expression -if opts.build_config != None: - for key in iter(tests): +if opts.build_config is not None: + for key in tests: if not re.search(opts.build_config, key): del tests[key] # Begin testing -call(['rm','-rf','build']) -for test in iter(tests): +shutil.rmtree('build', ignore_errors=True) +for test in tests: print('-'*(len(test) + 6)) print(test + ' tests') print('-'*(len(test) + 6)) @@ -212,7 +212,7 @@ for test in iter(tests): 'LastTest_{0}.log'.format(test)) # Clean up build - call(['rm','-rf','build']) + shutil.rmtree('build', ignore_errors=True) # Print out summary of results print('\n' + '='*54) From c107cb40a6b0cc22ac972fdb6abd9174711f4502 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Thu, 3 Apr 2014 07:40:56 -0400 Subject: [PATCH 35/51] removed last iter command --- tests/run_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 1e9f28238a..f98db06057 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -168,7 +168,7 @@ add_test('omp-phdf5-petsc-optimize', openmp=True, mpi=True, hdf5=True, petsc=Tru # Check to see if we are to just print build configuratinos if opts.print_build_configs: - for key in iter(tests): + for key in tests: print('Configuration Name: {0}'.format(key)) print(' Debug Flags:..........{0}'.format(tests[key].debug)) print(' Optimization Flags:...{0}'.format(tests[key].optimize)) From 46d69ca6acc09becaee48328f872452b5ca4555d Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Thu, 3 Apr 2014 08:02:44 -0400 Subject: [PATCH 36/51] updated update_results script to match run_tests syntax --- tests/update_results.py | 48 ++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/tests/update_results.py b/tests/update_results.py index 7afb63e158..c9c0be85dc 100755 --- a/tests/update_results.py +++ b/tests/update_results.py @@ -1,30 +1,48 @@ #!/usr/bin/env python +from __future__ import print_function + import os -import sys +import re from subprocess import Popen, call, STDOUT, PIPE from glob import glob +from optparse import OptionParser +parser = OptionParser() +parser.add_option('--exe', dest='exe', + help="Path to openmc executable with basic \ + configuration options (no HDF5, no MPI, etc.)") +parser.add_option('-R', '--tests-regex', dest='regex_tests', + help="Run tests matching regular expression. \ + Test names are the directories present in tests folder.\ + This uses standard regex syntax to select tests.") +(opts, args) = parser.parse_args() +cwd = os.getcwd() + +# Terminal color configurations OKGREEN = '\033[92m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' -# Check for arguments -if len(sys.argv) > 1: - folders = [] - for i in range(len(sys.argv)): - if i == 0: - continue - folders.append(sys.argv[i]) +# Check for valid executable +if opts.exe is None: + raise Exception('Need to specify an OpenMC executable') else: - folders = glob('test_*') + openmc_exe = os.path.abspath(opts.exe) + +# Get a list of all test folders +folders = glob('test_*') + +# Check to see if a subset of tests is specified on command line +if opts.regex_tests is not None: + folders = [item for item in folders if re.search(opts.regex_tests, item)] # Loop around directories for adir in sorted(folders): # Skip test compile or plot - if adir == 'test_compile' or adir.find('plot') != -1: + if adir.find('plot') != -1: continue # Go into that directory @@ -33,18 +51,18 @@ for adir in sorted(folders): os.putenv('PWD', pwd) # Print status to screen - sys.stdout.write(adir) + print(adir, end="") sz = len(adir) for i in range(35 - sz): - sys.stdout.write('.') + print('.', end="") # Run openmc - proc = Popen(['../../src/openmc'], stderr=STDOUT, stdout=PIPE) + proc = Popen([openmc_exe], stderr=STDOUT, stdout=PIPE) returncode = proc.wait() if returncode == 0: - sys.stdout.write(BOLD + OKGREEN + "[OK]" + ENDC + "\n") + print(BOLD + OKGREEN + "[OK]" + ENDC) else: - sys.stdout.write(BOLD + FAIL + "[FAILED]" + ENDC + "\n") + print(BOLD + FAIL + "[FAILED]" + ENDC) # Process results if returncode == 0: From 7e3b4e3481d1d3141d560155e6c327210c9fa6eb Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Thu, 3 Apr 2014 08:03:36 -0400 Subject: [PATCH 37/51] removed unused package --- tests/run_tests.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index f98db06057..c977c5f5a6 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -3,7 +3,6 @@ from __future__ import print_function import os -import sys import shutil import re from subprocess import call From 5970ee0e1821129a3a8987fcd9a51b3aad67aa38 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Thu, 3 Apr 2014 08:08:02 -0400 Subject: [PATCH 38/51] removed another iter --- tests/run_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index c977c5f5a6..a664438c81 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -222,7 +222,7 @@ FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' -for test in iter(tests): +for test in tests: print(test + '.'*(50 - len(test)), end='') if tests[test].success: print(BOLD + OK + '[OK]' + ENDC) From 1fc0690d63036a2887ae72f42783827b1103237c Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Thu, 3 Apr 2014 08:15:54 -0400 Subject: [PATCH 39/51] change python syntax from == None to is None --- tests/test_basic/test_basic.py | 2 +- tests/test_cmfd_feed/test_cmfd_feed.py | 2 +- tests/test_cmfd_jfnk/test_cmfd_jfnk.py | 2 +- tests/test_cmfd_nofeed/test_cmfd_nofeed.py | 2 +- tests/test_confidence_intervals/test_confidence_intervals.py | 2 +- tests/test_density_atombcm/test_density_atombcm.py | 2 +- tests/test_density_atomcm3/test_density_atomcm3.py | 2 +- tests/test_density_kgm3/test_density_kgm3.py | 2 +- tests/test_density_sum/test_density_sum.py | 2 +- .../test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py | 2 +- .../test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py | 2 +- tests/test_energy_grid/test_energy_grid.py | 2 +- tests/test_entropy/test_entropy.py | 2 +- tests/test_filter_cell/test_filter_cell.py | 2 +- tests/test_filter_cellborn/test_filter_cellborn.py | 2 +- tests/test_filter_energy/test_filter_energy.py | 2 +- tests/test_filter_energyout/test_filter_energyout.py | 2 +- tests/test_filter_group_transfer/test_filter_group_transfer.py | 2 +- tests/test_filter_material/test_filter_material.py | 2 +- tests/test_filter_mesh_2d/test_filter_mesh_2d.py | 2 +- tests/test_filter_mesh_3d/test_filter_mesh_3d.py | 2 +- tests/test_filter_universe/test_filter_universe.py | 2 +- tests/test_fixed_source/test_fixed_source.py | 2 +- tests/test_lattice/test_lattice.py | 2 +- tests/test_lattice_multiple/test_lattice_multiple.py | 2 +- tests/test_natural_element/test_natural_element.py | 2 +- tests/test_output/test_output.py | 2 +- tests/test_particle_restart/test_particle_restart.py | 2 +- tests/test_plot_background/test_plot_background.py | 2 +- tests/test_plot_basis/test_plot_basis.py | 2 +- tests/test_plot_colspec/test_plot_colspec.py | 2 +- tests/test_plot_mask/test_plot_mask.py | 2 +- tests/test_ptables_off/test_ptables_off.py | 2 +- tests/test_reflective_cone/test_reflective_cone.py | 2 +- tests/test_reflective_cylinder/test_reflective_cylinder.py | 2 +- tests/test_reflective_plane/test_reflective_plane.py | 2 +- tests/test_reflective_sphere/test_reflective_sphere.py | 2 +- tests/test_rotation/test_rotation.py | 2 +- tests/test_salphabeta/test_salphabeta.py | 2 +- tests/test_salphabeta_multiple/test_salphabeta_multiple.py | 2 +- tests/test_score_MT/test_score_MT.py | 2 +- tests/test_score_absorption/test_score_absorption.py | 2 +- tests/test_score_current/test_score_current.py | 2 +- tests/test_score_events/test_score_events.py | 2 +- tests/test_score_fission/test_score_fission.py | 2 +- tests/test_score_flux/test_score_flux.py | 2 +- tests/test_score_kappafission/test_score_kappafission.py | 2 +- tests/test_score_nufission/test_score_nufission.py | 2 +- tests/test_score_nuscatter/test_score_nuscatter.py | 2 +- tests/test_score_scatter/test_score_scatter.py | 2 +- tests/test_score_scatter_n/test_score_scatter_n.py | 2 +- tests/test_score_scatter_pn/test_score_scatter_pn.py | 2 +- tests/test_score_total/test_score_total.py | 2 +- tests/test_seed/test_seed.py | 2 +- tests/test_source_angle_mono/test_source_angle_mono.py | 2 +- tests/test_source_energy_maxwell/test_source_energy_maxwell.py | 2 +- tests/test_source_energy_mono/test_source_energy_mono.py | 2 +- tests/test_source_file/test_source_file.py | 2 +- tests/test_source_point/test_source_point.py | 2 +- tests/test_sourcepoint_batch/test_sourcepoint_batch.py | 2 +- tests/test_sourcepoint_interval/test_sourcepoint_interval.py | 2 +- tests/test_sourcepoint_latest/test_sourcepoint_latest.py | 2 +- tests/test_sourcepoint_restart/test_sourcepoint_restart.py | 2 +- tests/test_statepoint_batch/test_statepoint_batch.py | 2 +- tests/test_statepoint_interval/test_statepoint_interval.py | 2 +- tests/test_statepoint_restart/test_statepoint_restart.py | 2 +- tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py | 2 +- tests/test_survival_biasing/test_survival_biasing.py | 2 +- tests/test_tally_assumesep/test_tally_assumesep.py | 2 +- tests/test_trace/test_trace.py | 2 +- tests/test_track_output/test_track_output.py | 2 +- tests/test_translation/test_translation.py | 2 +- tests/test_uniform_fs/test_uniform_fs.py | 2 +- tests/test_universe/test_universe.py | 2 +- tests/test_void/test_void.py | 2 +- 75 files changed, 75 insertions(+), 75 deletions(-) diff --git a/tests/test_basic/test_basic.py b/tests/test_basic/test_basic.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_basic/test_basic.py +++ b/tests/test_basic/test_basic.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_cmfd_feed/test_cmfd_feed.py b/tests/test_cmfd_feed/test_cmfd_feed.py index bafce9f444..4bc2914e3a 100644 --- a/tests/test_cmfd_feed/test_cmfd_feed.py +++ b/tests/test_cmfd_feed/test_cmfd_feed.py @@ -54,7 +54,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_cmfd_jfnk/test_cmfd_jfnk.py b/tests/test_cmfd_jfnk/test_cmfd_jfnk.py index 1386da3fee..0fae02dfdb 100644 --- a/tests/test_cmfd_jfnk/test_cmfd_jfnk.py +++ b/tests/test_cmfd_jfnk/test_cmfd_jfnk.py @@ -55,7 +55,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_cmfd_nofeed/test_cmfd_nofeed.py b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py index 1386da3fee..0fae02dfdb 100644 --- a/tests/test_cmfd_nofeed/test_cmfd_nofeed.py +++ b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py @@ -55,7 +55,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_confidence_intervals/test_confidence_intervals.py b/tests/test_confidence_intervals/test_confidence_intervals.py index 22932a02cd..30c53738fb 100644 --- a/tests/test_confidence_intervals/test_confidence_intervals.py +++ b/tests/test_confidence_intervals/test_confidence_intervals.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_density_atombcm/test_density_atombcm.py b/tests/test_density_atombcm/test_density_atombcm.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_density_atombcm/test_density_atombcm.py +++ b/tests/test_density_atombcm/test_density_atombcm.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_density_atomcm3/test_density_atomcm3.py b/tests/test_density_atomcm3/test_density_atomcm3.py index 77610a8261..c748062691 100644 --- a/tests/test_density_atomcm3/test_density_atomcm3.py +++ b/tests/test_density_atomcm3/test_density_atomcm3.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_density_kgm3/test_density_kgm3.py b/tests/test_density_kgm3/test_density_kgm3.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_density_kgm3/test_density_kgm3.py +++ b/tests/test_density_kgm3/test_density_kgm3.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_density_sum/test_density_sum.py b/tests/test_density_sum/test_density_sum.py index d6b4ac9cfa..f4167d1333 100644 --- a/tests/test_density_sum/test_density_sum.py +++ b/tests/test_density_sum/test_density_sum.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py b/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py index 1e61af4a2b..453b1951fc 100644 --- a/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py +++ b/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py b/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py +++ b/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_energy_grid/test_energy_grid.py b/tests/test_energy_grid/test_energy_grid.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_energy_grid/test_energy_grid.py +++ b/tests/test_energy_grid/test_energy_grid.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_entropy/test_entropy.py b/tests/test_entropy/test_entropy.py index 404b94634f..035a5c0ada 100644 --- a/tests/test_entropy/test_entropy.py +++ b/tests/test_entropy/test_entropy.py @@ -48,7 +48,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_filter_cell/test_filter_cell.py b/tests/test_filter_cell/test_filter_cell.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_filter_cell/test_filter_cell.py +++ b/tests/test_filter_cell/test_filter_cell.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_filter_cellborn/test_filter_cellborn.py b/tests/test_filter_cellborn/test_filter_cellborn.py index c5cb425422..15f73ee352 100644 --- a/tests/test_filter_cellborn/test_filter_cellborn.py +++ b/tests/test_filter_cellborn/test_filter_cellborn.py @@ -48,7 +48,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_filter_energy/test_filter_energy.py b/tests/test_filter_energy/test_filter_energy.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_filter_energy/test_filter_energy.py +++ b/tests/test_filter_energy/test_filter_energy.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_filter_energyout/test_filter_energyout.py b/tests/test_filter_energyout/test_filter_energyout.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_filter_energyout/test_filter_energyout.py +++ b/tests/test_filter_energyout/test_filter_energyout.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_filter_group_transfer/test_filter_group_transfer.py b/tests/test_filter_group_transfer/test_filter_group_transfer.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_filter_group_transfer/test_filter_group_transfer.py +++ b/tests/test_filter_group_transfer/test_filter_group_transfer.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_filter_material/test_filter_material.py b/tests/test_filter_material/test_filter_material.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_filter_material/test_filter_material.py +++ b/tests/test_filter_material/test_filter_material.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_filter_mesh_2d/test_filter_mesh_2d.py b/tests/test_filter_mesh_2d/test_filter_mesh_2d.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_filter_mesh_2d/test_filter_mesh_2d.py +++ b/tests/test_filter_mesh_2d/test_filter_mesh_2d.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_filter_mesh_3d/test_filter_mesh_3d.py b/tests/test_filter_mesh_3d/test_filter_mesh_3d.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_filter_mesh_3d/test_filter_mesh_3d.py +++ b/tests/test_filter_mesh_3d/test_filter_mesh_3d.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_filter_universe/test_filter_universe.py b/tests/test_filter_universe/test_filter_universe.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_filter_universe/test_filter_universe.py +++ b/tests/test_filter_universe/test_filter_universe.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_fixed_source/test_fixed_source.py b/tests/test_fixed_source/test_fixed_source.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_fixed_source/test_fixed_source.py +++ b/tests/test_fixed_source/test_fixed_source.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_lattice/test_lattice.py b/tests/test_lattice/test_lattice.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_lattice/test_lattice.py +++ b/tests/test_lattice/test_lattice.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_lattice_multiple/test_lattice_multiple.py b/tests/test_lattice_multiple/test_lattice_multiple.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_lattice_multiple/test_lattice_multiple.py +++ b/tests/test_lattice_multiple/test_lattice_multiple.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_natural_element/test_natural_element.py b/tests/test_natural_element/test_natural_element.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_natural_element/test_natural_element.py +++ b/tests/test_natural_element/test_natural_element.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_output/test_output.py b/tests/test_output/test_output.py index 4ed4255392..b19e5d76d6 100644 --- a/tests/test_output/test_output.py +++ b/tests/test_output/test_output.py @@ -59,7 +59,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_particle_restart/test_particle_restart.py b/tests/test_particle_restart/test_particle_restart.py index 4c63efe372..6c5dcf0be2 100644 --- a/tests/test_particle_restart/test_particle_restart.py +++ b/tests/test_particle_restart/test_particle_restart.py @@ -54,7 +54,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_plot_background/test_plot_background.py b/tests/test_plot_background/test_plot_background.py index fdf786314c..4c990578a4 100644 --- a/tests/test_plot_background/test_plot_background.py +++ b/tests/test_plot_background/test_plot_background.py @@ -33,7 +33,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_plot_basis/test_plot_basis.py b/tests/test_plot_basis/test_plot_basis.py index 2c650d8767..057fd09a97 100644 --- a/tests/test_plot_basis/test_plot_basis.py +++ b/tests/test_plot_basis/test_plot_basis.py @@ -35,7 +35,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_plot_colspec/test_plot_colspec.py b/tests/test_plot_colspec/test_plot_colspec.py index fdf786314c..4c990578a4 100644 --- a/tests/test_plot_colspec/test_plot_colspec.py +++ b/tests/test_plot_colspec/test_plot_colspec.py @@ -33,7 +33,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_plot_mask/test_plot_mask.py b/tests/test_plot_mask/test_plot_mask.py index 2c650d8767..057fd09a97 100644 --- a/tests/test_plot_mask/test_plot_mask.py +++ b/tests/test_plot_mask/test_plot_mask.py @@ -35,7 +35,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_ptables_off/test_ptables_off.py b/tests/test_ptables_off/test_ptables_off.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_ptables_off/test_ptables_off.py +++ b/tests/test_ptables_off/test_ptables_off.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_reflective_cone/test_reflective_cone.py b/tests/test_reflective_cone/test_reflective_cone.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_reflective_cone/test_reflective_cone.py +++ b/tests/test_reflective_cone/test_reflective_cone.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_reflective_cylinder/test_reflective_cylinder.py b/tests/test_reflective_cylinder/test_reflective_cylinder.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_reflective_cylinder/test_reflective_cylinder.py +++ b/tests/test_reflective_cylinder/test_reflective_cylinder.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_reflective_plane/test_reflective_plane.py b/tests/test_reflective_plane/test_reflective_plane.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_reflective_plane/test_reflective_plane.py +++ b/tests/test_reflective_plane/test_reflective_plane.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_reflective_sphere/test_reflective_sphere.py b/tests/test_reflective_sphere/test_reflective_sphere.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_reflective_sphere/test_reflective_sphere.py +++ b/tests/test_reflective_sphere/test_reflective_sphere.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_rotation/test_rotation.py b/tests/test_rotation/test_rotation.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_rotation/test_rotation.py +++ b/tests/test_rotation/test_rotation.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_salphabeta/test_salphabeta.py b/tests/test_salphabeta/test_salphabeta.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_salphabeta/test_salphabeta.py +++ b/tests/test_salphabeta/test_salphabeta.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_salphabeta_multiple/test_salphabeta_multiple.py b/tests/test_salphabeta_multiple/test_salphabeta_multiple.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_salphabeta_multiple/test_salphabeta_multiple.py +++ b/tests/test_salphabeta_multiple/test_salphabeta_multiple.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_MT/test_score_MT.py b/tests/test_score_MT/test_score_MT.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_MT/test_score_MT.py +++ b/tests/test_score_MT/test_score_MT.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_absorption/test_score_absorption.py b/tests/test_score_absorption/test_score_absorption.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_absorption/test_score_absorption.py +++ b/tests/test_score_absorption/test_score_absorption.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_current/test_score_current.py b/tests/test_score_current/test_score_current.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_current/test_score_current.py +++ b/tests/test_score_current/test_score_current.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_events/test_score_events.py b/tests/test_score_events/test_score_events.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_events/test_score_events.py +++ b/tests/test_score_events/test_score_events.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_fission/test_score_fission.py b/tests/test_score_fission/test_score_fission.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_fission/test_score_fission.py +++ b/tests/test_score_fission/test_score_fission.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_flux/test_score_flux.py b/tests/test_score_flux/test_score_flux.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_flux/test_score_flux.py +++ b/tests/test_score_flux/test_score_flux.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_kappafission/test_score_kappafission.py b/tests/test_score_kappafission/test_score_kappafission.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_kappafission/test_score_kappafission.py +++ b/tests/test_score_kappafission/test_score_kappafission.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_nufission/test_score_nufission.py b/tests/test_score_nufission/test_score_nufission.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_nufission/test_score_nufission.py +++ b/tests/test_score_nufission/test_score_nufission.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_nuscatter/test_score_nuscatter.py b/tests/test_score_nuscatter/test_score_nuscatter.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_nuscatter/test_score_nuscatter.py +++ b/tests/test_score_nuscatter/test_score_nuscatter.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_scatter/test_score_scatter.py b/tests/test_score_scatter/test_score_scatter.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_scatter/test_score_scatter.py +++ b/tests/test_score_scatter/test_score_scatter.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_scatter_n/test_score_scatter_n.py b/tests/test_score_scatter_n/test_score_scatter_n.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_scatter_n/test_score_scatter_n.py +++ b/tests/test_score_scatter_n/test_score_scatter_n.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_scatter_pn/test_score_scatter_pn.py b/tests/test_score_scatter_pn/test_score_scatter_pn.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_scatter_pn/test_score_scatter_pn.py +++ b/tests/test_score_scatter_pn/test_score_scatter_pn.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_score_total/test_score_total.py b/tests/test_score_total/test_score_total.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_score_total/test_score_total.py +++ b/tests/test_score_total/test_score_total.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_seed/test_seed.py b/tests/test_seed/test_seed.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_seed/test_seed.py +++ b/tests/test_seed/test_seed.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_source_angle_mono/test_source_angle_mono.py b/tests/test_source_angle_mono/test_source_angle_mono.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_source_angle_mono/test_source_angle_mono.py +++ b/tests/test_source_angle_mono/test_source_angle_mono.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_source_energy_maxwell/test_source_energy_maxwell.py b/tests/test_source_energy_maxwell/test_source_energy_maxwell.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_source_energy_maxwell/test_source_energy_maxwell.py +++ b/tests/test_source_energy_maxwell/test_source_energy_maxwell.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_source_energy_mono/test_source_energy_mono.py b/tests/test_source_energy_mono/test_source_energy_mono.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_source_energy_mono/test_source_energy_mono.py +++ b/tests/test_source_energy_mono/test_source_energy_mono.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_source_file/test_source_file.py b/tests/test_source_file/test_source_file.py index 3eca852d57..1be4b92cf8 100644 --- a/tests/test_source_file/test_source_file.py +++ b/tests/test_source_file/test_source_file.py @@ -105,7 +105,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_source_point/test_source_point.py b/tests/test_source_point/test_source_point.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_source_point/test_source_point.py +++ b/tests/test_source_point/test_source_point.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_sourcepoint_batch/test_sourcepoint_batch.py b/tests/test_sourcepoint_batch/test_sourcepoint_batch.py index f62ddacf9e..e7fd49b40a 100644 --- a/tests/test_sourcepoint_batch/test_sourcepoint_batch.py +++ b/tests/test_sourcepoint_batch/test_sourcepoint_batch.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_sourcepoint_interval/test_sourcepoint_interval.py b/tests/test_sourcepoint_interval/test_sourcepoint_interval.py index 52aa3b2d24..d59b5261d4 100644 --- a/tests/test_sourcepoint_interval/test_sourcepoint_interval.py +++ b/tests/test_sourcepoint_interval/test_sourcepoint_interval.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_sourcepoint_latest/test_sourcepoint_latest.py b/tests/test_sourcepoint_latest/test_sourcepoint_latest.py index cdf6d560b4..858656e837 100644 --- a/tests/test_sourcepoint_latest/test_sourcepoint_latest.py +++ b/tests/test_sourcepoint_latest/test_sourcepoint_latest.py @@ -52,7 +52,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_sourcepoint_restart/test_sourcepoint_restart.py b/tests/test_sourcepoint_restart/test_sourcepoint_restart.py index a67f078da6..81b16255f7 100644 --- a/tests/test_sourcepoint_restart/test_sourcepoint_restart.py +++ b/tests/test_sourcepoint_restart/test_sourcepoint_restart.py @@ -129,7 +129,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_statepoint_batch/test_statepoint_batch.py b/tests/test_statepoint_batch/test_statepoint_batch.py index 7dbce32cc0..ea3993d10b 100644 --- a/tests/test_statepoint_batch/test_statepoint_batch.py +++ b/tests/test_statepoint_batch/test_statepoint_batch.py @@ -55,7 +55,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_statepoint_interval/test_statepoint_interval.py b/tests/test_statepoint_interval/test_statepoint_interval.py index de42fc4e3a..f80cc2dca2 100644 --- a/tests/test_statepoint_interval/test_statepoint_interval.py +++ b/tests/test_statepoint_interval/test_statepoint_interval.py @@ -64,7 +64,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_statepoint_restart/test_statepoint_restart.py b/tests/test_statepoint_restart/test_statepoint_restart.py index 8b0636d6da..06b982917b 100644 --- a/tests/test_statepoint_restart/test_statepoint_restart.py +++ b/tests/test_statepoint_restart/test_statepoint_restart.py @@ -118,7 +118,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py b/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py index b21720ef57..00e70444d0 100644 --- a/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py +++ b/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py @@ -52,7 +52,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_survival_biasing/test_survival_biasing.py b/tests/test_survival_biasing/test_survival_biasing.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_survival_biasing/test_survival_biasing.py +++ b/tests/test_survival_biasing/test_survival_biasing.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_tally_assumesep/test_tally_assumesep.py b/tests/test_tally_assumesep/test_tally_assumesep.py index 435cb80ebc..f2068f85f9 100644 --- a/tests/test_tally_assumesep/test_tally_assumesep.py +++ b/tests/test_tally_assumesep/test_tally_assumesep.py @@ -51,7 +51,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_trace/test_trace.py b/tests/test_trace/test_trace.py index d9511551ac..dae89b62b4 100644 --- a/tests/test_trace/test_trace.py +++ b/tests/test_trace/test_trace.py @@ -49,7 +49,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_track_output/test_track_output.py b/tests/test_track_output/test_track_output.py index 25c9449c51..d4670a1385 100644 --- a/tests/test_track_output/test_track_output.py +++ b/tests/test_track_output/test_track_output.py @@ -61,7 +61,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_translation/test_translation.py b/tests/test_translation/test_translation.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_translation/test_translation.py +++ b/tests/test_translation/test_translation.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_uniform_fs/test_uniform_fs.py b/tests/test_uniform_fs/test_uniform_fs.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_uniform_fs/test_uniform_fs.py +++ b/tests/test_uniform_fs/test_uniform_fs.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_universe/test_universe.py b/tests/test_universe/test_universe.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_universe/test_universe.py +++ b/tests/test_universe/test_universe.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests diff --git a/tests/test_void/test_void.py b/tests/test_void/test_void.py index 54733fb13c..ef2dceed89 100644 --- a/tests/test_void/test_void.py +++ b/tests/test_void/test_void.py @@ -47,7 +47,7 @@ def teardown(): if __name__ == '__main__': # test for openmc executable - if opts.exe == None: + if opts.exe is None: raise Exception('Must specify OpenMC executable from command line with --exe.') # run tests From d99ad7b19c9fca98f9eb3cb2589a22b9d6dfe154 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Thu, 3 Apr 2014 15:06:24 -0400 Subject: [PATCH 40/51] added documentation on adding tests to test suite --- docs/source/devguide/index.rst | 2 +- docs/source/devguide/workflow.rst | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/source/devguide/index.rst b/docs/source/devguide/index.rst index 1ceba324c1..999de9a536 100644 --- a/docs/source/devguide/index.rst +++ b/docs/source/devguide/index.rst @@ -10,7 +10,7 @@ as debugging. .. toctree:: :numbered: - :maxdepth: 2 + :maxdepth: 3 structures styleguide diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index 523fba32b2..11b6f69321 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -135,6 +135,32 @@ can run: python run_tests.py -p +Adding tests to test suite +++++++++++++++++++++++++++ + +To add a new test to the test suite, create a sub-directory in the tests +directory that conforms to the regular expression *test_*. To configure +a test you need to add the following files to your new test directory, +*test_name* for example: + + * OpenMC input XML files + * **test_name.py** - python test driver script, please refer to other + tests to see how to construct. Any output files that are generated + during testing must be removed at the end of this script. + * **results.py** - python script that extracts results from statepoint + output files. By default it should look for a binary file, but can + take an argument to overwrite which statepoint file is processed, + whether it is at a different batch or with an HDF5 extension. This + script must output a results file that is named *results_test.dat*. + * **results_true.dat** - ASCII file that contains the expected results + from the test. The file *results_test.dat* is compared to this file + during the execution of the python test driver script. + +In addition to this description, please see the various types of tests that +are already included in the test suite to see how to create them. If all is +implemented correctly, the new test directory will automatically be added +to the CTest framework. + Private Development ------------------- From 565a8493091c9b60ccac23b1f507d5a1101b26c9 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Thu, 3 Apr 2014 15:13:30 -0400 Subject: [PATCH 41/51] added a few more suggestions when adding new tests --- docs/source/devguide/workflow.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index 11b6f69321..7a955f97d8 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -152,9 +152,14 @@ a test you need to add the following files to your new test directory, take an argument to overwrite which statepoint file is processed, whether it is at a different batch or with an HDF5 extension. This script must output a results file that is named *results_test.dat*. + It is recommended that any real numbers reported use *12.6E* format. * **results_true.dat** - ASCII file that contains the expected results from the test. The file *results_test.dat* is compared to this file - during the execution of the python test driver script. + during the execution of the python test driver script. When the + above files have been created, generate a *results_test.dat* file and + copy it to this name and commit. It should be noted that this file + should be generated with basic compiler options during openmc + configuration and build (e.g., no MPI/HDF5, no debug/optimization). In addition to this description, please see the various types of tests that are already included in the test suite to see how to create them. If all is From a5a447fe3c1416d0d7e8de9efea3223cee319f11 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 4 Apr 2014 12:23:53 -0400 Subject: [PATCH 42/51] can control executable paths through environ vars --- tests/run_tests.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index a664438c81..fd3317a4d5 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -26,13 +26,27 @@ parser.add_option('-p', '--print', action="store_true", help="Print out build configurations.") (opts, args) = parser.parse_args() -# Compiler paths +# Default compiler paths FC_DEFAULT='gfortran' MPI_DIR='/opt/mpich/3.0.4-gnu' HDF5_DIR='/opt/hdf5/1.8.12-gnu' PHDF5_DIR='/opt/phdf5/1.8.12-gnu' PETSC_DIR='/opt/petsc/3.4.3-gnu' +# Override default compiler paths if environmental vars are found +if os.environ.has_key('FC_DEFAULT'): + FC_DEFAULT = os.environ['FC_DEFAULT'] + if FC_DEFAULT is not 'gfortran': + print('NOTE: Test suite only verifed for gfortran compiler.') +if os.environ.has_key('MPI_DIR'): + MPI_DIR = os.environ['MPI_DIR'] +if os.environ.has_key('HDF5_DIR'): + HDF5_DIR = os.environ['HDF5_DIR'] +if os.environ.has_key('PHDF5_DIR'): + PHDF5_DIR = os.environ['PHDF5_DIR'] +if os.environ.has_key('PETSC_DIR'): + PETSC_DIR = os.environ['PETSC_DIR'] + # Define test data structure tests = OrderedDict() @@ -124,6 +138,19 @@ class Test(object): self.success = False self.msg = 'Failed on testing.' + # Checks to see if file exists in PWD or PATH + def check_compiler(self): + result = False + if os.path.isfile(self.fc): + result = True + for path in os.environ["PATH"].split(":"): + if os.path.isfile(path + "/" + self.fc): + result = True + if not result: + raise Exception("Compiler path '{0}' does not exist." + .format(self.fc)+ + "Please set appropriate environmental variable(s).") + def add_test(name, debug=False, optimize=False, mpi=False, openmp=False,\ hdf5=False, petsc=False): tests.update({name:Test(debug, optimize, mpi, openmp, hdf5, petsc)}) @@ -190,6 +217,9 @@ for test in tests: print(test + ' tests') print('-'*(len(test) + 6)) + # Verify fortran compiler exists + tests[test].check_compiler() + # Run CMAKE to configure build tests[test].run_cmake() From e08c85f0499299c469219999b0b45539eed375f2 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 4 Apr 2014 12:42:30 -0400 Subject: [PATCH 43/51] updated test suite docs for environ var specification --- docs/source/devguide/workflow.rst | 61 ++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index 7a955f97d8..cf585dabff 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -97,16 +97,59 @@ OpenMC Test Suite ----------------- The purpose of this test suite is to ensure that OpenMC compiles using various -combinations of compiler flags and options and that all user input options can -be used successfully without breaking the code. The test suite is based on -regression or integrated testing where different types of input files are -configured and the full OpenMC code is executed. Results from simulations -are compared with expected results. The test suite is comprised of many -build configurations (e.g. debug, mpi, hdf5) and the actual tests which -reside in sub-directories in the tests directory. +combinations of compiler flags and options, and that all user input options can +be used successfully without breaking the code. The test suite is comprised of +regression tests where different types of input files are configured and the +full OpenMC code is executed. Results from simulations are compared with +expected results. The test suite is comprised of many build configurations +(e.g. debug, mpi, hdf5) and the actual tests which reside in sub-directories +in the tests directory. -The test suite is designed to integrate with cmake using ctest_. To run the -full test suite run: +The test suite is designed to integrate with cmake using ctest_. +The test suite can be run on an already existing build using: + +.. code-block:: sh + + cd build + make test + +or + +.. code-block:: sh + + cd build + ctest + +There are numerous ctest_ command line options that can be set to have +more control over which tests are executed. + +Before running the test suite python script, the following environmental +variables should be set if the default paths are incorrect: + + * **FC_DEFAULT** - The command of the default Fortran compiler. It + should be noted that the test suite is only verified for the + *gfortran* compiler. + + * Default - *gfortran* + + * **MPI_DIR** - The path to the MPI directory. + + * Default - */opt/mpich/3.0.4-gnu* + + * **HDF5_DIR** - The path to the HDF5 directory. + + * Default - */opt/hdf5/1.8.12-gnu* + + * **PHDF5_DIR** - The path to the parallel HDF5 directory. + + * Default - */opt/phdf5/1.8.12-gnu* + + * **PETSC_DIR** - The path to the PETSc directory. + + * Default - */opt/petsc/3.4.3-gnu* + +To run the full test suite, the following command can be executed in the +tests directory: .. code-block:: sh From 1183f28dddb14506dfb2ef1f2ca7c74af4ee3c6a Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 4 Apr 2014 17:14:03 -0400 Subject: [PATCH 44/51] added some text about running test suite before submitting PR --- docs/source/devguide/workflow.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index cf585dabff..61ba7f23d2 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -103,7 +103,9 @@ regression tests where different types of input files are configured and the full OpenMC code is executed. Results from simulations are compared with expected results. The test suite is comprised of many build configurations (e.g. debug, mpi, hdf5) and the actual tests which reside in sub-directories -in the tests directory. +in the tests directory. We recommend to developers to test their branches +before submitting a formal pull request using gfortran and intel compilers +if available. The test suite is designed to integrate with cmake using ctest_. The test suite can be run on an already existing build using: @@ -126,9 +128,7 @@ more control over which tests are executed. Before running the test suite python script, the following environmental variables should be set if the default paths are incorrect: - * **FC_DEFAULT** - The command of the default Fortran compiler. It - should be noted that the test suite is only verified for the - *gfortran* compiler. + * **FC_DEFAULT** - The command of the default Fortran compiler. * Default - *gfortran* From d400cbcf09039ce8f3262535892ef197adfe5e5f Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 4 Apr 2014 23:28:29 -0400 Subject: [PATCH 45/51] changed FC_DEFAULT to FC --- docs/source/devguide/workflow.rst | 2 +- tests/run_tests.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index 61ba7f23d2..d5d2966fc9 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -128,7 +128,7 @@ more control over which tests are executed. Before running the test suite python script, the following environmental variables should be set if the default paths are incorrect: - * **FC_DEFAULT** - The command of the default Fortran compiler. + * **FC** - The command of the Fortran compiler (e.g. gfotran, ifort). * Default - *gfortran* diff --git a/tests/run_tests.py b/tests/run_tests.py index fd3317a4d5..b926b21dec 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -27,16 +27,16 @@ parser.add_option('-p', '--print', action="store_true", (opts, args) = parser.parse_args() # Default compiler paths -FC_DEFAULT='gfortran' +FC='gfortran' MPI_DIR='/opt/mpich/3.0.4-gnu' HDF5_DIR='/opt/hdf5/1.8.12-gnu' PHDF5_DIR='/opt/phdf5/1.8.12-gnu' PETSC_DIR='/opt/petsc/3.4.3-gnu' # Override default compiler paths if environmental vars are found -if os.environ.has_key('FC_DEFAULT'): - FC_DEFAULT = os.environ['FC_DEFAULT'] - if FC_DEFAULT is not 'gfortran': +if os.environ.has_key('FC'): + FC = os.environ['FC'] + if FC is not 'gfortran': print('NOTE: Test suite only verifed for gfortran compiler.') if os.environ.has_key('MPI_DIR'): MPI_DIR = os.environ['MPI_DIR'] @@ -75,7 +75,7 @@ class Test(object): elif self.mpi and self.hdf5: self.fc = PHDF5_DIR+'/bin/h5pfc' else: - self.fc = FC_DEFAULT + self.fc = FC # Set rest of options if self.debug: From 3ad1bd2f205ff88f5f8813e83d8e351be74e634b Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Fri, 4 Apr 2014 23:29:35 -0400 Subject: [PATCH 46/51] updated versions of mpi and petsc --- docs/source/devguide/workflow.rst | 4 ++-- tests/run_tests.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index d5d2966fc9..5aa3088f55 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -134,7 +134,7 @@ variables should be set if the default paths are incorrect: * **MPI_DIR** - The path to the MPI directory. - * Default - */opt/mpich/3.0.4-gnu* + * Default - */opt/mpich/3.1-gnu* * **HDF5_DIR** - The path to the HDF5 directory. @@ -146,7 +146,7 @@ variables should be set if the default paths are incorrect: * **PETSC_DIR** - The path to the PETSc directory. - * Default - */opt/petsc/3.4.3-gnu* + * Default - */opt/petsc/3.4.4-gnu* To run the full test suite, the following command can be executed in the tests directory: diff --git a/tests/run_tests.py b/tests/run_tests.py index b926b21dec..5c48df3b90 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -28,10 +28,10 @@ parser.add_option('-p', '--print', action="store_true", # Default compiler paths FC='gfortran' -MPI_DIR='/opt/mpich/3.0.4-gnu' +MPI_DIR='/opt/mpich/3.1-gnu' HDF5_DIR='/opt/hdf5/1.8.12-gnu' PHDF5_DIR='/opt/phdf5/1.8.12-gnu' -PETSC_DIR='/opt/petsc/3.4.3-gnu' +PETSC_DIR='/opt/petsc/3.4.4-gnu' # Override default compiler paths if environmental vars are found if os.environ.has_key('FC'): From 92dce0b83b5bfba1fd341f36a0935520cc921eb9 Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 8 Apr 2014 18:19:44 -0400 Subject: [PATCH 47/51] using os.path.join to join paths instead of string concatenation --- tests/run_tests.py | 2 +- tests/test_basic/test_basic.py | 8 ++--- tests/test_cmfd_feed/test_cmfd_feed.py | 12 +++---- tests/test_cmfd_jfnk/test_cmfd_jfnk.py | 12 +++---- tests/test_cmfd_nofeed/test_cmfd_nofeed.py | 12 +++---- .../test_confidence_intervals.py | 12 +++---- .../test_density_atombcm.py | 8 ++--- .../test_density_atomcm3.py | 6 ++-- tests/test_density_kgm3/test_density_kgm3.py | 8 ++--- tests/test_density_sum/test_density_sum.py | 6 ++-- .../test_eigenvalue_genperbatch.py | 8 ++--- .../test_eigenvalue_no_inactive.py | 8 ++--- tests/test_energy_grid/test_energy_grid.py | 8 ++--- tests/test_entropy/test_entropy.py | 8 ++--- tests/test_filter_cell/test_filter_cell.py | 12 +++---- .../test_filter_cellborn.py | 12 +++---- .../test_filter_energy/test_filter_energy.py | 12 +++---- .../test_filter_energyout.py | 12 +++---- .../test_filter_group_transfer.py | 12 +++---- .../test_filter_material.py | 12 +++---- .../test_filter_mesh_2d.py | 12 +++---- .../test_filter_mesh_3d.py | 12 +++---- .../test_filter_universe.py | 12 +++---- tests/test_fixed_source/test_fixed_source.py | 12 +++---- tests/test_lattice/test_lattice.py | 8 ++--- .../test_lattice_multiple.py | 8 ++--- .../test_natural_element.py | 8 ++--- tests/test_output/test_output.py | 16 ++++----- .../test_particle_restart.py | 12 +++---- .../test_plot_background.py | 4 +-- tests/test_plot_basis/test_plot_basis.py | 8 ++--- tests/test_plot_colspec/test_plot_colspec.py | 4 +-- tests/test_plot_mask/test_plot_mask.py | 8 ++--- tests/test_ptables_off/test_ptables_off.py | 8 ++--- .../test_reflective_cone.py | 8 ++--- .../test_reflective_cylinder.py | 8 ++--- .../test_reflective_plane.py | 8 ++--- .../test_reflective_sphere.py | 8 ++--- tests/test_rotation/test_rotation.py | 8 ++--- tests/test_salphabeta/test_salphabeta.py | 8 ++--- .../test_salphabeta_multiple.py | 8 ++--- tests/test_score_MT/test_score_MT.py | 12 +++---- .../test_score_absorption.py | 12 +++---- .../test_score_current/test_score_current.py | 12 +++---- tests/test_score_events/test_score_events.py | 12 +++---- .../test_score_fission/test_score_fission.py | 12 +++---- tests/test_score_flux/test_score_flux.py | 12 +++---- .../test_score_kappafission.py | 12 +++---- .../test_score_nufission.py | 12 +++---- .../test_score_nuscatter.py | 12 +++---- .../test_score_scatter/test_score_scatter.py | 12 +++---- .../test_score_scatter_n.py | 12 +++---- .../test_score_scatter_pn.py | 12 +++---- tests/test_score_total/test_score_total.py | 12 +++---- tests/test_seed/test_seed.py | 8 ++--- .../test_source_angle_mono.py | 8 ++--- .../test_source_energy_maxwell.py | 8 ++--- .../test_source_energy_mono.py | 8 ++--- tests/test_source_file/test_source_file.py | 16 ++++----- tests/test_source_point/test_source_point.py | 8 ++--- .../test_sourcepoint_batch.py | 8 ++--- .../test_sourcepoint_interval.py | 8 ++--- .../test_sourcepoint_latest.py | 12 +++---- .../test_sourcepoint_restart.py | 36 +++++++++---------- .../test_statepoint_batch.py | 12 +++---- .../test_statepoint_interval.py | 16 ++++----- .../test_statepoint_restart.py | 26 +++++++------- .../test_statepoint_sourcesep.py | 12 +++---- .../test_survival_biasing.py | 8 ++--- .../test_tally_assumesep.py | 12 +++---- tests/test_trace/test_trace.py | 8 ++--- tests/test_translation/test_translation.py | 8 ++--- tests/test_uniform_fs/test_uniform_fs.py | 8 ++--- tests/test_universe/test_universe.py | 8 ++--- tests/test_void/test_void.py | 8 ++--- 75 files changed, 390 insertions(+), 390 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 5c48df3b90..74489feeb1 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -144,7 +144,7 @@ class Test(object): if os.path.isfile(self.fc): result = True for path in os.environ["PATH"].split(":"): - if os.path.isfile(path + "/" + self.fc): + if os.path.isfile(os.path.join(path, self.fc)): result = True if not result: raise Exception("Compiler path '{0}' does not exist." diff --git a/tests/test_basic/test_basic.py b/tests/test_basic/test_basic.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_basic/test_basic.py +++ b/tests/test_basic/test_basic.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_cmfd_feed/test_cmfd_feed.py b/tests/test_cmfd_feed/test_cmfd_feed.py index 4bc2914e3a..5610cfee4f 100644 --- a/tests/test_cmfd_feed/test_cmfd_feed.py +++ b/tests/test_cmfd_feed/test_cmfd_feed.py @@ -24,18 +24,18 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.20.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.20.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -44,9 +44,9 @@ def test_results(): def teardown(): - output = glob.glob(cwd + '/statepoint.20.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.20.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_cmfd_jfnk/test_cmfd_jfnk.py b/tests/test_cmfd_jfnk/test_cmfd_jfnk.py index 0fae02dfdb..ec984a74b3 100644 --- a/tests/test_cmfd_jfnk/test_cmfd_jfnk.py +++ b/tests/test_cmfd_jfnk/test_cmfd_jfnk.py @@ -25,18 +25,18 @@ def test_run(): def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.20.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.20.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -45,9 +45,9 @@ def test_results(): def teardown(): - output = glob.glob(cwd + '/statepoint.20.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.20.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_cmfd_nofeed/test_cmfd_nofeed.py b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py index 0fae02dfdb..ec984a74b3 100644 --- a/tests/test_cmfd_nofeed/test_cmfd_nofeed.py +++ b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py @@ -25,18 +25,18 @@ def test_run(): def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.20.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.20.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -45,9 +45,9 @@ def test_results(): def teardown(): - output = glob.glob(cwd + '/statepoint.20.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.20.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_confidence_intervals/test_confidence_intervals.py b/tests/test_confidence_intervals/test_confidence_intervals.py index 30c53738fb..bf28e47d1e 100644 --- a/tests/test_confidence_intervals/test_confidence_intervals.py +++ b/tests/test_confidence_intervals/test_confidence_intervals.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_created_output(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') - output.append(cwd + '/tallies.out') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) + output.append(os.path.join(cwd,'tallies.out')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_atombcm/test_density_atombcm.py b/tests/test_density_atombcm/test_density_atombcm.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_density_atombcm/test_density_atombcm.py +++ b/tests/test_density_atombcm/test_density_atombcm.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_atomcm3/test_density_atomcm3.py b/tests/test_density_atomcm3/test_density_atomcm3.py index c748062691..9d1a7e5671 100644 --- a/tests/test_density_atomcm3/test_density_atomcm3.py +++ b/tests/test_density_atomcm3/test_density_atomcm3.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -39,7 +39,7 @@ def test_results(): def teardown(): output = glob.glob('statepoint.10.*') - output.append(cwd + '/results_test.dat') + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_kgm3/test_density_kgm3.py b/tests/test_density_kgm3/test_density_kgm3.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_density_kgm3/test_density_kgm3.py +++ b/tests/test_density_kgm3/test_density_kgm3.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_sum/test_density_sum.py b/tests/test_density_sum/test_density_sum.py index f4167d1333..682cea7a48 100644 --- a/tests/test_density_sum/test_density_sum.py +++ b/tests/test_density_sum/test_density_sum.py @@ -24,7 +24,7 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py b/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py index 453b1951fc..de621617d2 100644 --- a/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py +++ b/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.7.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.7.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py b/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py +++ b/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_energy_grid/test_energy_grid.py b/tests/test_energy_grid/test_energy_grid.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_energy_grid/test_energy_grid.py +++ b/tests/test_energy_grid/test_energy_grid.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_entropy/test_entropy.py b/tests/test_entropy/test_entropy.py index 035a5c0ada..e68f948cde 100644 --- a/tests/test_entropy/test_entropy.py +++ b/tests/test_entropy/test_entropy.py @@ -25,13 +25,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -39,8 +39,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_cell/test_filter_cell.py b/tests/test_filter_cell/test_filter_cell.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_filter_cell/test_filter_cell.py +++ b/tests/test_filter_cell/test_filter_cell.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_cellborn/test_filter_cellborn.py b/tests/test_filter_cellborn/test_filter_cellborn.py index 15f73ee352..fb1d801da4 100644 --- a/tests/test_filter_cellborn/test_filter_cellborn.py +++ b/tests/test_filter_cellborn/test_filter_cellborn.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,9 +38,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_energy/test_filter_energy.py b/tests/test_filter_energy/test_filter_energy.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_filter_energy/test_filter_energy.py +++ b/tests/test_filter_energy/test_filter_energy.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_energyout/test_filter_energyout.py b/tests/test_filter_energyout/test_filter_energyout.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_filter_energyout/test_filter_energyout.py +++ b/tests/test_filter_energyout/test_filter_energyout.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_group_transfer/test_filter_group_transfer.py b/tests/test_filter_group_transfer/test_filter_group_transfer.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_filter_group_transfer/test_filter_group_transfer.py +++ b/tests/test_filter_group_transfer/test_filter_group_transfer.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_material/test_filter_material.py b/tests/test_filter_material/test_filter_material.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_filter_material/test_filter_material.py +++ b/tests/test_filter_material/test_filter_material.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_mesh_2d/test_filter_mesh_2d.py b/tests/test_filter_mesh_2d/test_filter_mesh_2d.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_filter_mesh_2d/test_filter_mesh_2d.py +++ b/tests/test_filter_mesh_2d/test_filter_mesh_2d.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_mesh_3d/test_filter_mesh_3d.py b/tests/test_filter_mesh_3d/test_filter_mesh_3d.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_filter_mesh_3d/test_filter_mesh_3d.py +++ b/tests/test_filter_mesh_3d/test_filter_mesh_3d.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_universe/test_filter_universe.py b/tests/test_filter_universe/test_filter_universe.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_filter_universe/test_filter_universe.py +++ b/tests/test_filter_universe/test_filter_universe.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_fixed_source/test_fixed_source.py b/tests/test_fixed_source/test_fixed_source.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_fixed_source/test_fixed_source.py +++ b/tests/test_fixed_source/test_fixed_source.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_lattice/test_lattice.py b/tests/test_lattice/test_lattice.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_lattice/test_lattice.py +++ b/tests/test_lattice/test_lattice.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_lattice_multiple/test_lattice_multiple.py b/tests/test_lattice_multiple/test_lattice_multiple.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_lattice_multiple/test_lattice_multiple.py +++ b/tests/test_lattice_multiple/test_lattice_multiple.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_natural_element/test_natural_element.py b/tests/test_natural_element/test_natural_element.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_natural_element/test_natural_element.py +++ b/tests/test_natural_element/test_natural_element.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_output/test_output.py b/tests/test_output/test_output.py index b19e5d76d6..30db431bcb 100644 --- a/tests/test_output/test_output.py +++ b/tests/test_output/test_output.py @@ -24,23 +24,23 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_summary_exists(): - summary = glob.glob(cwd + '/summary.*') + summary = glob.glob(os.path.join(cwd,'summary.*')) assert len(summary) == 1, 'Either multiple or no summary file exists.' assert summary[0].endswith('out') or summary[0].endswith('h5'),\ 'Summary file is not a binary or hdf5 file.' def test_cross_sections_exists(): - assert os.path.exists(cwd + '/cross_sections.out'),\ + assert os.path.exists(os.path.join(cwd, 'cross_sections.out')),\ 'Cross section output file does not exist.' def test_statepoint_exists(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -48,10 +48,10 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') + glob.glob(cwd + '/summary.*') - output.append(cwd + '/summary.out') - output.append(cwd + '/cross_sections.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + glob.glob(os.path.join(cwd,'summary.*')) + output.append(os.path.join(cwd,'summary.out')) + output.append(os.path.join(cwd, 'cross_sections.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_particle_restart/test_particle_restart.py b/tests/test_particle_restart/test_particle_restart.py index 6c5dcf0be2..c6d62a87db 100644 --- a/tests/test_particle_restart/test_particle_restart.py +++ b/tests/test_particle_restart/test_particle_restart.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_restart(): - particle = glob.glob(cwd + '/particle_10_394.*') + particle = glob.glob(os.path.join(cwd, 'particle_10_394.*')) assert len(particle) == 1, 'Either multiple or no particle restart files exist.' assert particle[0].endswith('binary') or \ particle[0].endswith('h5'), 'Particle restart file not a binary or hdf5 file.' def test_results(): - particle = glob.glob(cwd + '/particle_10_394.*') + particle = glob.glob(os.path.join(cwd, 'particle_10_394.*')) call(['python', 'results.py', particle[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,15 +38,15 @@ def test_results(): assert compare, 'Results do not agree.' def test_run_restart(): - particle = glob.glob(cwd + '/particle_10_394.*') + particle = glob.glob(os.path.join(cwd, 'particle_10_394.*')) proc = Popen([opts.exe, '-r', particle[0], cwd], stderr=PIPE, stdout=PIPE) stdout, stderr = proc.communicate() assert stderr == '', 'Particle restart not successful.' def teardown(): - output = glob.glob(cwd + '/statepoint.*') + \ - glob.glob(cwd + '/particle_*') + \ - [cwd + '/results_test.dat'] + output = glob.glob(os.path.join(cwd, 'statepoint.*')) + \ + glob.glob(os.path.join(cwd, 'particle_*')) + \ + [os.path.join(cwd,'results_test.dat')] for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_plot_background/test_plot_background.py b/tests/test_plot_background/test_plot_background.py index 4c990578a4..7e5687a533 100644 --- a/tests/test_plot_background/test_plot_background.py +++ b/tests/test_plot_background/test_plot_background.py @@ -22,10 +22,10 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_plot_exists(): - assert os.path.exists(cwd + '/1_plot.ppm'), 'Plot ppm file does not exist.' + assert os.path.exists(os.path.join(cwd ,'1_plot.ppm')), 'Plot ppm file does not exist.' def teardown(): - output = [cwd + '/1_plot.ppm'] + output = [os.path.join(cwd ,'1_plot.ppm')] for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_plot_basis/test_plot_basis.py b/tests/test_plot_basis/test_plot_basis.py index 057fd09a97..94c2ace260 100644 --- a/tests/test_plot_basis/test_plot_basis.py +++ b/tests/test_plot_basis/test_plot_basis.py @@ -22,12 +22,12 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_plots_exists(): - assert os.path.exists(cwd + '/1_plot.ppm'), 'Plot 1 result does not exist.' - assert os.path.exists(cwd + '/2_plot.ppm'), 'Plot 2 result does not exist.' - assert os.path.exists(cwd + '/3_plot.ppm'), 'Plot 3 result does not exist.' + assert os.path.exists(os.path.join(cwd ,'1_plot.ppm')), 'Plot 1 result does not exist.' + assert os.path.exists(os.path.join(cwd ,'2_plot.ppm')), 'Plot 2 result does not exist.' + assert os.path.exists(os.path.join(cwd ,'3_plot.ppm')), 'Plot 3 result does not exist.' def teardown(): - output = [cwd + '/1_plot.ppm', cwd + '/2_plot.ppm', cwd + '/3_plot.ppm'] + output = [os.path.join(cwd ,'1_plot.ppm'), os.path.join(cwd ,'2_plot.ppm'), os.path.join(cwd ,'3_plot.ppm')] for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_plot_colspec/test_plot_colspec.py b/tests/test_plot_colspec/test_plot_colspec.py index 4c990578a4..7e5687a533 100644 --- a/tests/test_plot_colspec/test_plot_colspec.py +++ b/tests/test_plot_colspec/test_plot_colspec.py @@ -22,10 +22,10 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_plot_exists(): - assert os.path.exists(cwd + '/1_plot.ppm'), 'Plot ppm file does not exist.' + assert os.path.exists(os.path.join(cwd ,'1_plot.ppm')), 'Plot ppm file does not exist.' def teardown(): - output = [cwd + '/1_plot.ppm'] + output = [os.path.join(cwd ,'1_plot.ppm')] for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_plot_mask/test_plot_mask.py b/tests/test_plot_mask/test_plot_mask.py index 057fd09a97..94c2ace260 100644 --- a/tests/test_plot_mask/test_plot_mask.py +++ b/tests/test_plot_mask/test_plot_mask.py @@ -22,12 +22,12 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_plots_exists(): - assert os.path.exists(cwd + '/1_plot.ppm'), 'Plot 1 result does not exist.' - assert os.path.exists(cwd + '/2_plot.ppm'), 'Plot 2 result does not exist.' - assert os.path.exists(cwd + '/3_plot.ppm'), 'Plot 3 result does not exist.' + assert os.path.exists(os.path.join(cwd ,'1_plot.ppm')), 'Plot 1 result does not exist.' + assert os.path.exists(os.path.join(cwd ,'2_plot.ppm')), 'Plot 2 result does not exist.' + assert os.path.exists(os.path.join(cwd ,'3_plot.ppm')), 'Plot 3 result does not exist.' def teardown(): - output = [cwd + '/1_plot.ppm', cwd + '/2_plot.ppm', cwd + '/3_plot.ppm'] + output = [os.path.join(cwd ,'1_plot.ppm'), os.path.join(cwd ,'2_plot.ppm'), os.path.join(cwd ,'3_plot.ppm')] for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_ptables_off/test_ptables_off.py b/tests/test_ptables_off/test_ptables_off.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_ptables_off/test_ptables_off.py +++ b/tests/test_ptables_off/test_ptables_off.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_reflective_cone/test_reflective_cone.py b/tests/test_reflective_cone/test_reflective_cone.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_reflective_cone/test_reflective_cone.py +++ b/tests/test_reflective_cone/test_reflective_cone.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_reflective_cylinder/test_reflective_cylinder.py b/tests/test_reflective_cylinder/test_reflective_cylinder.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_reflective_cylinder/test_reflective_cylinder.py +++ b/tests/test_reflective_cylinder/test_reflective_cylinder.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_reflective_plane/test_reflective_plane.py b/tests/test_reflective_plane/test_reflective_plane.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_reflective_plane/test_reflective_plane.py +++ b/tests/test_reflective_plane/test_reflective_plane.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_reflective_sphere/test_reflective_sphere.py b/tests/test_reflective_sphere/test_reflective_sphere.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_reflective_sphere/test_reflective_sphere.py +++ b/tests/test_reflective_sphere/test_reflective_sphere.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_rotation/test_rotation.py b/tests/test_rotation/test_rotation.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_rotation/test_rotation.py +++ b/tests/test_rotation/test_rotation.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_salphabeta/test_salphabeta.py b/tests/test_salphabeta/test_salphabeta.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_salphabeta/test_salphabeta.py +++ b/tests/test_salphabeta/test_salphabeta.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_salphabeta_multiple/test_salphabeta_multiple.py b/tests/test_salphabeta_multiple/test_salphabeta_multiple.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_salphabeta_multiple/test_salphabeta_multiple.py +++ b/tests/test_salphabeta_multiple/test_salphabeta_multiple.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_MT/test_score_MT.py b/tests/test_score_MT/test_score_MT.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_MT/test_score_MT.py +++ b/tests/test_score_MT/test_score_MT.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_absorption/test_score_absorption.py b/tests/test_score_absorption/test_score_absorption.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_absorption/test_score_absorption.py +++ b/tests/test_score_absorption/test_score_absorption.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_current/test_score_current.py b/tests/test_score_current/test_score_current.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_current/test_score_current.py +++ b/tests/test_score_current/test_score_current.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_events/test_score_events.py b/tests/test_score_events/test_score_events.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_events/test_score_events.py +++ b/tests/test_score_events/test_score_events.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_fission/test_score_fission.py b/tests/test_score_fission/test_score_fission.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_fission/test_score_fission.py +++ b/tests/test_score_fission/test_score_fission.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_flux/test_score_flux.py b/tests/test_score_flux/test_score_flux.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_flux/test_score_flux.py +++ b/tests/test_score_flux/test_score_flux.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_kappafission/test_score_kappafission.py b/tests/test_score_kappafission/test_score_kappafission.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_kappafission/test_score_kappafission.py +++ b/tests/test_score_kappafission/test_score_kappafission.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_nufission/test_score_nufission.py b/tests/test_score_nufission/test_score_nufission.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_nufission/test_score_nufission.py +++ b/tests/test_score_nufission/test_score_nufission.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_nuscatter/test_score_nuscatter.py b/tests/test_score_nuscatter/test_score_nuscatter.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_nuscatter/test_score_nuscatter.py +++ b/tests/test_score_nuscatter/test_score_nuscatter.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_scatter/test_score_scatter.py b/tests/test_score_scatter/test_score_scatter.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_scatter/test_score_scatter.py +++ b/tests/test_score_scatter/test_score_scatter.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_scatter_n/test_score_scatter_n.py b/tests/test_score_scatter_n/test_score_scatter_n.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_scatter_n/test_score_scatter_n.py +++ b/tests/test_score_scatter_n/test_score_scatter_n.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_scatter_pn/test_score_scatter_pn.py b/tests/test_score_scatter_pn/test_score_scatter_pn.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_scatter_pn/test_score_scatter_pn.py +++ b/tests/test_score_scatter_pn/test_score_scatter_pn.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_total/test_score_total.py b/tests/test_score_total/test_score_total.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_score_total/test_score_total.py +++ b/tests/test_score_total/test_score_total.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_seed/test_seed.py b/tests/test_seed/test_seed.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_seed/test_seed.py +++ b/tests/test_seed/test_seed.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_angle_mono/test_source_angle_mono.py b/tests/test_source_angle_mono/test_source_angle_mono.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_source_angle_mono/test_source_angle_mono.py +++ b/tests/test_source_angle_mono/test_source_angle_mono.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_energy_maxwell/test_source_energy_maxwell.py b/tests/test_source_energy_maxwell/test_source_energy_maxwell.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_source_energy_maxwell/test_source_energy_maxwell.py +++ b/tests/test_source_energy_maxwell/test_source_energy_maxwell.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_energy_mono/test_source_energy_mono.py b/tests/test_source_energy_mono/test_source_energy_mono.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_source_energy_mono/test_source_energy_mono.py +++ b/tests/test_source_energy_mono/test_source_energy_mono.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_file/test_source_file.py b/tests/test_source_file/test_source_file.py index 1be4b92cf8..af1f2f5bef 100644 --- a/tests/test_source_file/test_source_file.py +++ b/tests/test_source_file/test_source_file.py @@ -61,18 +61,18 @@ def test_run1(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' - source = glob.glob(cwd + '/source.10.*') + source = glob.glob(os.path.join(cwd,'source.10.*')) assert len(statepoint) == 1, 'Either multple or no source files exist.' assert source[0].endswith('binary') or source[0].endswith('h5'),\ 'Source file is not a binary or hdf5 file.' def test_run2(): - openmc_path = cwd + '/../../src/openmc' - source = glob.glob(cwd + '/source.10.*') + openmc_path = os.path.join(cwd, '../../src/openmc') + source = glob.glob(os.path.join(cwd,'source.10.*')) with open('settings.xml','w') as fh: fh.write(settings2.format(source[0].split('.')[2])) if opts.mpi_exec != '': @@ -85,7 +85,7 @@ def test_run2(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -95,9 +95,9 @@ def test_results(): def teardown(): with open('settings.xml','w') as fh: fh.write(settings1) - output = glob.glob(cwd + '/statepoint.10.*') - output += glob.glob(cwd + '/source.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output += glob.glob(os.path.join(cwd,'source.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_point/test_source_point.py b/tests/test_source_point/test_source_point.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_source_point/test_source_point.py +++ b/tests/test_source_point/test_source_point.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_sourcepoint_batch/test_sourcepoint_batch.py b/tests/test_sourcepoint_batch/test_sourcepoint_batch.py index e7fd49b40a..a6805922fe 100644 --- a/tests/test_sourcepoint_batch/test_sourcepoint_batch.py +++ b/tests/test_sourcepoint_batch/test_sourcepoint_batch.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(cwd + '/statepoint.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.*')) assert len(statepoint) == 5, '5 statepoint files must exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file detected that is not binary or hdf5.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.8.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.8.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do no agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd, 'statepoint.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_sourcepoint_interval/test_sourcepoint_interval.py b/tests/test_sourcepoint_interval/test_sourcepoint_interval.py index d59b5261d4..f0e4d27549 100644 --- a/tests/test_sourcepoint_interval/test_sourcepoint_interval.py +++ b/tests/test_sourcepoint_interval/test_sourcepoint_interval.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(cwd + '/statepoint.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.*')) assert len(statepoint) == 5, '5 statepoint files must exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file detected that is not binary or hdf5.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.8.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.8.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd, 'statepoint.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_sourcepoint_latest/test_sourcepoint_latest.py b/tests/test_sourcepoint_latest/test_sourcepoint_latest.py index 858656e837..84791251b6 100644 --- a/tests/test_sourcepoint_latest/test_sourcepoint_latest.py +++ b/tests/test_sourcepoint_latest/test_sourcepoint_latest.py @@ -24,17 +24,17 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint file exists.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' - source = glob.glob(cwd + '/source.*') + source = glob.glob(os.path.join(cwd,'source.*')) assert len(source) == 1, 'Either multple or no source file exists.' assert source[0].endswith('binary') or source[0].endswith('h5'),\ 'Source file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -42,9 +42,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output += glob.glob(cwd + '/source.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output += glob.glob(os.path.join(cwd,'source.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_sourcepoint_restart/test_sourcepoint_restart.py b/tests/test_sourcepoint_restart/test_sourcepoint_restart.py index 81b16255f7..8f2cf64c11 100644 --- a/tests/test_sourcepoint_restart/test_sourcepoint_restart.py +++ b/tests/test_sourcepoint_restart/test_sourcepoint_restart.py @@ -24,17 +24,17 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.*')) assert len(statepoint) == 2, '2 statepoint files must exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file must either be binary or hdf5.' - sourcepoint = glob.glob(cwd + '/source.7.*') + sourcepoint = glob.glob(os.path.join(cwd,'source.7.*')) assert len(sourcepoint) == 1, 'Either multiple or no source files found.' assert sourcepoint[0].endswith('binary') or sourcepoint[0].endswith('h5'),\ 'Source file must either be binary or hdf5.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -43,8 +43,8 @@ def test_results(): os.remove(statepoint[0]) def test_restart_form1(): - statepoint = glob.glob(cwd + '/statepoint.7.*') - sourcepoint = glob.glob(cwd + '/source.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + sourcepoint = glob.glob(os.path.join(cwd,'source.7.*')) if opts.mpi_exec != '': proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '-r', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) @@ -55,13 +55,13 @@ def test_restart_form1(): assert returncode == 0, 'OpenMC restart 1 did not exit successfully.' def test_created_statepoint_form1(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Batch 10 statepoint file does not exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file must be a binary or hdf5 file.' def test_results_form1(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -70,8 +70,8 @@ def test_results_form1(): os.remove(statepoint[0]) def test_restart_form2(): - statepoint = glob.glob(cwd + '/statepoint.7.*') - sourcepoint = glob.glob(cwd + '/source.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + sourcepoint = glob.glob(os.path.join(cwd,'source.7.*')) if opts.mpi_exec != '': proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '--restart', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) @@ -82,13 +82,13 @@ def test_restart_form2(): assert returncode == 0, 'OpenMC restart 2 did not exit successfully.' def test_created_statepoint_form2(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Batch 10 statepoint file does not exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file not a binary or hdf5 file.' def test_results_form2(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -97,21 +97,21 @@ def test_results_form2(): os.remove(statepoint[0]) def test_restart_serial(): - statepoint = glob.glob(cwd + '/statepoint.7.*') - sourcepoint = glob.glob(cwd + '/source.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + sourcepoint = glob.glob(os.path.join(cwd,'source.7.*')) proc = Popen([opts.exe, '--restart', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode assert returncode == 0, 'OpenMC restart serial did not exit successfully.' def test_created_statepoint_serial(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Batch 10 statepoint file does not exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results_serial(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -119,9 +119,9 @@ def test_results_serial(): assert compare, 'Serial results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.*') - output += glob.glob(cwd + '/source.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd, 'statepoint.*')) + output += glob.glob(os.path.join(cwd,'source.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_statepoint_batch/test_statepoint_batch.py b/tests/test_statepoint_batch/test_statepoint_batch.py index ea3993d10b..add8364625 100644 --- a/tests/test_statepoint_batch/test_statepoint_batch.py +++ b/tests/test_statepoint_batch/test_statepoint_batch.py @@ -24,21 +24,21 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoints_exist(): - statepoint = glob.glob(cwd + '/statepoint.3.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.3.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint.3 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.3 file is not a binary or hdf5 file.' - statepoint = glob.glob(cwd + '/statepoint.6.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.6.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint.6 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.6 file is not a binary or hdf5 file.' - statepoint = glob.glob(cwd + '/statepoint.9.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.9.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint.9 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.9 file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.9.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.9.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -46,8 +46,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd, 'statepoint*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_statepoint_interval/test_statepoint_interval.py b/tests/test_statepoint_interval/test_statepoint_interval.py index f80cc2dca2..48427fa5c8 100644 --- a/tests/test_statepoint_interval/test_statepoint_interval.py +++ b/tests/test_statepoint_interval/test_statepoint_interval.py @@ -25,29 +25,29 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoints_exist(): - statepoint = glob.glob(cwd + '/statepoint.2.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.2.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint.2 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.2 file is not a binary or hdf5 file.' - statepoint = glob.glob(cwd + '/statepoint.4.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.4.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint.4 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.4 file is not a binary or hdf5 file.' - statepoint = glob.glob(cwd + '/statepoint.6.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.6.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint.6 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.6 file is not a binary or hdf5 file.' - statepoint = glob.glob(cwd + '/statepoint.8.*') + statepoint = glob.glob(os.path.join(cwd, 'statepoint.8.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint.8 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.8 file is not a binary or hdf5 file.' - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint.10 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.10 file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -55,8 +55,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd, 'statepoint.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_statepoint_restart/test_statepoint_restart.py b/tests/test_statepoint_restart/test_statepoint_restart.py index 06b982917b..8bb0eec054 100644 --- a/tests/test_statepoint_restart/test_statepoint_restart.py +++ b/tests/test_statepoint_restart/test_statepoint_restart.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,7 +38,7 @@ def test_results(): assert compare, 'Initial test results do not agree.' def test_restart_form1(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) if opts.mpi_exec != '': proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '-r', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) @@ -49,13 +49,13 @@ def test_restart_form1(): assert returncode == 0, 'OpenMC restart 1 did not exit successfully.' def test_created_statepoint_form1(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results_form1(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -63,7 +63,7 @@ def test_results_form1(): assert compare, 'Restart 1 test results do not agree.' def test_restart_form2(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) if opts.mpi_exec != '': proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '--restart', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) @@ -74,13 +74,13 @@ def test_restart_form2(): assert returncode == 0, 'OpenMC restart 2 did not exit successfully.' def test_created_statepoint_form2(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results_form2(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -88,20 +88,20 @@ def test_results_form2(): assert compare, 'Restart 2 test results do not agree.' def test_restart_serial(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) proc = Popen([opts.exe, '--restart', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode assert returncode == 0, 'OpenMC restart serial did not exit successfully.' def test_created_statepoint_serial(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results_serial(): - statepoint = glob.glob(cwd + '/statepoint.7.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -109,8 +109,8 @@ def test_results_serial(): assert compare, 'Restart serial test results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.7.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.7.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py b/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py index 00e70444d0..7329c9cee5 100644 --- a/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py +++ b/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py @@ -24,17 +24,17 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' - source = glob.glob(cwd + '/source.10.*') + source = glob.glob(os.path.join(cwd,'source.10.*')) assert len(source) == 1, 'Either multiple or no source files exist.' assert source[0].endswith('binary') or source[0].endswith('h5'),\ 'Source file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -42,9 +42,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output += glob.glob(cwd + '/source.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output += glob.glob(os.path.join(cwd,'source.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_survival_biasing/test_survival_biasing.py b/tests/test_survival_biasing/test_survival_biasing.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_survival_biasing/test_survival_biasing.py +++ b/tests/test_survival_biasing/test_survival_biasing.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_tally_assumesep/test_tally_assumesep.py b/tests/test_tally_assumesep/test_tally_assumesep.py index f2068f85f9..a5aeeb683c 100644 --- a/tests/test_tally_assumesep/test_tally_assumesep.py +++ b/tests/test_tally_assumesep/test_tally_assumesep.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(cwd + '/tallies.out'), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/tallies.out') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'tallies.out')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_trace/test_trace.py b/tests/test_trace/test_trace.py index dae89b62b4..658cf12998 100644 --- a/tests/test_trace/test_trace.py +++ b/tests/test_trace/test_trace.py @@ -26,13 +26,13 @@ def test_run(): assert stdout.find('Simulating Particle 453') != -1 def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -40,8 +40,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_translation/test_translation.py b/tests/test_translation/test_translation.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_translation/test_translation.py +++ b/tests/test_translation/test_translation.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_uniform_fs/test_uniform_fs.py b/tests/test_uniform_fs/test_uniform_fs.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_uniform_fs/test_uniform_fs.py +++ b/tests/test_uniform_fs/test_uniform_fs.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_universe/test_universe.py b/tests/test_universe/test_universe.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_universe/test_universe.py +++ b/tests/test_universe/test_universe.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_void/test_void.py b/tests/test_void/test_void.py index ef2dceed89..0be8e10b07 100644 --- a/tests/test_void/test_void.py +++ b/tests/test_void/test_void.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(cwd + '/statepoint.10.*') + statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(cwd + '/statepoint.10.*') - output.append(cwd + '/results_test.dat') + output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + output.append(os.path.join(cwd,'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) From 1a61345d380e0ef522d21af97f49409d030f912d Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Tue, 8 Apr 2014 18:39:40 -0400 Subject: [PATCH 48/51] added a space --- tests/test_basic/test_basic.py | 8 ++--- tests/test_cmfd_feed/test_cmfd_feed.py | 12 +++---- tests/test_cmfd_jfnk/test_cmfd_jfnk.py | 12 +++---- tests/test_cmfd_nofeed/test_cmfd_nofeed.py | 12 +++---- .../test_confidence_intervals.py | 12 +++---- .../test_density_atombcm.py | 8 ++--- .../test_density_atomcm3.py | 6 ++-- tests/test_density_kgm3/test_density_kgm3.py | 8 ++--- tests/test_density_sum/test_density_sum.py | 6 ++-- .../test_eigenvalue_genperbatch.py | 8 ++--- .../test_eigenvalue_no_inactive.py | 8 ++--- tests/test_energy_grid/test_energy_grid.py | 8 ++--- tests/test_entropy/test_entropy.py | 8 ++--- tests/test_filter_cell/test_filter_cell.py | 12 +++---- .../test_filter_cellborn.py | 12 +++---- .../test_filter_energy/test_filter_energy.py | 12 +++---- .../test_filter_energyout.py | 12 +++---- .../test_filter_group_transfer.py | 12 +++---- .../test_filter_material.py | 12 +++---- .../test_filter_mesh_2d.py | 12 +++---- .../test_filter_mesh_3d.py | 12 +++---- .../test_filter_universe.py | 12 +++---- tests/test_fixed_source/test_fixed_source.py | 12 +++---- tests/test_lattice/test_lattice.py | 8 ++--- .../test_lattice_multiple.py | 8 ++--- .../test_natural_element.py | 8 ++--- tests/test_output/test_output.py | 12 +++---- .../test_particle_restart.py | 2 +- tests/test_ptables_off/test_ptables_off.py | 8 ++--- .../test_reflective_cone.py | 8 ++--- .../test_reflective_cylinder.py | 8 ++--- .../test_reflective_plane.py | 8 ++--- .../test_reflective_sphere.py | 8 ++--- tests/test_rotation/test_rotation.py | 8 ++--- tests/test_salphabeta/test_salphabeta.py | 8 ++--- .../test_salphabeta_multiple.py | 8 ++--- tests/test_score_MT/test_score_MT.py | 12 +++---- .../test_score_absorption.py | 12 +++---- .../test_score_current/test_score_current.py | 12 +++---- tests/test_score_events/test_score_events.py | 12 +++---- .../test_score_fission/test_score_fission.py | 12 +++---- tests/test_score_flux/test_score_flux.py | 12 +++---- .../test_score_kappafission.py | 12 +++---- .../test_score_nufission.py | 12 +++---- .../test_score_nuscatter.py | 12 +++---- .../test_score_scatter/test_score_scatter.py | 12 +++---- .../test_score_scatter_n.py | 12 +++---- .../test_score_scatter_pn.py | 12 +++---- tests/test_score_total/test_score_total.py | 12 +++---- tests/test_seed/test_seed.py | 8 ++--- .../test_source_angle_mono.py | 8 ++--- .../test_source_energy_maxwell.py | 8 ++--- .../test_source_energy_mono.py | 8 ++--- tests/test_source_file/test_source_file.py | 14 ++++---- tests/test_source_point/test_source_point.py | 8 ++--- .../test_sourcepoint_batch.py | 2 +- .../test_sourcepoint_interval.py | 2 +- .../test_sourcepoint_latest.py | 12 +++---- .../test_sourcepoint_restart.py | 32 +++++++++---------- .../test_statepoint_batch.py | 2 +- .../test_statepoint_interval.py | 6 ++-- .../test_statepoint_restart.py | 26 +++++++-------- .../test_statepoint_sourcesep.py | 12 +++---- .../test_survival_biasing.py | 8 ++--- .../test_tally_assumesep.py | 12 +++---- tests/test_trace/test_trace.py | 8 ++--- tests/test_translation/test_translation.py | 8 ++--- tests/test_uniform_fs/test_uniform_fs.py | 8 ++--- tests/test_universe/test_universe.py | 8 ++--- tests/test_void/test_void.py | 8 ++--- 70 files changed, 351 insertions(+), 351 deletions(-) diff --git a/tests/test_basic/test_basic.py b/tests/test_basic/test_basic.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_basic/test_basic.py +++ b/tests/test_basic/test_basic.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_cmfd_feed/test_cmfd_feed.py b/tests/test_cmfd_feed/test_cmfd_feed.py index 5610cfee4f..20ee11f4d2 100644 --- a/tests/test_cmfd_feed/test_cmfd_feed.py +++ b/tests/test_cmfd_feed/test_cmfd_feed.py @@ -24,18 +24,18 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.20.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.20.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -44,9 +44,9 @@ def test_results(): def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.20.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.20.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_cmfd_jfnk/test_cmfd_jfnk.py b/tests/test_cmfd_jfnk/test_cmfd_jfnk.py index ec984a74b3..f270c105a1 100644 --- a/tests/test_cmfd_jfnk/test_cmfd_jfnk.py +++ b/tests/test_cmfd_jfnk/test_cmfd_jfnk.py @@ -25,18 +25,18 @@ def test_run(): def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.20.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.20.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -45,9 +45,9 @@ def test_results(): def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.20.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.20.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_cmfd_nofeed/test_cmfd_nofeed.py b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py index ec984a74b3..f270c105a1 100644 --- a/tests/test_cmfd_nofeed/test_cmfd_nofeed.py +++ b/tests/test_cmfd_nofeed/test_cmfd_nofeed.py @@ -25,18 +25,18 @@ def test_run(): def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.20.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.20.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.20.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -45,9 +45,9 @@ def test_results(): def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.20.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.20.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_confidence_intervals/test_confidence_intervals.py b/tests/test_confidence_intervals/test_confidence_intervals.py index bf28e47d1e..650d94cb97 100644 --- a/tests/test_confidence_intervals/test_confidence_intervals.py +++ b/tests/test_confidence_intervals/test_confidence_intervals.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_created_output(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) - output.append(os.path.join(cwd,'tallies.out')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) + output.append(os.path.join(cwd, 'tallies.out')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_atombcm/test_density_atombcm.py b/tests/test_density_atombcm/test_density_atombcm.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_density_atombcm/test_density_atombcm.py +++ b/tests/test_density_atombcm/test_density_atombcm.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_atomcm3/test_density_atomcm3.py b/tests/test_density_atomcm3/test_density_atomcm3.py index 9d1a7e5671..db434dd378 100644 --- a/tests/test_density_atomcm3/test_density_atomcm3.py +++ b/tests/test_density_atomcm3/test_density_atomcm3.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -39,7 +39,7 @@ def test_results(): def teardown(): output = glob.glob('statepoint.10.*') - output.append(os.path.join(cwd,'results_test.dat')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_kgm3/test_density_kgm3.py b/tests/test_density_kgm3/test_density_kgm3.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_density_kgm3/test_density_kgm3.py +++ b/tests/test_density_kgm3/test_density_kgm3.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_density_sum/test_density_sum.py b/tests/test_density_sum/test_density_sum.py index 682cea7a48..20e55c64c7 100644 --- a/tests/test_density_sum/test_density_sum.py +++ b/tests/test_density_sum/test_density_sum.py @@ -24,7 +24,7 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py b/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py index de621617d2..59862c0281 100644 --- a/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py +++ b/tests/test_eigenvalue_genperbatch/test_eigenvalue_genperbatch.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.7.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.7.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py b/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py +++ b/tests/test_eigenvalue_no_inactive/test_eigenvalue_no_inactive.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_energy_grid/test_energy_grid.py b/tests/test_energy_grid/test_energy_grid.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_energy_grid/test_energy_grid.py +++ b/tests/test_energy_grid/test_energy_grid.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_entropy/test_entropy.py b/tests/test_entropy/test_entropy.py index e68f948cde..bdfb6269e2 100644 --- a/tests/test_entropy/test_entropy.py +++ b/tests/test_entropy/test_entropy.py @@ -25,13 +25,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -39,8 +39,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_cell/test_filter_cell.py b/tests/test_filter_cell/test_filter_cell.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_filter_cell/test_filter_cell.py +++ b/tests/test_filter_cell/test_filter_cell.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_cellborn/test_filter_cellborn.py b/tests/test_filter_cellborn/test_filter_cellborn.py index fb1d801da4..cf1f0c2884 100644 --- a/tests/test_filter_cellborn/test_filter_cellborn.py +++ b/tests/test_filter_cellborn/test_filter_cellborn.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,9 +38,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_energy/test_filter_energy.py b/tests/test_filter_energy/test_filter_energy.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_filter_energy/test_filter_energy.py +++ b/tests/test_filter_energy/test_filter_energy.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_energyout/test_filter_energyout.py b/tests/test_filter_energyout/test_filter_energyout.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_filter_energyout/test_filter_energyout.py +++ b/tests/test_filter_energyout/test_filter_energyout.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_group_transfer/test_filter_group_transfer.py b/tests/test_filter_group_transfer/test_filter_group_transfer.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_filter_group_transfer/test_filter_group_transfer.py +++ b/tests/test_filter_group_transfer/test_filter_group_transfer.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_material/test_filter_material.py b/tests/test_filter_material/test_filter_material.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_filter_material/test_filter_material.py +++ b/tests/test_filter_material/test_filter_material.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_mesh_2d/test_filter_mesh_2d.py b/tests/test_filter_mesh_2d/test_filter_mesh_2d.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_filter_mesh_2d/test_filter_mesh_2d.py +++ b/tests/test_filter_mesh_2d/test_filter_mesh_2d.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_mesh_3d/test_filter_mesh_3d.py b/tests/test_filter_mesh_3d/test_filter_mesh_3d.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_filter_mesh_3d/test_filter_mesh_3d.py +++ b/tests/test_filter_mesh_3d/test_filter_mesh_3d.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_filter_universe/test_filter_universe.py b/tests/test_filter_universe/test_filter_universe.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_filter_universe/test_filter_universe.py +++ b/tests/test_filter_universe/test_filter_universe.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_fixed_source/test_fixed_source.py b/tests/test_fixed_source/test_fixed_source.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_fixed_source/test_fixed_source.py +++ b/tests/test_fixed_source/test_fixed_source.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_lattice/test_lattice.py b/tests/test_lattice/test_lattice.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_lattice/test_lattice.py +++ b/tests/test_lattice/test_lattice.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_lattice_multiple/test_lattice_multiple.py b/tests/test_lattice_multiple/test_lattice_multiple.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_lattice_multiple/test_lattice_multiple.py +++ b/tests/test_lattice_multiple/test_lattice_multiple.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_natural_element/test_natural_element.py b/tests/test_natural_element/test_natural_element.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_natural_element/test_natural_element.py +++ b/tests/test_natural_element/test_natural_element.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_output/test_output.py b/tests/test_output/test_output.py index 30db431bcb..cb960cfe64 100644 --- a/tests/test_output/test_output.py +++ b/tests/test_output/test_output.py @@ -24,7 +24,7 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_summary_exists(): - summary = glob.glob(os.path.join(cwd,'summary.*')) + summary = glob.glob(os.path.join(cwd, 'summary.*')) assert len(summary) == 1, 'Either multiple or no summary file exists.' assert summary[0].endswith('out') or summary[0].endswith('h5'),\ 'Summary file is not a binary or hdf5 file.' @@ -34,13 +34,13 @@ def test_cross_sections_exists(): 'Cross section output file does not exist.' def test_statepoint_exists(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -48,10 +48,10 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) + glob.glob(os.path.join(cwd,'summary.*')) - output.append(os.path.join(cwd,'summary.out')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + glob.glob(os.path.join(cwd, 'summary.*')) + output.append(os.path.join(cwd, 'summary.out')) output.append(os.path.join(cwd, 'cross_sections.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_particle_restart/test_particle_restart.py b/tests/test_particle_restart/test_particle_restart.py index c6d62a87db..e1dea5b054 100644 --- a/tests/test_particle_restart/test_particle_restart.py +++ b/tests/test_particle_restart/test_particle_restart.py @@ -46,7 +46,7 @@ def test_run_restart(): def teardown(): output = glob.glob(os.path.join(cwd, 'statepoint.*')) + \ glob.glob(os.path.join(cwd, 'particle_*')) + \ - [os.path.join(cwd,'results_test.dat')] + [os.path.join(cwd, 'results_test.dat')] for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_ptables_off/test_ptables_off.py b/tests/test_ptables_off/test_ptables_off.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_ptables_off/test_ptables_off.py +++ b/tests/test_ptables_off/test_ptables_off.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_reflective_cone/test_reflective_cone.py b/tests/test_reflective_cone/test_reflective_cone.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_reflective_cone/test_reflective_cone.py +++ b/tests/test_reflective_cone/test_reflective_cone.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_reflective_cylinder/test_reflective_cylinder.py b/tests/test_reflective_cylinder/test_reflective_cylinder.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_reflective_cylinder/test_reflective_cylinder.py +++ b/tests/test_reflective_cylinder/test_reflective_cylinder.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_reflective_plane/test_reflective_plane.py b/tests/test_reflective_plane/test_reflective_plane.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_reflective_plane/test_reflective_plane.py +++ b/tests/test_reflective_plane/test_reflective_plane.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_reflective_sphere/test_reflective_sphere.py b/tests/test_reflective_sphere/test_reflective_sphere.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_reflective_sphere/test_reflective_sphere.py +++ b/tests/test_reflective_sphere/test_reflective_sphere.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_rotation/test_rotation.py b/tests/test_rotation/test_rotation.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_rotation/test_rotation.py +++ b/tests/test_rotation/test_rotation.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_salphabeta/test_salphabeta.py b/tests/test_salphabeta/test_salphabeta.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_salphabeta/test_salphabeta.py +++ b/tests/test_salphabeta/test_salphabeta.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_salphabeta_multiple/test_salphabeta_multiple.py b/tests/test_salphabeta_multiple/test_salphabeta_multiple.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_salphabeta_multiple/test_salphabeta_multiple.py +++ b/tests/test_salphabeta_multiple/test_salphabeta_multiple.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_MT/test_score_MT.py b/tests/test_score_MT/test_score_MT.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_MT/test_score_MT.py +++ b/tests/test_score_MT/test_score_MT.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_absorption/test_score_absorption.py b/tests/test_score_absorption/test_score_absorption.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_absorption/test_score_absorption.py +++ b/tests/test_score_absorption/test_score_absorption.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_current/test_score_current.py b/tests/test_score_current/test_score_current.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_current/test_score_current.py +++ b/tests/test_score_current/test_score_current.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_events/test_score_events.py b/tests/test_score_events/test_score_events.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_events/test_score_events.py +++ b/tests/test_score_events/test_score_events.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_fission/test_score_fission.py b/tests/test_score_fission/test_score_fission.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_fission/test_score_fission.py +++ b/tests/test_score_fission/test_score_fission.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_flux/test_score_flux.py b/tests/test_score_flux/test_score_flux.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_flux/test_score_flux.py +++ b/tests/test_score_flux/test_score_flux.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_kappafission/test_score_kappafission.py b/tests/test_score_kappafission/test_score_kappafission.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_kappafission/test_score_kappafission.py +++ b/tests/test_score_kappafission/test_score_kappafission.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_nufission/test_score_nufission.py b/tests/test_score_nufission/test_score_nufission.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_nufission/test_score_nufission.py +++ b/tests/test_score_nufission/test_score_nufission.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_nuscatter/test_score_nuscatter.py b/tests/test_score_nuscatter/test_score_nuscatter.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_nuscatter/test_score_nuscatter.py +++ b/tests/test_score_nuscatter/test_score_nuscatter.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_scatter/test_score_scatter.py b/tests/test_score_scatter/test_score_scatter.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_scatter/test_score_scatter.py +++ b/tests/test_score_scatter/test_score_scatter.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_scatter_n/test_score_scatter_n.py b/tests/test_score_scatter_n/test_score_scatter_n.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_scatter_n/test_score_scatter_n.py +++ b/tests/test_score_scatter_n/test_score_scatter_n.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_scatter_pn/test_score_scatter_pn.py b/tests/test_score_scatter_pn/test_score_scatter_pn.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_scatter_pn/test_score_scatter_pn.py +++ b/tests/test_score_scatter_pn/test_score_scatter_pn.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_score_total/test_score_total.py b/tests/test_score_total/test_score_total.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_score_total/test_score_total.py +++ b/tests/test_score_total/test_score_total.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_seed/test_seed.py b/tests/test_seed/test_seed.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_seed/test_seed.py +++ b/tests/test_seed/test_seed.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_angle_mono/test_source_angle_mono.py b/tests/test_source_angle_mono/test_source_angle_mono.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_source_angle_mono/test_source_angle_mono.py +++ b/tests/test_source_angle_mono/test_source_angle_mono.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_energy_maxwell/test_source_energy_maxwell.py b/tests/test_source_energy_maxwell/test_source_energy_maxwell.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_source_energy_maxwell/test_source_energy_maxwell.py +++ b/tests/test_source_energy_maxwell/test_source_energy_maxwell.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_energy_mono/test_source_energy_mono.py b/tests/test_source_energy_mono/test_source_energy_mono.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_source_energy_mono/test_source_energy_mono.py +++ b/tests/test_source_energy_mono/test_source_energy_mono.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_file/test_source_file.py b/tests/test_source_file/test_source_file.py index af1f2f5bef..51801c4dd9 100644 --- a/tests/test_source_file/test_source_file.py +++ b/tests/test_source_file/test_source_file.py @@ -61,18 +61,18 @@ def test_run1(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' - source = glob.glob(os.path.join(cwd,'source.10.*')) + source = glob.glob(os.path.join(cwd, 'source.10.*')) assert len(statepoint) == 1, 'Either multple or no source files exist.' assert source[0].endswith('binary') or source[0].endswith('h5'),\ 'Source file is not a binary or hdf5 file.' def test_run2(): openmc_path = os.path.join(cwd, '../../src/openmc') - source = glob.glob(os.path.join(cwd,'source.10.*')) + source = glob.glob(os.path.join(cwd, 'source.10.*')) with open('settings.xml','w') as fh: fh.write(settings2.format(source[0].split('.')[2])) if opts.mpi_exec != '': @@ -85,7 +85,7 @@ def test_run2(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -95,9 +95,9 @@ def test_results(): def teardown(): with open('settings.xml','w') as fh: fh.write(settings1) - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output += glob.glob(os.path.join(cwd,'source.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output += glob.glob(os.path.join(cwd, 'source.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_source_point/test_source_point.py b/tests/test_source_point/test_source_point.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_source_point/test_source_point.py +++ b/tests/test_source_point/test_source_point.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_sourcepoint_batch/test_sourcepoint_batch.py b/tests/test_sourcepoint_batch/test_sourcepoint_batch.py index a6805922fe..28fd9badd2 100644 --- a/tests/test_sourcepoint_batch/test_sourcepoint_batch.py +++ b/tests/test_sourcepoint_batch/test_sourcepoint_batch.py @@ -39,7 +39,7 @@ def test_results(): def teardown(): output = glob.glob(os.path.join(cwd, 'statepoint.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_sourcepoint_interval/test_sourcepoint_interval.py b/tests/test_sourcepoint_interval/test_sourcepoint_interval.py index f0e4d27549..c667f8adba 100644 --- a/tests/test_sourcepoint_interval/test_sourcepoint_interval.py +++ b/tests/test_sourcepoint_interval/test_sourcepoint_interval.py @@ -39,7 +39,7 @@ def test_results(): def teardown(): output = glob.glob(os.path.join(cwd, 'statepoint.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_sourcepoint_latest/test_sourcepoint_latest.py b/tests/test_sourcepoint_latest/test_sourcepoint_latest.py index 84791251b6..198d7a346c 100644 --- a/tests/test_sourcepoint_latest/test_sourcepoint_latest.py +++ b/tests/test_sourcepoint_latest/test_sourcepoint_latest.py @@ -24,17 +24,17 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint file exists.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' - source = glob.glob(os.path.join(cwd,'source.*')) + source = glob.glob(os.path.join(cwd, 'source.*')) assert len(source) == 1, 'Either multple or no source file exists.' assert source[0].endswith('binary') or source[0].endswith('h5'),\ 'Source file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -42,9 +42,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output += glob.glob(os.path.join(cwd,'source.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output += glob.glob(os.path.join(cwd, 'source.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_sourcepoint_restart/test_sourcepoint_restart.py b/tests/test_sourcepoint_restart/test_sourcepoint_restart.py index 8f2cf64c11..56237c7f5c 100644 --- a/tests/test_sourcepoint_restart/test_sourcepoint_restart.py +++ b/tests/test_sourcepoint_restart/test_sourcepoint_restart.py @@ -28,13 +28,13 @@ def test_created_statepoint(): assert len(statepoint) == 2, '2 statepoint files must exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file must either be binary or hdf5.' - sourcepoint = glob.glob(os.path.join(cwd,'source.7.*')) + sourcepoint = glob.glob(os.path.join(cwd, 'source.7.*')) assert len(sourcepoint) == 1, 'Either multiple or no source files found.' assert sourcepoint[0].endswith('binary') or sourcepoint[0].endswith('h5'),\ 'Source file must either be binary or hdf5.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -43,8 +43,8 @@ def test_results(): os.remove(statepoint[0]) def test_restart_form1(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) - sourcepoint = glob.glob(os.path.join(cwd,'source.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) + sourcepoint = glob.glob(os.path.join(cwd, 'source.7.*')) if opts.mpi_exec != '': proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '-r', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) @@ -55,13 +55,13 @@ def test_restart_form1(): assert returncode == 0, 'OpenMC restart 1 did not exit successfully.' def test_created_statepoint_form1(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Batch 10 statepoint file does not exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file must be a binary or hdf5 file.' def test_results_form1(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -70,8 +70,8 @@ def test_results_form1(): os.remove(statepoint[0]) def test_restart_form2(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) - sourcepoint = glob.glob(os.path.join(cwd,'source.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) + sourcepoint = glob.glob(os.path.join(cwd, 'source.7.*')) if opts.mpi_exec != '': proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '--restart', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) @@ -82,13 +82,13 @@ def test_restart_form2(): assert returncode == 0, 'OpenMC restart 2 did not exit successfully.' def test_created_statepoint_form2(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Batch 10 statepoint file does not exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file not a binary or hdf5 file.' def test_results_form2(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -97,21 +97,21 @@ def test_results_form2(): os.remove(statepoint[0]) def test_restart_serial(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) - sourcepoint = glob.glob(os.path.join(cwd,'source.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) + sourcepoint = glob.glob(os.path.join(cwd, 'source.7.*')) proc = Popen([opts.exe, '--restart', statepoint[0], sourcepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode assert returncode == 0, 'OpenMC restart serial did not exit successfully.' def test_created_statepoint_serial(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Batch 10 statepoint file does not exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results_serial(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -120,8 +120,8 @@ def test_results_serial(): def teardown(): output = glob.glob(os.path.join(cwd, 'statepoint.*')) - output += glob.glob(os.path.join(cwd,'source.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output += glob.glob(os.path.join(cwd, 'source.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_statepoint_batch/test_statepoint_batch.py b/tests/test_statepoint_batch/test_statepoint_batch.py index add8364625..678369093e 100644 --- a/tests/test_statepoint_batch/test_statepoint_batch.py +++ b/tests/test_statepoint_batch/test_statepoint_batch.py @@ -47,7 +47,7 @@ def test_results(): def teardown(): output = glob.glob(os.path.join(cwd, 'statepoint*')) - output.append(os.path.join(cwd,'results_test.dat')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_statepoint_interval/test_statepoint_interval.py b/tests/test_statepoint_interval/test_statepoint_interval.py index 48427fa5c8..17a91fb3b0 100644 --- a/tests/test_statepoint_interval/test_statepoint_interval.py +++ b/tests/test_statepoint_interval/test_statepoint_interval.py @@ -41,13 +41,13 @@ def test_statepoints_exist(): assert len(statepoint) == 1, 'Either multiple or no statepoint.8 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.8 file is not a binary or hdf5 file.' - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint.10 files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint.10 file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -56,7 +56,7 @@ def test_results(): def teardown(): output = glob.glob(os.path.join(cwd, 'statepoint.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_statepoint_restart/test_statepoint_restart.py b/tests/test_statepoint_restart/test_statepoint_restart.py index 8bb0eec054..291fdef80d 100644 --- a/tests/test_statepoint_restart/test_statepoint_restart.py +++ b/tests/test_statepoint_restart/test_statepoint_restart.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,7 +38,7 @@ def test_results(): assert compare, 'Initial test results do not agree.' def test_restart_form1(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) if opts.mpi_exec != '': proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '-r', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) @@ -49,13 +49,13 @@ def test_restart_form1(): assert returncode == 0, 'OpenMC restart 1 did not exit successfully.' def test_created_statepoint_form1(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results_form1(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -63,7 +63,7 @@ def test_results_form1(): assert compare, 'Restart 1 test results do not agree.' def test_restart_form2(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) if opts.mpi_exec != '': proc = Popen([opts.mpi_exec, '-np', opts.mpi_np, opts.exe, '--restart', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) @@ -74,13 +74,13 @@ def test_restart_form2(): assert returncode == 0, 'OpenMC restart 2 did not exit successfully.' def test_created_statepoint_form2(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results_form2(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -88,20 +88,20 @@ def test_results_form2(): assert compare, 'Restart 2 test results do not agree.' def test_restart_serial(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) proc = Popen([opts.exe, '--restart', statepoint[0], cwd], stderr=STDOUT, stdout=PIPE) print(proc.communicate()[0]) returncode = proc.returncode assert returncode == 0, 'OpenMC restart serial did not exit successfully.' def test_created_statepoint_serial(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results_serial(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.7.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.7.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -109,8 +109,8 @@ def test_results_serial(): assert compare, 'Restart serial test results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.7.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.7.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py b/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py index 7329c9cee5..79b4bc5240 100644 --- a/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py +++ b/tests/test_statepoint_sourcesep/test_statepoint_sourcesep.py @@ -24,17 +24,17 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_statepoint_exists(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' - source = glob.glob(os.path.join(cwd,'source.10.*')) + source = glob.glob(os.path.join(cwd, 'source.10.*')) assert len(source) == 1, 'Either multiple or no source files exist.' assert source[0].endswith('binary') or source[0].endswith('h5'),\ 'Source file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -42,9 +42,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output += glob.glob(os.path.join(cwd,'source.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output += glob.glob(os.path.join(cwd, 'source.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_survival_biasing/test_survival_biasing.py b/tests/test_survival_biasing/test_survival_biasing.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_survival_biasing/test_survival_biasing.py +++ b/tests/test_survival_biasing/test_survival_biasing.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_tally_assumesep/test_tally_assumesep.py b/tests/test_tally_assumesep/test_tally_assumesep.py index a5aeeb683c..6e54389fc1 100644 --- a/tests/test_tally_assumesep/test_tally_assumesep.py +++ b/tests/test_tally_assumesep/test_tally_assumesep.py @@ -24,16 +24,16 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_output_exists(): - assert os.path.exists(os.path.join(cwd,'tallies.out')), 'Tally output file does not exist.' + assert os.path.exists(os.path.join(cwd, 'tallies.out')), 'Tally output file does not exist.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -41,9 +41,9 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'tallies.out')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'tallies.out')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_trace/test_trace.py b/tests/test_trace/test_trace.py index 658cf12998..429939f894 100644 --- a/tests/test_trace/test_trace.py +++ b/tests/test_trace/test_trace.py @@ -26,13 +26,13 @@ def test_run(): assert stdout.find('Simulating Particle 453') != -1 def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -40,8 +40,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_translation/test_translation.py b/tests/test_translation/test_translation.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_translation/test_translation.py +++ b/tests/test_translation/test_translation.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_uniform_fs/test_uniform_fs.py b/tests/test_uniform_fs/test_uniform_fs.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_uniform_fs/test_uniform_fs.py +++ b/tests/test_uniform_fs/test_uniform_fs.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_universe/test_universe.py b/tests/test_universe/test_universe.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_universe/test_universe.py +++ b/tests/test_universe/test_universe.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) diff --git a/tests/test_void/test_void.py b/tests/test_void/test_void.py index 0be8e10b07..bcc3f8a819 100644 --- a/tests/test_void/test_void.py +++ b/tests/test_void/test_void.py @@ -24,13 +24,13 @@ def test_run(): assert returncode == 0, 'OpenMC did not exit successfully.' def test_created_statepoint(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) assert len(statepoint) == 1, 'Either multiple or no statepoint files exist.' assert statepoint[0].endswith('binary') or statepoint[0].endswith('h5'),\ 'Statepoint file is not a binary or hdf5 file.' def test_results(): - statepoint = glob.glob(os.path.join(cwd,'statepoint.10.*')) + statepoint = glob.glob(os.path.join(cwd, 'statepoint.10.*')) call(['python', 'results.py', statepoint[0]]) compare = filecmp.cmp('results_test.dat', 'results_true.dat') if not compare: @@ -38,8 +38,8 @@ def test_results(): assert compare, 'Results do not agree.' def teardown(): - output = glob.glob(os.path.join(cwd,'statepoint.10.*')) - output.append(os.path.join(cwd,'results_test.dat')) + output = glob.glob(os.path.join(cwd, 'statepoint.10.*')) + output.append(os.path.join(cwd, 'results_test.dat')) for f in output: if os.path.exists(f): os.remove(f) From 11966227421b1815e4ad5c126c74dd5b4a25261c Mon Sep 17 00:00:00 2001 From: Bryan Herman Date: Thu, 10 Apr 2014 19:58:18 -0400 Subject: [PATCH 49/51] replaced has_key syntax --- tests/run_tests.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 74489feeb1..61c7702fb3 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -34,17 +34,17 @@ PHDF5_DIR='/opt/phdf5/1.8.12-gnu' PETSC_DIR='/opt/petsc/3.4.4-gnu' # Override default compiler paths if environmental vars are found -if os.environ.has_key('FC'): +if 'FC' in os.environ: FC = os.environ['FC'] if FC is not 'gfortran': print('NOTE: Test suite only verifed for gfortran compiler.') -if os.environ.has_key('MPI_DIR'): +if 'MPI_DIR' in os.environ: MPI_DIR = os.environ['MPI_DIR'] -if os.environ.has_key('HDF5_DIR'): +if 'HDF5_DIR' in os.environ: HDF5_DIR = os.environ['HDF5_DIR'] -if os.environ.has_key('PHDF5_DIR'): +if 'PHDF5_DIR' in os.environ: PHDF5_DIR = os.environ['PHDF5_DIR'] -if os.environ.has_key('PETSC_DIR'): +if 'PETSC_DIR' in os.environ: PETSC_DIR = os.environ['PETSC_DIR'] # Define test data structure From 995fa3f6023962894cdd50efb266585183129cb6 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 10 Apr 2014 20:08:21 -0400 Subject: [PATCH 50/51] Force flushing of print statements. --- tests/run_tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/run_tests.py b/tests/run_tests.py index 61c7702fb3..43f6e1abfd 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -5,6 +5,7 @@ from __future__ import print_function import os import shutil import re +import sys from subprocess import call from collections import OrderedDict from optparse import OptionParser @@ -216,6 +217,7 @@ for test in tests: print('-'*(len(test) + 6)) print(test + ' tests') print('-'*(len(test) + 6)) + sys.stdout.flush() # Verify fortran compiler exists tests[test].check_compiler() From 04878cdb72715028fa125f81a77da8e827461ef1 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 10 Apr 2014 23:21:44 -0400 Subject: [PATCH 51/51] Don't use escape sequences if being redirected. --- tests/run_tests.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/run_tests.py b/tests/run_tests.py index 43f6e1abfd..ce67f3ab7a 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -249,10 +249,16 @@ for test in tests: print('\n' + '='*54) print('Summary of Compilation Option Testing:\n') -OK = '\033[92m' -FAIL = '\033[91m' -ENDC = '\033[0m' -BOLD = '\033[1m' +if sys.stdout.isatty(): + OK = '\033[92m' + FAIL = '\033[91m' + ENDC = '\033[0m' + BOLD = '\033[1m' +else: + OK = '' + FAIL = '' + ENDC = '' + BOLD = '' for test in tests: print(test + '.'*(50 - len(test)), end='')