提交 2711f775 authored 作者: Frédéric Bastien's avatar Frédéric Bastien 提交者: GitHub

Merge pull request #4991 from nouiz/test_gc_never_pickles_temporaries

Better error message to help debug travis problem
......@@ -31,12 +31,12 @@ addons:
install:
# In Python 3.3, we test the min version of NumPy and SciPy. In Python 2.7, we test more recent version.
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then conda create --yes -q -n pyenv mkl python=2.7 numpy=1.11.1 scipy=0.18 nose=1.3.0 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx mkl-service; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then conda create --yes -q -n pyenv mkl python=2.7 numpy=1.9.1 scipy=0.14.0 nose=1.3.0 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx mkl-service libgfortran=1; fi
- if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then conda create --yes -q -n pyenv mkl python=3.3 numpy=1.9.1 scipy=0.14.0 nose=1.3.4 pip flake8=2.3 six=1.9.0 pep8=1.6.2 pyflakes=0.8.1 sphinx mkl-service; fi
- source activate pyenv
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install pydot; else pip install pydot-ng; fi
- pip install . --no-deps
- pip install flake8-future-import nose-parameterized==0.5.0
- pip install flake8-future-import nose-parameterized==0.5.0 sphinx_rtd_theme
# command to run tests
env:
......
......@@ -49,8 +49,10 @@ def test_gc_never_pickles_temporaries():
g = theano.function([x], r, mode=theano.Mode(optimizer=optimizer,
linker=g_linker))
len_pre_f = len(pickle.dumps(f))
len_pre_g = len(pickle.dumps(g))
pre_f = pickle.dumps(f)
pre_g = pickle.dumps(g)
len_pre_f = len(pre_f)
len_pre_g = len(pre_g)
# We can't compare the content or the length of the string
# between f and g. 2 reason, we store some timming information
......@@ -87,7 +89,17 @@ def test_gc_never_pickles_temporaries():
# assert that f() didn't cause the function to grow
# allow_gc should leave the function un-changed by calling
assert len_pre_f == len_post_f
if len_pre_f != len_post_f:
for i in range(len_pre_f//100):
p1 = pre_f[i*100:(i+1)*100]
p2 = post_f[i*100:(i+1)*100]
if p1 != p2:
print(i)
print("p1")
print(p1)
print("p2")
print(p2)
assert len_pre_f == len_post_f, (len_pre_f, len_post_f)
# assert that g() didn't cause g to grow because temporaries
# that weren't collected shouldn't be pickled anyway
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论