Fix tests for python 3.5.

This commit is contained in:
Jerry James 2015-11-20 16:33:25 -07:00
parent 0e10ede896
commit ed4d3a454d
1 changed files with 22 additions and 4 deletions

View File

@ -89,17 +89,38 @@ HTML documentation for sympy.
rm -rf sympy/mpmath doc/src/modules/mpmath
rm -rf %{name}-%{version}/sympy/mpmath %{name}-%{version}/doc/src/module/mpmath
fixtimestamp() {
touch -r $1.orig $1
rm -f $1.org
}
# One plotting test expects one warning, but the same warning is triggered in
# a different spot with recent versions of python, leading to an assertion
# failure.
sed -e '/import warnings/ifrom sympy.utilities.pytest import XFAIL' \
-e '/^def test_matplotlib():/i@XFAIL' \
-i sympy/plotting/tests/test_plot_implicit.py
-i.orig sympy/plotting/tests/test_plot_implicit.py
fixtimestamp sympy/plotting/tests/test_plot_implicit.py
# Make a copy for building the python3 version
rm -rf %{py3dir}
cp -a . %{py3dir}
# Handle a new way eval() can fail in python 3.5
sed -e 's/SyntaxError/&, TypeError/' \
-e 's/unbound method/contains() missing 1 required positional argument/' \
-i.orig %{py3dir}/sympy/core/sympify.py
TypeError: contains() missing 1 required positional argument: 'expr'
fixtimestamp %{py3dir}/sympy/core/sympify.py
# Handle two changes in an error message in python 3.5
sed -e 's/ in test\.globs/, test.globs)/' \
-e 's/RuntimeError/RecursionError/' \
-i.orig %{py3dir}/doc/src/gotchas.rst
fixtimestamp %{py3dir}/doc/src/gotchas.rst
%build
# Build the python2 version
python2 setup.py build
@ -157,9 +178,6 @@ rm -fr %{buildroot}%{_docdir}/%{name}-doc/i18n
cp -p %{py3dir}/doc/_build/cheatsheet/combinatoric_cheatsheet.pdf .
%check
# The python3 tests fail with Unicode errors without this
export LC_ALL=en_US.UTF-8
let "dnum = $RANDOM % 90 + 10"
xvfb-run -n $dnum python2 setup.py test
pushd %{py3dir}