Skip to content

Commit

Permalink
Fix tests for numpy 1.24 (#15)
Browse files Browse the repository at this point in the history
* Remove np.int and np.float from notebooks

* Remove version pins from CI tests, switch main build to 3.10

* Increase nbmake timeout

Spin-dependent notebook seems to take a while longer than the others
  • Loading branch information
JelleAalbers authored Feb 13, 2023
1 parent e3c42bb commit e44cf9d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pypi_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.10'
- name: Checkout repo
uses: actions/checkout@v3
- name: Install dependencies
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
# Only do coveralls once; pytest on all python versions
python-version: [3.8, 3.9, "3.10"]
exclude:
- python-version: 3.9
- python-version: 3.8
test: coveralls
- python-version: "3.10"
- python-version: 3.9
test: coveralls
steps:
- name: Setup python
Expand All @@ -36,24 +36,23 @@ jobs:
run: |
# Requirements for running the notebooks as a pytest
pip install cython ipython
pip install "numpy<1.23"
pip install nbconvert==6.4.3 nbmake pytest-xdist pytest coverage coveralls pytest-cov pytest-notebook ipython_genutils
pip install nbconvert nbmake pytest-xdist pytest coverage coveralls pytest-cov pytest-notebook ipython_genutils
# Several optional packages that are imported in the notebooks
pip install git+https://github.com/XENON1T/laidbax
python setup.py develop
- name: Test package
if: matrix.test == 'pytest'
run:
|
pytest --cov wimprates -v --nbmake notebooks/*.ipynb --durations 0 --nb-coverage
pytest --cov wimprates -v --nbmake notebooks/*.ipynb --nbmake-timeout=600 --durations 0 --nb-coverage
coverage run --append --source=wimprates -m pytest -v
- name: Coveralls
env:
NUMBA_DISABLE_JIT: 1
if: matrix.test == 'coveralls'
run:
|
pytest --cov wimprates -v --nbmake notebooks/*.ipynb --durations 0 --nb-coverage
pytest --cov wimprates -v --nbmake notebooks/*.ipynb --nbmake-timeout=600 --durations 0 --nb-coverage
coverage run --append --source=wimprates -m pytest -v
- name: Coveralls
env:
Expand Down
4 changes: 2 additions & 2 deletions notebooks/Checks, plots.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@
"\n",
"centers = (es[1:] + es[:-1])/2\n",
"widths = np.diff(es)\n",
"means = np.zeros(len(ms), dtype=np.float)\n",
"means_bs = np.zeros(len(ms), dtype=np.float)\n",
"means = np.zeros(len(ms), dtype=float)\n",
"means_bs = np.zeros(len(ms), dtype=float)\n",
"\n",
"for i, mw in enumerate(tqdm(ms)):\n",
" if wimps is not None:\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/DM-electron scattering.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
" if W is None:\n",
" W = 13.8 * nu.eV\n",
" \n",
" n_el = np.arange(max_n_el + 1, dtype=np.int)\n",
" n_el = np.arange(max_n_el + 1, dtype=int)\n",
" result = dict() \n",
" \n",
" # We need an \"energy bin size\" to multiply with (or do some fancy integration)\n",
Expand Down

0 comments on commit e44cf9d

Please sign in to comment.