Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .appveyor_update_version.ps1

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
Expand All @@ -26,8 +26,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install cython numpy scipy
pip install -e .

- name: Run tests
run: python -m unittest discover bandmat
run: python -W error::DeprecationWarning -m unittest discover bandmat
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include License
include README.rst
include requirements.txt
include bandmat/*.c
include bandmat/*.pyx
include example.py
include example_spg.py
29 changes: 29 additions & 0 deletions bandmat/test_examples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Tests that the example scripts run successfully."""

# Copyright 2013, 2014, 2015, 2016, 2017, 2018 Matt Shannon

# This file is part of bandmat.
# See `License` for details of license and warranty.

import unittest
import subprocess
import sys
import os

example_dir = os.path.join(os.path.dirname(__file__), '..')

class TestExamples(unittest.TestCase):
def test_example(self):
"""Checks example.py runs without error (has its own assertions)."""
subprocess.check_call(
[sys.executable, os.path.join(example_dir, 'example.py')]
)

def test_example_spg(self):
"""Checks example_spg.py runs without error."""
subprocess.check_call(
[sys.executable, os.path.join(example_dir, 'example_spg.py')]
)

if __name__ == '__main__':
unittest.main()
19 changes: 9 additions & 10 deletions bandmat/test_testhelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,17 @@ def test_get_array_mem(self, its=50):

x = gen_array(ranks=[1, 2, 3])
array_mem = th.get_array_mem(x)
shape = x.shape
strides = x.strides
shape_orig = x.shape
strides_orig = x.strides
shape_new = x.T.shape
strides_new = x.T.strides
if np.prod(shape_new) != 0:
x.shape = shape_new
x.strides = strides_new
if shape_new != shape or strides_new != strides:
# FIXME : re-enable once I understand better when this may
# fail (i.e. when memory may be unexpectedly shared).
#assert th.get_array_mem(x) != array_mem
pass
if (np.prod(shape_new) != 0 and
(shape_new != shape_orig or
strides_new != strides_orig)):
x = np.lib.stride_tricks.as_strided(
x, shape=shape_new, strides=strides_new
)
assert th.get_array_mem(x) != array_mem

if __name__ == '__main__':
unittest.main()
8 changes: 7 additions & 1 deletion bandmat/testhelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,10 @@ def get_array_mem(*arrays):
>>> x *= 2.0
>>> assert get_array_mem(x) == array_mem
"""
return [ array.__array_interface__ for array in arrays ]
mems = []
for array in arrays:
d = dict(array.__array_interface__)
if d['strides'] is None:
d['strides'] = array.strides
mems.append(d)
return mems
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
author_email='matt.shannon@cantab.net',
license='3-clause BSD (see License file)',
packages=['bandmat'],
python_requires='>=3.9',
install_requires=requires,
long_description=long_description,
ext_modules=ext_modules,
Expand Down
Loading