diff --git a/python/Makefile.am b/python/Makefile.am index 58b125832..5f126845c 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -8,22 +8,22 @@ if WITH_MPI MDPYTEST= MPBPYTEST= else - MDPYTEST=$(TEST_DIR)/material_dispersion.py + MDPYTEST=$(TEST_DIR)/test_material_dispersion.py if WITH_MPB - MPBPYTEST=$(TEST_DIR)/mpb.py + MPBPYTEST=$(TEST_DIR)/test_mpb.py else MPBPYTEST= endif # WITH_MPB endif # WITH_MPI if WITH_MPB - BINARY_GRATING_TEST = $(TEST_DIR)/binary_grating.py - DIFFRACTED_PLANEWAVE_TEST = $(TEST_DIR)/diffracted_planewave.py - DISPERSIVE_EIGENMODE_TEST = $(TEST_DIR)/dispersive_eigenmode.py - KDOM_TEST = $(TEST_DIR)/kdom.py - MODE_COEFFS_TEST = $(TEST_DIR)/mode_coeffs.py - MODE_DECOMPOSITION_TEST = $(TEST_DIR)/mode_decomposition.py - WVG_SRC_TEST = $(TEST_DIR)/wvg_src.py + BINARY_GRATING_TEST = $(TEST_DIR)/test_binary_grating.py + DIFFRACTED_PLANEWAVE_TEST = $(TEST_DIR)/test_diffracted_planewave.py + DISPERSIVE_EIGENMODE_TEST = $(TEST_DIR)/test_dispersive_eigenmode.py + KDOM_TEST = $(TEST_DIR)/test_kdom.py + MODE_COEFFS_TEST = $(TEST_DIR)/test_mode_coeffs.py + MODE_DECOMPOSITION_TEST = $(TEST_DIR)/test_mode_decomposition.py + WVG_SRC_TEST = $(TEST_DIR)/test_wvg_src.py else BINARY_GRATING_TEST = DIFFRACTED_PLANEWAVE_TEST = @@ -35,56 +35,56 @@ else endif TESTS = \ - $(TEST_DIR)/3rd_harm_1d.py \ - $(TEST_DIR)/absorber_1d.py \ - $(TEST_DIR)/adjoint_solver.py \ - $(TEST_DIR)/adjoint_jax.py \ - $(TEST_DIR)/antenna_radiation.py \ - $(TEST_DIR)/array_metadata.py \ - $(TEST_DIR)/bend_flux.py \ + $(TEST_DIR)/test_3rd_harm_1d.py \ + $(TEST_DIR)/test_absorber_1d.py \ + $(TEST_DIR)/test_adjoint_solver.py \ + $(TEST_DIR)/test_adjoint_jax.py \ + $(TEST_DIR)/test_antenna_radiation.py \ + $(TEST_DIR)/test_array_metadata.py \ + $(TEST_DIR)/test_bend_flux.py \ $(BINARY_GRATING_TEST) \ - $(TEST_DIR)/cavity_arrayslice.py \ - $(TEST_DIR)/cavity_farfield.py \ - $(TEST_DIR)/chunk_layout.py \ - $(TEST_DIR)/chunks.py \ - $(TEST_DIR)/cyl_ellipsoid.py \ - $(TEST_DIR)/dft_energy.py \ - $(TEST_DIR)/dft_fields.py \ + $(TEST_DIR)/test_cavity_arrayslice.py \ + $(TEST_DIR)/test_cavity_farfield.py \ + $(TEST_DIR)/test_chunk_layout.py \ + $(TEST_DIR)/test_chunks.py \ + $(TEST_DIR)/test_cyl_ellipsoid.py \ + $(TEST_DIR)/test_dft_energy.py \ + $(TEST_DIR)/test_dft_fields.py \ ${DIFFRACTED_PLANEWAVE_TEST} \ ${DISPERSIVE_EIGENMODE_TEST} \ - $(TEST_DIR)/divide_mpi_processes.py \ - $(TEST_DIR)/eigfreq.py \ - $(TEST_DIR)/faraday_rotation.py \ - $(TEST_DIR)/field_functions.py \ - $(TEST_DIR)/force.py \ - $(TEST_DIR)/fragment_stats.py \ - $(TEST_DIR)/gaussianbeam.py \ - $(TEST_DIR)/geom.py \ - $(TEST_DIR)/get_point.py \ - $(TEST_DIR)/holey_wvg_bands.py \ - $(TEST_DIR)/holey_wvg_cavity.py \ + $(TEST_DIR)/test_divide_mpi_processes.py \ + $(TEST_DIR)/test_eigfreq.py \ + $(TEST_DIR)/test_faraday_rotation.py \ + $(TEST_DIR)/test_field_functions.py \ + $(TEST_DIR)/test_force.py \ + $(TEST_DIR)/test_fragment_stats.py \ + $(TEST_DIR)/test_gaussianbeam.py \ + $(TEST_DIR)/test_geom.py \ + $(TEST_DIR)/test_get_point.py \ + $(TEST_DIR)/test_holey_wvg_bands.py \ + $(TEST_DIR)/test_holey_wvg_cavity.py \ $(KDOM_TEST) \ - $(TEST_DIR)/ldos.py \ + $(TEST_DIR)/test_ldos.py \ $(MDPYTEST) \ - $(TEST_DIR)/material_grid.py \ - $(TEST_DIR)/medium_evaluations.py \ + $(TEST_DIR)/test_material_grid.py \ + $(TEST_DIR)/test_medium_evaluations.py \ $(MPBPYTEST) \ $(MODE_COEFFS_TEST) \ $(MODE_DECOMPOSITION_TEST) \ - $(TEST_DIR)/multilevel_atom.py \ - $(TEST_DIR)/n2f_periodic.py \ - $(TEST_DIR)/oblique_source.py \ - $(TEST_DIR)/physical.py \ - $(TEST_DIR)/prism.py \ - $(TEST_DIR)/pw_source.py \ - $(TEST_DIR)/refl_angular.py \ - $(TEST_DIR)/ring.py \ - $(TEST_DIR)/ring_cyl.py \ - $(TEST_DIR)/simulation.py \ - $(TEST_DIR)/special_kz.py \ - $(TEST_DIR)/source.py \ - $(TEST_DIR)/user_defined_material.py \ - $(TEST_DIR)/visualization.py \ + $(TEST_DIR)/test_multilevel_atom.py \ + $(TEST_DIR)/test_n2f_periodic.py \ + $(TEST_DIR)/test_oblique_source.py \ + $(TEST_DIR)/test_physical.py \ + $(TEST_DIR)/test_prism.py \ + $(TEST_DIR)/test_pw_source.py \ + $(TEST_DIR)/test_refl_angular.py \ + $(TEST_DIR)/test_ring.py \ + $(TEST_DIR)/test_ring_cyl.py \ + $(TEST_DIR)/test_simulation.py \ + $(TEST_DIR)/test_special_kz.py \ + $(TEST_DIR)/test_source.py \ + $(TEST_DIR)/test_user_defined_material.py \ + $(TEST_DIR)/test_visualization.py \ $(WVG_SRC_TEST) if WITH_COVERAGE diff --git a/python/tests/3rd_harm_1d.py b/python/tests/test_3rd_harm_1d.py similarity index 100% rename from python/tests/3rd_harm_1d.py rename to python/tests/test_3rd_harm_1d.py diff --git a/python/tests/absorber_1d.py b/python/tests/test_absorber_1d.py similarity index 100% rename from python/tests/absorber_1d.py rename to python/tests/test_absorber_1d.py diff --git a/python/tests/adjoint_jax.py b/python/tests/test_adjoint_jax.py similarity index 100% rename from python/tests/adjoint_jax.py rename to python/tests/test_adjoint_jax.py diff --git a/python/tests/adjoint_solver.py b/python/tests/test_adjoint_solver.py similarity index 100% rename from python/tests/adjoint_solver.py rename to python/tests/test_adjoint_solver.py diff --git a/python/tests/antenna_radiation.py b/python/tests/test_antenna_radiation.py similarity index 100% rename from python/tests/antenna_radiation.py rename to python/tests/test_antenna_radiation.py diff --git a/python/tests/array_metadata.py b/python/tests/test_array_metadata.py similarity index 100% rename from python/tests/array_metadata.py rename to python/tests/test_array_metadata.py diff --git a/python/tests/bend_flux.py b/python/tests/test_bend_flux.py similarity index 100% rename from python/tests/bend_flux.py rename to python/tests/test_bend_flux.py diff --git a/python/tests/binary_grating.py b/python/tests/test_binary_grating.py similarity index 100% rename from python/tests/binary_grating.py rename to python/tests/test_binary_grating.py diff --git a/python/tests/cavity_arrayslice.py b/python/tests/test_cavity_arrayslice.py similarity index 100% rename from python/tests/cavity_arrayslice.py rename to python/tests/test_cavity_arrayslice.py diff --git a/python/tests/cavity_farfield.py b/python/tests/test_cavity_farfield.py similarity index 100% rename from python/tests/cavity_farfield.py rename to python/tests/test_cavity_farfield.py diff --git a/python/tests/chunk_layout.py b/python/tests/test_chunk_layout.py similarity index 100% rename from python/tests/chunk_layout.py rename to python/tests/test_chunk_layout.py diff --git a/python/tests/chunks.py b/python/tests/test_chunks.py similarity index 100% rename from python/tests/chunks.py rename to python/tests/test_chunks.py diff --git a/python/tests/cyl_ellipsoid.py b/python/tests/test_cyl_ellipsoid.py similarity index 100% rename from python/tests/cyl_ellipsoid.py rename to python/tests/test_cyl_ellipsoid.py diff --git a/python/tests/dft_energy.py b/python/tests/test_dft_energy.py similarity index 100% rename from python/tests/dft_energy.py rename to python/tests/test_dft_energy.py diff --git a/python/tests/dft_fields.py b/python/tests/test_dft_fields.py similarity index 100% rename from python/tests/dft_fields.py rename to python/tests/test_dft_fields.py diff --git a/python/tests/diffracted_planewave.py b/python/tests/test_diffracted_planewave.py similarity index 100% rename from python/tests/diffracted_planewave.py rename to python/tests/test_diffracted_planewave.py diff --git a/python/tests/dispersive_eigenmode.py b/python/tests/test_dispersive_eigenmode.py similarity index 97% rename from python/tests/dispersive_eigenmode.py rename to python/tests/test_dispersive_eigenmode.py index afe20b3f6..e12f318c7 100644 --- a/python/tests/dispersive_eigenmode.py +++ b/python/tests/test_dispersive_eigenmode.py @@ -67,7 +67,8 @@ def verify_output_and_slice(self,material,frequency): self.assertAlmostEqual(n,n_slice, places=4) # Check to make sure h5 output is working with frequency - filename = os.path.join(self.temp_dir, 'dispersive_eigenmode-eps-000000.00.h5') + filename = os.path.join(self.temp_dir, + sim.get_filename_prefix() + '-eps-000000.00.h5') mp.output_epsilon(sim,frequency=frequency) n_h5 = 0 mp.all_wait() diff --git a/python/tests/divide_mpi_processes.py b/python/tests/test_divide_mpi_processes.py similarity index 100% rename from python/tests/divide_mpi_processes.py rename to python/tests/test_divide_mpi_processes.py diff --git a/python/tests/eigfreq.py b/python/tests/test_eigfreq.py similarity index 100% rename from python/tests/eigfreq.py rename to python/tests/test_eigfreq.py diff --git a/python/tests/faraday_rotation.py b/python/tests/test_faraday_rotation.py similarity index 100% rename from python/tests/faraday_rotation.py rename to python/tests/test_faraday_rotation.py diff --git a/python/tests/field_functions.py b/python/tests/test_field_functions.py similarity index 100% rename from python/tests/field_functions.py rename to python/tests/test_field_functions.py diff --git a/python/tests/force.py b/python/tests/test_force.py similarity index 100% rename from python/tests/force.py rename to python/tests/test_force.py diff --git a/python/tests/fragment_stats.py b/python/tests/test_fragment_stats.py similarity index 100% rename from python/tests/fragment_stats.py rename to python/tests/test_fragment_stats.py diff --git a/python/tests/gaussianbeam.py b/python/tests/test_gaussianbeam.py similarity index 100% rename from python/tests/gaussianbeam.py rename to python/tests/test_gaussianbeam.py diff --git a/python/tests/geom.py b/python/tests/test_geom.py similarity index 100% rename from python/tests/geom.py rename to python/tests/test_geom.py diff --git a/python/tests/get_point.py b/python/tests/test_get_point.py similarity index 100% rename from python/tests/get_point.py rename to python/tests/test_get_point.py diff --git a/python/tests/holey_wvg_bands.py b/python/tests/test_holey_wvg_bands.py similarity index 100% rename from python/tests/holey_wvg_bands.py rename to python/tests/test_holey_wvg_bands.py diff --git a/python/tests/holey_wvg_cavity.py b/python/tests/test_holey_wvg_cavity.py similarity index 100% rename from python/tests/holey_wvg_cavity.py rename to python/tests/test_holey_wvg_cavity.py diff --git a/python/tests/kdom.py b/python/tests/test_kdom.py similarity index 100% rename from python/tests/kdom.py rename to python/tests/test_kdom.py diff --git a/python/tests/ldos.py b/python/tests/test_ldos.py similarity index 100% rename from python/tests/ldos.py rename to python/tests/test_ldos.py diff --git a/python/tests/material_dispersion.py b/python/tests/test_material_dispersion.py similarity index 100% rename from python/tests/material_dispersion.py rename to python/tests/test_material_dispersion.py diff --git a/python/tests/material_grid.py b/python/tests/test_material_grid.py similarity index 100% rename from python/tests/material_grid.py rename to python/tests/test_material_grid.py diff --git a/python/tests/medium_evaluations.py b/python/tests/test_medium_evaluations.py similarity index 100% rename from python/tests/medium_evaluations.py rename to python/tests/test_medium_evaluations.py diff --git a/python/tests/mode_coeffs.py b/python/tests/test_mode_coeffs.py similarity index 100% rename from python/tests/mode_coeffs.py rename to python/tests/test_mode_coeffs.py diff --git a/python/tests/mode_decomposition.py b/python/tests/test_mode_decomposition.py similarity index 100% rename from python/tests/mode_decomposition.py rename to python/tests/test_mode_decomposition.py diff --git a/python/tests/mpb.py b/python/tests/test_mpb.py similarity index 100% rename from python/tests/mpb.py rename to python/tests/test_mpb.py diff --git a/python/tests/multilevel_atom.py b/python/tests/test_multilevel_atom.py similarity index 100% rename from python/tests/multilevel_atom.py rename to python/tests/test_multilevel_atom.py diff --git a/python/tests/n2f_periodic.py b/python/tests/test_n2f_periodic.py similarity index 100% rename from python/tests/n2f_periodic.py rename to python/tests/test_n2f_periodic.py diff --git a/python/tests/oblique_source.py b/python/tests/test_oblique_source.py similarity index 100% rename from python/tests/oblique_source.py rename to python/tests/test_oblique_source.py diff --git a/python/tests/physical.py b/python/tests/test_physical.py similarity index 100% rename from python/tests/physical.py rename to python/tests/test_physical.py diff --git a/python/tests/prism.py b/python/tests/test_prism.py similarity index 100% rename from python/tests/prism.py rename to python/tests/test_prism.py diff --git a/python/tests/pw_source.py b/python/tests/test_pw_source.py similarity index 100% rename from python/tests/pw_source.py rename to python/tests/test_pw_source.py diff --git a/python/tests/refl_angular.py b/python/tests/test_refl_angular.py similarity index 100% rename from python/tests/refl_angular.py rename to python/tests/test_refl_angular.py diff --git a/python/tests/ring.py b/python/tests/test_ring.py similarity index 100% rename from python/tests/ring.py rename to python/tests/test_ring.py diff --git a/python/tests/ring_cyl.py b/python/tests/test_ring_cyl.py similarity index 100% rename from python/tests/ring_cyl.py rename to python/tests/test_ring_cyl.py diff --git a/python/tests/simulation.py b/python/tests/test_simulation.py similarity index 98% rename from python/tests/simulation.py rename to python/tests/test_simulation.py index b897f955b..5cf5e5201 100644 --- a/python/tests/simulation.py +++ b/python/tests/test_simulation.py @@ -1,4 +1,5 @@ import os +import re import sys import unittest import warnings @@ -14,7 +15,8 @@ class TestSimulation(unittest.TestCase): - fname = 'simulation-ez-000200.00.h5' + fname_base = re.sub(r'\.py$', '', os.path.split(sys.argv[0])[1]) + fname = fname_base + '-ez-000200.00.h5' def setUp(self): print("Running {}".format(self._testMethodName)) @@ -138,7 +140,8 @@ def test_at_time(self): sim.use_output_directory(self.temp_dir) sim.run(mp.at_time(100, mp.output_efield_z), until=200) - fname = os.path.join(self.temp_dir, 'simulation-ez-000100.00.h5') + fname = os.path.join(self.temp_dir, + sim.get_filename_prefix() + '-ez-000100.00.h5') self.assertTrue(os.path.exists(fname)) def test_after_sources_and_time(self): @@ -158,7 +161,8 @@ def test_with_prefix(self): sim.use_output_directory(self.temp_dir) sim.run(mp.with_prefix('test_prefix-', mp.at_end(mp.output_efield_z)), until=200) - fname = os.path.join(self.temp_dir, 'test_prefix-simulation-ez-000200.00.h5') + fname = os.path.join(self.temp_dir, 'test_prefix-' + sim.get_filename_prefix() + + '-ez-000200.00.h5') self.assertTrue(os.path.exists(fname)) def test_extra_materials(self): @@ -529,7 +533,7 @@ def test_epsilon_warning(self): def test_get_filename_prefix(self): sim = self.init_simple_simulation() - self.assertEqual(sim.get_filename_prefix(), "simulation") + self.assertEqual(sim.get_filename_prefix(), self.fname_base) sim.filename_prefix = '' self.assertEqual(sim.get_filename_prefix(), "") sim.filename_prefix = False diff --git a/python/tests/source.py b/python/tests/test_source.py similarity index 100% rename from python/tests/source.py rename to python/tests/test_source.py diff --git a/python/tests/special_kz.py b/python/tests/test_special_kz.py similarity index 100% rename from python/tests/special_kz.py rename to python/tests/test_special_kz.py diff --git a/python/tests/user_defined_material.py b/python/tests/test_user_defined_material.py similarity index 100% rename from python/tests/user_defined_material.py rename to python/tests/test_user_defined_material.py diff --git a/python/tests/visualization.py b/python/tests/test_visualization.py similarity index 100% rename from python/tests/visualization.py rename to python/tests/test_visualization.py diff --git a/python/tests/wvg_src.py b/python/tests/test_wvg_src.py similarity index 100% rename from python/tests/wvg_src.py rename to python/tests/test_wvg_src.py