[arch-commits] Commit in python-nbval/trunk (2 files)
Chih-Hsuan Yen
yan12125 at gemini.archlinux.org
Sat Aug 21 05:55:23 UTC 2021
Date: Saturday, August 21, 2021 @ 05:55:23
Author: yan12125
Revision: 1004091
python-nbval: make tests pass with ipykernel >= 6.0.0
Added:
python-nbval/trunk/0001-Make-tests-pass-with-ipykernel-6.0.0.patch
Modified:
python-nbval/trunk/PKGBUILD
-------------------------------------------------+
0001-Make-tests-pass-with-ipykernel-6.0.0.patch | 34 ++++++++++++++++++++++
PKGBUILD | 21 +++++--------
2 files changed, 43 insertions(+), 12 deletions(-)
Added: 0001-Make-tests-pass-with-ipykernel-6.0.0.patch
===================================================================
--- 0001-Make-tests-pass-with-ipykernel-6.0.0.patch (rev 0)
+++ 0001-Make-tests-pass-with-ipykernel-6.0.0.patch 2021-08-21 05:55:23 UTC (rev 1004091)
@@ -0,0 +1,34 @@
+From 3e1e6c6f31b86f5fb0e79a6901822dbe62af0891 Mon Sep 17 00:00:00 2001
+From: Chih-Hsuan Yen <yan12125 at gmail.com>
+Date: Sat, 21 Aug 2021 11:41:01 +0800
+Subject: [PATCH] Make tests pass with ipykernel >= 6.0.0
+
+Ref: https://github.com/ipython/ipykernel/pull/685
+---
+ tests/test_ignore.py | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/tests/test_ignore.py b/tests/test_ignore.py
+index 738c6d2..8e28f95 100644
+--- a/tests/test_ignore.py
++++ b/tests/test_ignore.py
+@@ -22,10 +22,13 @@ def test_conf_ignore_stderr(testdir):
+
+ # Setup notebook with stream outputs
+ nb = build_nb([
++ # Since ipykernel 6.0.0, sys.stdout.write and sys.stderr.write functions
++ # return the number of written bytes. Capture returned values to avoid extra
++ # text/plain fields.
+ "import sys",
+- "sys.stdout.write('test\\n')",
+- "sys.stderr.write('error output\\n')",
+- "sys.stdout.write('test\\n')\nsys.stderr.write('error output\\n')",
++ "ret = sys.stdout.write('test\\n')",
++ "ret = sys.stderr.write('error output\\n')",
++ "ret = sys.stdout.write('test\\n')\nret = sys.stderr.write('error output\\n')",
+ ], mark_run=True)
+ nb.cells[1].outputs.append(nbformat.v4.new_output(
+ 'stream',
+--
+2.33.0
+
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2021-08-21 05:39:49 UTC (rev 1004090)
+++ PKGBUILD 2021-08-21 05:55:23 UTC (rev 1004091)
@@ -14,9 +14,16 @@
'python-coverage')
makedepends=('python-setuptools')
checkdepends=('python-doit' 'python-matplotlib' 'python-pytest-cov' 'python-sympy')
-source=("https://github.com/computationalmodelling/nbval/archive/$pkgver/$pkgname-$pkgver.tar.gz")
-sha512sums=('ce2122ab490b52537696b2a8e97fd3b604c547af93fccf7d83d82b9180d8bb50b57d002f4e16eb605acabab5b31e961fea97bf2d46bf45b9cd1f8b7fca028df2')
+source=("https://github.com/computationalmodelling/nbval/archive/$pkgver/$pkgname-$pkgver.tar.gz"
+ "0001-Make-tests-pass-with-ipykernel-6.0.0.patch")
+sha512sums=('ce2122ab490b52537696b2a8e97fd3b604c547af93fccf7d83d82b9180d8bb50b57d002f4e16eb605acabab5b31e961fea97bf2d46bf45b9cd1f8b7fca028df2'
+ '04299db828848a1babc6edbcd553300c8c543eccb35ff78eb24352d0c92ef802f6e245832d0412239d1adcab334957a55cab6f87477a8e832669b9f61655d1f7')
+prepare() {
+ cd nbval-$pkgver
+ patch -Np1 -i ../0001-Make-tests-pass-with-ipykernel-6.0.0.patch
+}
+
build() {
cd nbval-$pkgver
python setup.py build
@@ -32,20 +39,10 @@
# Note that matplotlib.MatplotlibDeprecationWarning is inherited from UserWarning
# instead of DeprecationWarning [3] until its upcoming version [4].
export PYTHONWARNINGS="ignore::UserWarning"
- # 2. ipython uses a different default figure size for inline matplotlib plots since 7.23
- # This is due to the switch to matplotlib-inline in ipython 7.23 [5]. ipykernel
- # has a similar change since 6.0.0 [6], while community/python-ipykernel is out-dated.
- # As nbval uses ipykernel to run notebooks [7], running nbval on Arch generates figures
- # with the old default size. Fortunately, matplotlib allows overriding the default
- # backend, as inspired by [6].
- export MPLBACKEND=module://matplotlib_inline.backend_inline
# [1] https://github.com/computationalmodelling/nbval/issues/167
# [2] https://github.com/ipython/ipython/pull/12889
# [3] https://github.com/matplotlib/matplotlib/blob/v3.4.2/lib/matplotlib/_api/deprecation.py#L19
# [4] https://github.com/matplotlib/matplotlib/pull/20046
- # [5] https://github.com/ipython/ipython/pull/12817
- # [6] https://github.com/ipython/ipykernel/pull/591
- # [7] https://github.com/computationalmodelling/nbval/blob/0.9.6/nbval/kernel.py
PYTHONPATH="$PWD" doit test
}
More information about the arch-commits
mailing list