Skip to content

Commit 7b80cf9

Browse files
authored
Backport PR #16314: Run Python tests on MacOS with Python 12, replace canvas with jest-canvas-mock (#16501)
1 parent d3897d2 commit 7b80cf9

File tree

13 files changed

+85
-86
lines changed

13 files changed

+85
-86
lines changed

docs/source/developer/contributing.rst

-13
Original file line numberDiff line numberDiff line change
@@ -271,19 +271,6 @@ Notes:
271271
called something else (such as "python3") then parts of the build
272272
will fail. You may wish to build in a conda environment, or make an
273273
alias.
274-
- Some of the packages used in the development environment require
275-
Python 3.0 or higher. If you encounter an ImportError during the
276-
installation, make sure Python 3.0+ is installed. Also, try using the
277-
Python 3.0+ version of ``pip`` or ``pip3 install -e .`` command to
278-
install JupyterLab from the forked repository.
279-
- If you see an error that says ``Call to 'pkg-config pixman-1 --libs'
280-
returned exit status 127 while in binding.gyp`` while running the
281-
``pip install`` command above, you may be missing packages required
282-
by ``canvas``. On macOS with Homebrew, you can add these packages by
283-
running
284-
``brew install pkg-config cairo pango libpng jpeg giflib librsvg``.
285-
If you are using mamba or conda, you can install the necessary packages
286-
with `conda install -c conda-forge pkg-config glib pango pixman`.
287274
- The ``jlpm`` command is a JupyterLab-provided, locked version of the
288275
`yarn <https://classic.yarnpkg.com/en/>`__ package manager. If you have
289276
``yarn`` installed already, you can use the ``yarn`` command when
Loading

galata/test/galata/benchmarkReporter.spec.ts-snapshots/test-galata-linux.svg

+1-1
Loading

packages/csvviewer/jest.config.js

+8
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1+
/*
2+
* Copyright (c) Jupyter Development Team.
3+
* Distributed under the terms of the Modified BSD License.
4+
*/
5+
16
const func = require('@jupyterlab/testutils/lib/jest-config');
7+
const config = func(__dirname);
28
module.exports = func(__dirname);
9+
config['setupFiles'].push('jest-canvas-mock');
10+
module.exports = config;

