diff --git a/tests/test_interpolatedimage.py b/tests/test_interpolatedimage.py index dd72937efa..b5e1a9704e 100644 --- a/tests/test_interpolatedimage.py +++ b/tests/test_interpolatedimage.py @@ -32,6 +32,9 @@ KXVALS = np.array((1.30, 0.71, -4.30)) * np.pi / 2. KYVALS = np.array((0.80, -0.02, -0.31,)) * np.pi / 2. +# The timing tests can be unreliable in environments with other processes running at the +# same time. So we disable them by default. However, on a clean system, they should all pass. +test_timing = False @pytest.fixture def ref(): @@ -1785,21 +1788,21 @@ def test_depixelize(): # Second time with the same size image is much faster, since uses a cache. nopix_image2 = im1.depixelize(x_interpolant=interp) t8 = time.time() - if platform.python_implementation() != 'PyPy': + if test_timing and platform.python_implementation() != 'PyPy': # PyPy timings can be fairly arbitrary at times. assert t8-t7 < (t3-t2)/5 # Even if the image is different. nopix_image3 = im4.depixelize(x_interpolant=interp) t9 = time.time() - if platform.python_implementation() != 'PyPy': + if test_timing and platform.python_implementation() != 'PyPy': assert t9-t8 < (t3-t2)/5 # But not if you clear the cache. galsim.Image.clear_depixelize_cache() nopix_image4 = im4.depixelize(x_interpolant=interp) t10 = time.time() - if platform.python_implementation() != 'PyPy': + if test_timing and platform.python_implementation() != 'PyPy': assert t10-t9 > (t3-t2)/5 print('times:') diff --git a/tests/test_phase_psf.py b/tests/test_phase_psf.py index 6d71bb34f4..78bac176ca 100644 --- a/tests/test_phase_psf.py +++ b/tests/test_phase_psf.py @@ -29,6 +29,10 @@ theta0 = (0*galsim.arcmin, 0*galsim.arcmin) +# The timing tests can be unreliable in environments with other processes running at the +# same time. So we disable them by default. However, on a clean system, they should all pass. +test_timing = False + @timer def test_aperture(): @@ -1018,7 +1022,8 @@ def test_speedup(): psf.drawImage(method='phot', n_photons=1e3) t1 = time.time() print("Time for geometric approximation draw: {:6.4f}s".format(t1-t0)) - assert (t1-t0) < 0.1, "Photon-shooting took too long ({0} s).".format(t1-t0) + if test_timing: + assert (t1-t0) < 0.1, "Photon-shooting took too long ({0} s).".format(t1-t0) @timer diff --git a/tests/test_sensor.py b/tests/test_sensor.py index d8468fc65f..c0d63ccce2 100644 --- a/tests/test_sensor.py +++ b/tests/test_sensor.py @@ -25,6 +25,10 @@ import galsim from galsim_test_helpers import * +# The timing tests can be unreliable in environments with other processes running at the +# same time. So we disable them by default. However, on a clean system, they should all pass. +test_timing = False + @timer def test_simple(): @@ -1010,7 +1014,8 @@ def test_resume(run_slow): decimal=5) print('Time with resume = ',t_resume) print('Time without resume = ',t_no_resume) - assert t_resume < t_no_resume + if test_timing: + assert t_resume < t_no_resume # The resume path should be exactly the same as doing all the photons at once. sensor3.accumulate(all_photons, im3) diff --git a/tests/test_wcs.py b/tests/test_wcs.py index 2c29e06d5d..ad894c638d 100644 --- a/tests/test_wcs.py +++ b/tests/test_wcs.py @@ -27,6 +27,10 @@ import galsim from galsim_test_helpers import * +# The timing tests can be unreliable in environments with other processes running at the +# same time. So we disable them by default. However, on a clean system, they should all pass. +test_timing = False + # These positions will be used a few times below, so define them here. # One of the tests requires that the last pair are integers, so don't change that. @@ -3199,10 +3203,10 @@ def test_int_args(run_slow): # Before fixing #1024, this took about 0.5 sec. # Now it usually takes about 0.04 sec. Testing at 0.25 seems like a reasonable midpoint. print('Time = ',t1-t0) - if run_slow: + if test_timing: # Don't include this in regular unit tests, since it's not really something we need # to guarantee. This timing estimate is appropriate for my laptop, but maybe not - # all systems. It also fails for pypy on GHA for some reason. + # all systems. assert t1-t0 < 0.25 posi = galsim.PositionI(5,6)