Skip to content

Commit

Permalink
Merge pull request #69 from weaverba137/endian-test
Browse files Browse the repository at this point in the history
Fix failing test on bigendian devices
  • Loading branch information
weaverba137 committed Apr 19, 2023
2 parents ed583ec + 0640800 commit b32e9e4
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_cron_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
# Testing links in documents is a good example of something to run on a schedule
# to catch links that stop working for some reason.
doc_test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python to build docs with sphinx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
python: 3.8
toxenv: py38-test-alldeps-cov

- name: OS X - Python 3.8 with all optional dependencies
- name: macOS - Python 3.8 with all optional dependencies
os: macos-latest
python: 3.8
toxenv: py38-test-alldeps
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ docs/_build
.flooignore

# Visual Studio Code project files
.env
.vscode

# Packages/installer info
Expand Down
29 changes: 20 additions & 9 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
# See https://docs.readthedocs.io/en/latest/yaml-config.html
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

build:
image: latest
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally declare the Python requirements required to build your docs
python:
version: 3.7
install:
- method: pip
path: .
extra_requirements:
- docs
- all
install:
- method: pip
path: .
extra_requirements:
- docs
- all

# If using Sphinx, optionally build your docs in additional formats such as PDF
formats: []
2 changes: 1 addition & 1 deletion pydl/pydlspec2d/spec2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def filter_thru(flux, waveimg=None, wset=None, mask=None,
pixnorm, logdiff = traceset2xy(diffset)
logdiff = np.absolute(logdiff)
if mask is not None:
flux_interp = djs_maskinterp(flux, mask, iaxis=0)
flux_interp = djs_maskinterp(flux, mask, axis=0)
res = np.zeros((nTrace, len(ffiles)), dtype=flux.dtype)
for i, f in enumerate(ffiles):
filter_data = ascii.read(f, comment='#.*', names=('lam', 'respt',
Expand Down
5 changes: 1 addition & 4 deletions pydl/pydlutils/tests/test_mangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ class TestMangle(object):
"""Test the functions in pydl.pydlutils.mangle.
"""

def setup(self):
def setup_method(self):
self.poly_fits = get_pkg_data_filename('t/polygon.fits')
self.no_id_fits = get_pkg_data_filename('t/polygon_no_id.fits')
self.one_cap_fits = get_pkg_data_filename('t/polygon_one_cap.fits')
self.poly_ply = get_pkg_data_filename('t/polygon.ply')
self.bad_ply = get_pkg_data_filename('t/median_data.txt')

def teardown(self):
pass

def test_ManglePolygon(self):
#
# Zero caps
Expand Down
5 changes: 1 addition & 4 deletions pydl/pydlutils/tests/test_sdss.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TestSDSS(object):
"""Test the functions in pydl.pydlutils.sdss.
"""

def setup(self):
def setup_method(self):
pydl.pydlutils.sdss.maskbits = set_maskbits(
maskbits_file=get_pkg_data_filename('t/testMaskbits.par'))
self.opbadfields = np.array([
Expand All @@ -28,9 +28,6 @@ def setup(self):
pydl.pydlutils.sdss.opbadfields = self.opbadfields
return

def teardown(self):
pass

def test_default_skyversion(self):
assert default_skyversion() == 2

Expand Down
4 changes: 2 additions & 2 deletions pydl/pydlutils/tests/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ class TestTrace(object):
"""Test the functions in pydl.pydlutils.trace.
"""

def setup(self):
def setup_method(self):
# extracted from spFrame-b1-00057618.fits

self.sdss = fits.open(get_pkg_data_filename('t/sdss_traceset.fits'))
# extracted from spFrame-r1-00180406.fits
self.boss = fits.open(get_pkg_data_filename('t/boss_traceset.fits'))
return

def teardown(self):
def teardown_method(self):
self.sdss.close()
self.boss.close()
return
Expand Down
12 changes: 9 additions & 3 deletions pydl/pydlutils/tests/test_yanny.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# -*- coding: utf-8 -*-
import warnings
import json
import stat
import sys
from os import chmod, remove
from os.path import exists, join
from shutil import copy, rmtree
Expand Down Expand Up @@ -29,7 +31,7 @@ class YannyTestCase(object):
"""
save_temp = False

def setup(self):
def setup_method(self):
self.temp_dir = mkdtemp(prefix='yanny-test-')
# Ignore deprecation warnings--this only affects Python 2.5 and 2.6,
# since deprecation warnings are ignored by defualt on 2.7
Expand All @@ -39,7 +41,7 @@ def setup(self):
with open(get_pkg_data_filename("t/yanny_data.json")) as js:
self.test_data = json.load(js)

def teardown(self):
def teardown_method(self):
warnings.resetwarnings()
if not self.save_temp:
if hasattr(self, 'temp_dir') and exists(self.temp_dir):
Expand Down Expand Up @@ -82,7 +84,11 @@ def json2dtype(self, data):
stuff.append(tuple([str(k[0]), str(k[1]), tuple(k[2])]))
else:
stuff.append(tuple([str(k[0]), str(k[1])]))
return np.dtype(stuff)
d = np.dtype(stuff)
if sys.byteorder == 'little':
return d
else:
return d.newbyteorder()


class TestYanny(YannyTestCase):
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ all =
test =
pytest-astropy
pytest-mock
astropy20 =
pytest-mock<2
docs =
sphinx-astropy

Expand Down
29 changes: 7 additions & 22 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,23 @@ envlist =
py{36,37,38}-test{,-alldeps,-devdeps}{,-cov}
py{36,37,38}-test-numpy{116,117,118}
py{36,37,38}-test-astropy{30,40,lts}
astropy20
build_docs
linkcheck
codestyle
requires =
setuptools >= 30.3.0
pip >= 19.3.1
setuptools_scm
tox-pypi-filter >= 0.12
isolated_build = true
indexserver =
NIGHTLY = https://pypi.anaconda.org/scipy-wheels-nightly/simple

[testenv]

# The following option combined with the use of the tox-pypi-filter above allows
# project-wide pinning of dependencies, e.g. if new versions of pytest do not
# work correctly with pytest-astropy plugins. Most of the time the pinnings file
# should be empty.
pypi_filter = https://raw.githubusercontent.com/astropy/ci-helpers/master/pip_pinnings.txt
# Suppress display of matplotlib plots generated during docs build
setenv = MPLBACKEND=agg

# Pass through the following environment variables which may be needed for the CI
passenv = HOME WINDIR LC_ALL LC_CTYPE CC CI GITHUB_* COVERALLS_*
passenv = HOME,WINDIR,LC_ALL,LC_CTYPE,CC,CI,GITHUB_*,COVERALLS_*

# Run the tests in a temporary directory to make sure that we don't import
# this package from the source tree
Expand Down Expand Up @@ -52,6 +48,7 @@ description =

# The following provides some specific pinnings for key packages
deps =

cov: coveralls

numpy116: numpy==1.16.*
Expand All @@ -62,7 +59,7 @@ deps =
astropy40: astropy==4.0.*
astropylts: astropy==4.0.*

devdeps: git+https://github.com/numpy/numpy.git#egg=numpy
devdeps: :NIGHTLY:numpy
devdeps: git+https://github.com/astropy/astropy.git#egg=astropy

# The following indicates which extras_require from setup.cfg will be installed
Expand All @@ -76,18 +73,6 @@ commands =
cov: pytest --pyargs pydl {toxinidir}/docs --cov pydl --cov-config={toxinidir}/setup.cfg {posargs}
cov: coveralls

[testenv:astropy20]
description = run tests with astropy2.0.*
extras = astropy20
deps =
astropy==2.0.*
numpy==1.14.*
pytest<3.7
pytest-mock<2
commands =
pip freeze
pytest -p astropy.tests.pytest_repeat -p astropy.extern.plugins.pytest_doctestplus.plugin -p astropy.extern.plugins.pytest_openfiles.plugin -p astropy.extern.plugins.pytest_remotedata.plugin --traceconfig --pyargs pydl {toxinidir}/docs {posargs}

[testenv:build_docs]
changedir = docs
description = invoke sphinx-build to build the HTML docs
Expand Down

0 comments on commit b32e9e4

Please sign in to comment.