packages/csvviewer/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@
5656
"devDependencies": {
5757
"@jupyterlab/testutils": "^3.6.7",
5858
"@types/jest": "^26.0.10",
59-
"canvas": "^2.6.1",
6059
"csv-spectrum": "^1.0.0",
6160
"jest": "^26.4.2",
61+
"jest-canvas-mock": "^2.5.2",
6262
"rimraf": "~3.0.0",
6363
"ts-jest": "^26.3.0",
6464
"typedoc": "~0.21.2",

packages/debugger/jest.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
/*
2+
* Copyright (c) Jupyter Development Team.
3+
* Distributed under the terms of the Modified BSD License.
4+
*/
5+
16
const func = require('@jupyterlab/testutils/lib/jest-config');
2-
module.exports = func(__dirname);
7+
const config = func(__dirname);
8+
config['setupFiles'].push('jest-canvas-mock');
9+
module.exports = config;

packages/debugger/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
"@types/jest": "^26.0.10",
8585
"@types/react-dom": "^17.0.0",
8686
"@types/text-encoding": "^0.0.35",
87-
"canvas": "^2.6.1",
8887
"jest": "^26.4.2",
88+
"jest-canvas-mock": "^2.5.2",
8989
"jest-junit": "^11.1.0",
9090
"jest-raw-loader": "^1.0.1",
9191
"jest-summary-reporter": "^0.0.2",

packages/terminal/jest.config.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
/*
2+
* Copyright (c) Jupyter Development Team.
3+
* Distributed under the terms of the Modified BSD License.
4+
*/
5+
16
const func = require('@jupyterlab/testutils/lib/jest-config');
2-
module.exports = func(__dirname);
7+
const config = func(__dirname);
8+
config['setupFiles'].push('jest-canvas-mock');
9+
module.exports = config;

packages/terminal/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
"devDependencies": {
5656
"@jupyterlab/testutils": "^3.6.7",
5757
"@types/jest": "^26.0.10",
58-
"canvas": "^2.6.1",
5958
"jest": "^26.4.2",
59+
"jest-canvas-mock": "^2.5.2",
6060
"rimraf": "~3.0.0",
6161
"ts-jest": "^26.3.0",
6262
"typedoc": "~0.21.2",

packages/vega5-extension/jest.config.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
*/
55

66
const func = require('@jupyterlab/testutils/lib/jest-config');
7-
module.exports = func(__dirname);
7+
const config = func(__dirname);
8+
config['setupFiles'].push('jest-canvas-mock');
9+
module.exports = config;

packages/vega5-extension/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@types/jest": "^26.0.10",
5050
"@types/webpack-env": "^1.14.1",
5151
"jest": "^26.4.2",
52+
"jest-canvas-mock": "^2.5.2",
5253
"rimraf": "~3.0.0",
5354
"typedoc": "~0.21.2",
5455
"typescript": "~4.1.3"

packages/vega5-extension/test/renderer.spec.ts

+29
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ describe('@jupyterlab/vega5-extension', () => {
2323

2424
expect(model).toHaveProperty('data.image/png');
2525
expect(model).not.toHaveProperty(SCALE_FACTOR_PROP);
26+
});
27+
28+
// requires `canvas`
29+
it.skip('should keep size of PNG', async () => {
30+
const model = new MimeModel({
31+
data: {
32+
[VEGALITE4_MIME_TYPE]: VEGALITE4_SPEC
33+
}
34+
});
35+
await VEGALITE4_RENDERER.renderModel(model);
2636

2737
const size = getPNGSize(model.data['image/png'] as string);
2838

@@ -49,6 +59,25 @@ describe('@jupyterlab/vega5-extension', () => {
4959

5060
expect(model).toHaveProperty('data.image/png');
5161
expect(model).toHaveProperty(SCALE_FACTOR_PROP, scaleFactor);
62+
});
63+
64+
// requires `canvas`
65+
it.skip('should resize scaled PNG', async () => {
66+
const scaleFactor = 2;
67+
68+
const model = new MimeModel({
69+
data: {
70+
[VEGALITE4_MIME_TYPE]: VEGALITE4_SPEC
71+
},
72+
metadata: {
73+
[VEGALITE4_MIME_TYPE]: {
74+
embed_options: {
75+
scaleFactor
76+
}
77+
}
78+
}
79+
});
80+
await VEGALITE4_RENDERER.renderModel(model);
5281

5382
const size = getPNGSize(model.data['image/png'] as string);
5483

yarn.lock

+23-65
Original file line numberDiff line numberDiff line change
@@ -2241,21 +2241,6 @@
22412241
"@lumino/signaling" "^1.11.1"
22422242
"@lumino/virtualdom" "^1.14.3"
22432243

2244-
"@mapbox/node-pre-gyp@^1.0.0":
2245-
version "1.0.5"
2246-
resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.5.tgz#2a0b32fcb416fb3f2250fd24cb2a81421a4f5950"
2247-
integrity sha512-4srsKPXWlIxp5Vbqz5uLfBN+du2fJChBoYn/f2h991WLdk7jUvcSk/McVLSv/X+xQIPI8eGD5GjrnygdyHnhPA==
2248-
dependencies:
2249-
detect-libc "^1.0.3"
2250-
https-proxy-agent "^5.0.0"
2251-
make-dir "^3.1.0"
2252-
node-fetch "^2.6.1"
2253-
nopt "^5.0.0"
2254-
npmlog "^4.1.2"
2255-
rimraf "^3.0.2"
2256-
semver "^7.3.4"
2257-
tar "^6.1.0"
2258-
22592244
"@mrmlnc/readdir-enhanced@^2.2.1":
22602245
version "2.2.1"
22612246
resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
@@ -4390,7 +4375,7 @@ abab@^2.0.3, abab@^2.0.5:
43904375
resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a"
43914376
integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q==
43924377

4393-
abbrev@1, abbrev@^1.0.0:
4378+
abbrev@^1.0.0:
43944379
version "1.1.1"
43954380
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
43964381
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==
@@ -5849,15 +5834,6 @@ canonicalize@^1.0.1:
58495834
resolved "https://registry.yarnpkg.com/canonicalize/-/canonicalize-1.0.5.tgz#b43b390ce981d397908bb847c3a8d9614323a47b"
58505835
integrity sha512-mAjKJPIyP0xqqv6IAkvso07StOmz6cmGtNDg3pXCSzXVZOqka7StIkAhJl/zHOi4M2CgpYfD6aeRWbnrmtvBEA==
58515836

5852-
canvas@^2.6.1:
5853-
version "2.11.0"
5854-
resolved "https://registry.yarnpkg.com/canvas/-/canvas-2.11.0.tgz#7f0c3e9ae94cf469269b5d3a7963a7f3a9936434"
5855-
integrity sha512-bdTjFexjKJEwtIo0oRx8eD4G2yWoUOXP9lj279jmQ2zMnTQhT8C3512OKz3s+ZOaQlLbE7TuVvRDYDB3Llyy5g==
5856-
dependencies:
5857-
"@mapbox/node-pre-gyp" "^1.0.0"
5858-
nan "^2.17.0"
5859-
simple-get "^3.0.3"
5860-
58615837
capture-exit@^2.0.0:
58625838
version "2.0.0"
58635839
resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4"
@@ -6238,7 +6214,7 @@ [email protected]:
62386214
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
62396215
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
62406216

6241-
color-name@^1.0.0, color-name@~1.1.4:
6217+
color-name@^1.0.0, color-name@^1.1.4, color-name@~1.1.4:
62426218
version "1.1.4"
62436219
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
62446220
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
@@ -6885,6 +6861,11 @@ cssesc@^3.0.0:
68856861
resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee"
68866862
integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==
68876863

6864+
cssfontparser@^1.2.1:
6865+
version "1.2.1"
6866+
resolved "https://registry.yarnpkg.com/cssfontparser/-/cssfontparser-1.2.1.tgz#f4022fc8f9700c68029d542084afbaf425a3f3e3"
6867+
integrity sha512-6tun4LoZnj7VN6YeegOVb67KBX/7JJsqvj+pv3ZA7F878/eN33AbGa5b/S/wXxS/tcp8nc40xRUrsPlxIyNUPg==
6868+
68886869
csso@^4.0.2:
68896870
version "4.2.0"
68906871
resolved "https://registry.yarnpkg.com/csso/-/csso-4.2.0.tgz#ea3a561346e8dc9f546d6febedd50187cf389529"
@@ -7154,13 +7135,6 @@ decompress-response@^3.3.0:
71547135
dependencies:
71557136
mimic-response "^1.0.0"
71567137

7157-
decompress-response@^4.2.0:
7158-
version "4.2.1"
7159-
resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-4.2.1.tgz#414023cc7a302da25ce2ec82d0d5238ccafd8986"
7160-
integrity sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==
7161-
dependencies:
7162-
mimic-response "^2.0.0"
7163-
71647138
dedent@^0.7.0:
71657139
version "0.7.0"
71667140
resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c"
@@ -7315,11 +7289,6 @@ detect-indent@^6.0.0:
73157289
resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6"
73167290
integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==
73177291

7318-
detect-libc@^1.0.3:
7319-
version "1.0.3"
7320-
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
7321-
integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=
7322-
73237292
[email protected], detect-newline@^3.0.0:
73247293
version "3.1.0"
73257294
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651"
@@ -10377,6 +10346,14 @@ jake@^10.6.1:
1037710346
filelist "^1.0.1"
1037810347
minimatch "^3.0.4"
1037910348

10349+
jest-canvas-mock@^2.5.2:
10350+
version "2.5.2"
10351+
resolved "https://registry.yarnpkg.com/jest-canvas-mock/-/jest-canvas-mock-2.5.2.tgz#7e21ebd75e05ab41c890497f6ba8a77f915d2ad6"
10352+
integrity sha512-vgnpPupjOL6+L5oJXzxTxFrlGEIbHdZqFU+LFNdtLxZ3lRDCl17FlTMM7IatoRQkrcyOTMlDinjUguqmQ6bR2A==
10353+
dependencies:
10354+
cssfontparser "^1.2.1"
10355+
moo-color "^1.0.2"
10356+
1038010357
jest-changed-files@^26.6.2:
1038110358
version "26.6.2"
1038210359
resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-26.6.2.tgz#f6198479e1cc66f22f9ae1e22acaa0b429c042d0"
@@ -11979,11 +11956,6 @@ mimic-response@^1.0.0, mimic-response@^1.0.1:
1197911956
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b"
1198011957
integrity sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==
1198111958

11982-
mimic-response@^2.0.0:
11983-
version "2.1.0"
11984-
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-2.1.0.tgz#d13763d35f613d09ec37ebb30bac0469c0ee8f43"
11985-
integrity sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==
11986-
1198711959
min-document@^2.19.0:
1198811960
version "2.19.0"
1198911961
resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
@@ -12183,6 +12155,13 @@ moment@^2.24.0:
1218312155
resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108"
1218412156
integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==
1218512157

12158+
moo-color@^1.0.2:
12159+
version "1.0.3"
12160+
resolved "https://registry.yarnpkg.com/moo-color/-/moo-color-1.0.3.tgz#d56435f8359c8284d83ac58016df7427febece74"
12161+
integrity sha512-i/+ZKXMDf6aqYtBhuOcej71YSlbjT3wCO/4H1j8rPvxDJEifdwgg5MaFyu6iYAT8GBZJg2z0dkgK4YMzvURALQ==
12162+
dependencies:
12163+
color-name "^1.1.4"
12164+
1218612165
move-concurrently@^1.0.1:
1218712166
version "1.0.1"
1218812167
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"
@@ -12245,7 +12224,7 @@ [email protected]:
1224512224
ncp "~2.0.0"
1224612225
rimraf "~2.4.0"
1224712226

12248-
nan@^2.12.1, nan@^2.17.0:
12227+
nan@^2.12.1:
1224912228
version "2.17.0"
1225012229
resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb"
1225112230
integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==
@@ -12424,13 +12403,6 @@ node-releases@^1.1.52, node-releases@^1.1.71:
1242412403
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.73.tgz#dd4e81ddd5277ff846b80b52bb40c49edf7a7b20"
1242512404
integrity sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg==
1242612405

12427-
nopt@^5.0.0:
12428-
version "5.0.0"
12429-
resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88"
12430-
integrity sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==
12431-
dependencies:
12432-
abbrev "1"
12433-
1243412406
nopt@^6.0.0:
1243512407
version "6.0.0"
1243612408
resolved "https://registry.yarnpkg.com/nopt/-/nopt-6.0.0.tgz#245801d8ebf409c6df22ab9d95b65e1309cdb16d"
@@ -15019,20 +14991,6 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7:
1501914991
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
1502014992
integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
1502114993

15022-
simple-concat@^1.0.0:
15023-
version "1.0.1"
15024-
resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f"
15025-
integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==
15026-
15027-
simple-get@^3.0.3:
15028-
version "3.1.0"
15029-
resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-3.1.0.tgz#b45be062435e50d159540b576202ceec40b9c6b3"
15030-
integrity sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA==
15031-
dependencies:
15032-
decompress-response "^4.2.0"
15033-
once "^1.3.1"
15034-
simple-concat "^1.0.0"
15035-
1503614994
simple-swizzle@^0.2.2:
1503714995
version "0.2.2"
1503814996
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"

0 commit comments

Comments
 (0)