e6305e0
# Run test suites upstream runs by default. Tests disabled here are
e6305e0
# optional and not run when running `test.py` without any arguments.
e6305e0
# Tests are listed in the order they appear in `test.py`.
e6305e0
# unit tests for pynwb package
e6305e0
%bcond test_pynwb             1
e6305e0
# integration tests
e6305e0
%bcond test_integration       1
ab213b2
# example tests
e6305e0
# Some tests require network, others additional unavailable modules
e6305e0
%bcond test_example           0
ab213b2
# example tests with ros3 streaming
ab213b2
# Internet access required (automatically disabled without it)
8c2bd14
%bcond test_example_ros3      0
e6305e0
# backwards compatibility tests
e6305e0
%bcond test_backwards         1
e6305e0
# example tests and validation tests on example NWB files
e6305e0
%bcond test_validate_examples 0
ab213b2
# ros3 streaming tests
ab213b2
# Internet access required (automatically disabled without it)
8c2bd14
%bcond test_ros3              0
8c2bd14
# tests on pynwb.validate
e6305e0
# some tests fail for unknown reasons (more since 2.7.0)
e6305e0
%bcond test_validation_module 0
2ffa7c8
a180140
Name:           python-pynwb
e6305e0
Version:        2.7.0
af8e40c
Release:        %autorelease
ab213b2
Summary:        Package for working with Neurodata stored in the NWB format
ab213b2
ab213b2
# The entire source is BSD-3-Clause-LBNL, except:
ab213b2
#
ab213b2
# Unlicense:
ab213b2
#   - versioneer.py, a bundled and amalgamated copy of python3dist(versioneer),
ab213b2
#     is not distributed in the binary RPMs, but the _version.py it generates
ab213b2
#     is, and shares the same license
ab213b2
License:        BSD-3-Clause-LBNL AND Unlicense
2ffa7c8
URL:            https://github.com/NeurodataWithoutBorders/pynwb
98988e6
# Use the pypi tar because GitHub tar does not include the required git-submodules
ab213b2
Source:         %{pypi_source pynwb}
e6305e0
# Exclude artifacts from wheel (and sdist)
e6305e0
# https://github.com/NeurodataWithoutBorders/pynwb/pull/1902
e6305e0
Patch:          %{url}/pull/1902.patch
0bd1931
2ffa7c8
BuildArch:      noarch
2ffa7c8
ab213b2
%global desc %{expand:
ab213b2
PyNWB is a Python package for working with NWB files. It provides a high-level
ab213b2
API for efficiently working with Neurodata stored in the NWB format.
ab213b2
https://pynwb.readthedocs.io/en/latest/}
ab213b2
b7ea504
%description %{desc}
2ffa7c8
a180140
%package -n python3-pynwb
2ffa7c8
Summary:        %{summary}
2ffa7c8
2ffa7c8
BuildRequires:  python3-devel
a180140
BuildRequires:  python3-pytest
e6305e0
# Required for tests, not listed in requirements*.txt
e6305e0
BuildRequires:  python3-matplotlib
2ffa7c8
a180140
%description -n python3-pynwb %{desc}
2ffa7c8
2ffa7c8
%prep
0bd1931
%autosetup -n pynwb-%{version} -p1
2ffa7c8
ab213b2
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
ab213b2
sed -r -i 's@"coverage", "run", "-p"@"%{python3}"@' \
ab213b2
    tests/validation/test_validate.py
ab213b2
ab213b2
sed -r -i 's/==.*//' requirements.txt | tee requirements-unpinned.txt
ab213b2
#sed -i -e "s/h5py>.*'/h5py'/" -e "s/numpy>.*'/numpy'/" -e "s/pandas>.*'/pandas'/" setup.py
ab213b2
ab213b2
# TODO: Why does this happen? It seems like it is an issue with our test
ab213b2
# environment rather than a real bug.
ab213b2
#
ab213b2
# AssertionError: "<frozen runpy>:128:
ab213b2
#     RuntimeWarning: 'pyn[151 chars]ur\n" != ''
ab213b2
# - <frozen runpy>:128: RuntimeWarning: 'pynwb.validate' found in sys.modules
ab213b2
#     after import of package 'pynwb', but prior to execution of
ab213b2
#     'pynwb.validate'; this may result in unpredictable behaviour
ab213b2
sed -r -i '1{s/^/from unittest import skip\n/}' \
ab213b2
    tests/validation/test_validate.py
ab213b2
for n in \
ab213b2
    test_validate_file_cached \
ab213b2
    test_validate_file_cached_extension \
ab213b2
    test_validate_file_cached_extension_pass_ns \
ab213b2
    test_validate_file_cached_ignore \
ab213b2
    test_validate_file_list_namespaces_core \
ab213b2
    test_validate_file_list_namespaces_extension
0b182e4
do
ab213b2
  sed -r -i \
ab213b2
      "s/^([[:blank:]]*)(def $n\()/\1@skip('Re-import issues')\n\1\2/" \
ab213b2
      tests/validation/test_validate.py
0b182e4
done
0b182e4
0b182e4
%generate_buildrequires
ab213b2
%pyproject_buildrequires requirements-unpinned.txt
0b182e4
2ffa7c8
%build
0b182e4
%pyproject_wheel
2ffa7c8
2ffa7c8
%install
0b182e4
%pyproject_install
0b182e4
%pyproject_save_files pynwb
5448637
2ffa7c8
%check
e6305e0
# Generate test files
e6305e0
%{py3_test_envvars} %{python3} src/pynwb/testing/make_test_files.py
ab213b2
# See skips added in %%prep.
e6305e0
%{py3_test_envvars} %{python3} test.py \
ab213b2
%if %{with test_backwards}
ab213b2
    --backwards \
ab213b2
%endif
ab213b2
%if %{with test_example}
ab213b2
    --example \
ab213b2
%endif
ab213b2
%if %{with test_example_ros3}
ab213b2
    --example-ros3 \
ab213b2
%endif
ab213b2
%if %{with test_integration}
ab213b2
    --integration \
ab213b2
%endif
ab213b2
%if %{with test_pynwb}
ab213b2
    --pynwb \
ab213b2
%endif
ab213b2
%if %{with test_ros3}
ab213b2
    --ros3 \
ab213b2
%endif
8c2bd14
%if %{with test_validate_examples}
8c2bd14
    --validate-examples \
8c2bd14
%endif
8c2bd14
%if %{with test_validation_module}
8c2bd14
    --validation-module \
3469dd4
%endif
ab213b2
    --verbose
2ffa7c8
a180140
%files -n python3-pynwb -f %{pyproject_files}
2ffa7c8
%license license.txt
2ffa7c8
%doc README.rst
2ffa7c8
2ffa7c8
%changelog
af8e40c
%autochangelog