Skip to content

Commit

Permalink
Remove doc mentions of nosetests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeyers314 committed Sep 17, 2024
1 parent 1d85ce5 commit c5289ff
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 29 deletions.
4 changes: 0 additions & 4 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ You can also run them with multiple jobs (e.g. for 4 jobs) by typing::

You need the ``pytest-xdist`` and ``pytest-timeout`` plugins for this to work.

If you prefer to use nosetests, the equivalent command is::

nosetests --processes=4 --process-timeout=60 test*.py

.. note::

If your system does not have ``pytest`` installed, and you do not want
Expand Down
24 changes: 11 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def supports_gpu(compiler, cc_type):
extra_cflags = copt[cc_type]
extra_lflags = lopt[cc_type]
return try_compile(cpp_code, compiler, extra_cflags, extra_lflags)

# Check for the fftw3 library in some likely places
def find_fftw_lib(output=False):
import distutils.sysconfig
Expand Down Expand Up @@ -434,29 +434,29 @@ def find_eigen_dir(output=False):
if output:
print("Downloaded %s. Unpacking tarball."%fname)
with tarfile.open(fname) as tar:

def is_within_directory(directory, target):

abs_directory = os.path.abspath(directory)
abs_target = os.path.abspath(target)

prefix = os.path.commonprefix([abs_directory, abs_target])

return prefix == abs_directory

def safe_extract(tar, path=".", members=None, *, numeric_owner=False):
# Avoid security vulnerability in tar.extractall function.
# This bit of code was added by the Advanced Research Center at Trellix in PR #1188.
# For more information about the security vulnerability, see
# https://github.com/advisories/GHSA-gw9q-c7gh-j9vm

for member in tar.getmembers():
member_path = os.path.join(path, member.name)
if not is_within_directory(path, member_path):
raise Exception("Attempted Path Traversal in Tar File")
tar.extractall(path, members, numeric_owner=numeric_owner)

tar.extractall(path, members, numeric_owner=numeric_owner)

safe_extract(tar, dir)
os.remove(fname)
# This actually extracts into a subdirectory with a name eigen-eigen-5a0156e40feb/
Expand Down Expand Up @@ -1345,9 +1345,7 @@ def run_tests(self):

build_dep = ['setuptools>=38,<72', 'pybind11>=2.2', 'numpy>=1.17']
run_dep = ['astropy', 'LSSTDESC.Coord']
test_dep = ['pytest', 'pytest-xdist', 'pytest-timeout', 'nose', 'scipy', 'pyyaml']
# Note: Even though we don't use nosetests, nose is required for some tests to work.
# cf. https://gist.github.com/dannygoldstein/e18866ebb9c39a2739f7b9f16440e2f5
test_dep = ['pytest', 'pytest-xdist', 'pytest-timeout', 'scipy', 'pyyaml']

# If Eigen doesn't exist in the normal places, download it.
find_eigen_dir(output=True)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_config_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,7 @@ def test_index_key(run_slow):
images1 = [ galsim.fits.readMulti('output/index_key%02d.fits'%n) for n in range(nfiles) ]

if run_slow:
# For nose tests skip these 3 to save some time.
# For pytest tests, skip these 3 to save some time.
# images5 is really the hardest test, and images1 is the easiest, so those two will
# give good diagnostics for any errors.

Expand Down Expand Up @@ -2839,7 +2839,7 @@ def test_chromatic(run_slow):
if run_slow:
bp_file = 'LSST_r.dat'
else:
# In nosetests, use a simple bandpass to go faster.
# In pytest, use a simple bandpass to go faster.
bp_file = 'chromatic_reference_images/simple_bandpass.dat'

# First check a chromatic galaxy with a regular PSF.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_args():
assert args.nolink is True

# Some invalid parameters
# To avoid ugly text output during nosetests runs, redirect stderr to stdout for a moment.
# To avoid ugly text output during pytest runs, redirect stderr to stdout for a moment.
sys_stderr = sys.stderr
sys.stderr = sys.stdout
with assert_raises(SystemExit):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_args():
galsim.main.parse_args([config_file, '-j', '3'])

# The ones handled by ArgumentParser raise SystemExit and print to stderr
# To avoid ugly text output during nosetests runs, redirect stderr to stdout for a moment.
# To avoid ugly text output during pytest runs, redirect stderr to stdout for a moment.
sys_stderr = sys.stderr
sys.stderr = sys.stdout
with assert_raises(SystemExit):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_roman.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def test_roman_psfs(run_slow):
# - fully chromatic PSFs with interpolation, but only interpolating between two wavelengths.
# - achromatic PSFs.
#
# We also only test pupil_bin=4,8 in nosetests runs. Tests of pupil_bin=1,2 are done in
# We also only test pupil_bin=4,8 in pytest runs. Tests of pupil_bin=1,2 are done in
# __main__ runs.

# Providing a wavelength returns achromatic PSFs
Expand Down Expand Up @@ -748,7 +748,7 @@ def test_roman_psfs(run_slow):
{ 'pupil_bin':8 },
]
if run_slow:
# A few more that are too slow to run in regular nosetests
# A few more that are too slow to run in regular pytest
kwargs_list.extend([
{ 'pupil_bin':1 },
{ 'pupil_bin':2 },
Expand Down
2 changes: 1 addition & 1 deletion tests/test_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def do_wcs_image(wcs, name, run_slow, approx=False):
# used to be a problem if the wcs returned ra values that jump from 360 to 0.
# Not very stringent test, since we're just checking that we don't have some pixels
# that are orders of magnitude different from the average. So rtol=2 is good.
# (1 is fine for the nosetests runs, but one of the edge cases fails in main runs. It's not
# (1 is fine for the pytest runs, but one of the edge cases fails in main runs. It's not
# a problem I think, just one of the weird wcs types has a more variable pixel area.)
np.testing.assert_allclose(im.array, area*sky_level, rtol=2)

Expand Down
5 changes: 0 additions & 5 deletions tests/time_all_tests

This file was deleted.

0 comments on commit c5289ff

Please sign in to comment.