SIGN IN SIGN UP

A data visualization and analytics component, especially well-suited for large and/or streaming datasets.

0 0 77 C++
2019-01-06 09:45:06 -05:00
/******************************************************************************
*
* Copyright (c) 2017, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
2021-09-12 14:08:32 -04:00
const {
bash,
execute,
execute_throw,
docker,
resolve,
getarg,
python_image,
} = require("./script_utils.js");
2019-01-06 09:45:06 -05:00
2021-10-23 01:29:39 -04:00
let PYTHON = getarg("--python38")
2021-09-12 14:08:32 -04:00
? "python3.8"
2021-10-23 01:29:39 -04:00
: getarg("--python36")
? "python3.6"
: getarg("--python37")
? "python3.7"
: "python3";
const COVERAGE = getarg("--coverage");
const VERBOSE = getarg("--debug");
const IS_DOCKER = process.env.PSP_DOCKER;
let IMAGE = "manylinux2010";
if (IS_DOCKER) {
// defaults to 2010
2021-09-12 14:08:32 -04:00
let MANYLINUX_VERSION = getarg("--manylinux2010")
? "manylinux2010"
: getarg("--manylinux2014")
? "manylinux2014"
: "";
IMAGE = python_image(MANYLINUX_VERSION, PYTHON);
}
2019-01-06 09:45:06 -05:00
let python_path;
if (IS_DOCKER) {
python_path = "python/perspective";
} else {
// When running locally, tests need to run in UTC and not the machine's
// local timezone.
process.env.TZ = "UTC";
python_path = resolve`${__dirname}/../python/perspective`;
}
/**
* Run `pytest` for client mode PerspectiveWidget, which need to be on a
* separate runtime from the other Python tests.
*/
2021-09-12 14:08:32 -04:00
const pytest_client_mode = (IS_DOCKER) => {
if (IS_DOCKER) {
return bash`${docker(IMAGE)} bash -c "cd \
python/perspective && TZ=UTC PYTHONMALLOC=debug ${PYTHON} -m pytest \
${VERBOSE ? "-vv --full-trace" : ""} --noconftest
perspective/tests/client_mode"`;
} else {
return bash`cd ${python_path} && PYTHONMALLOC=debug ${PYTHON} -m pytest \
2022-02-25 03:28:48 -05:00
${VERBOSE ? "-vv --full-trace" : ""} --noconftest
--disable-pytest-warnings
perspective/tests/client_mode`;
}
};
/**
* Run `pytest` for the `perspective-python` library.
*/
2021-09-12 14:08:32 -04:00
const pytest = (IS_DOCKER) => {
if (IS_DOCKER) {
return bash`${docker(IMAGE)} bash -c "cd \
python/perspective && TZ=UTC PYTHONMALLOC=debug ${PYTHON} -m pytest \
${VERBOSE ? "-vv --full-trace" : ""} perspective \
--ignore=perspective/tests/client_mode \
2022-02-25 03:28:48 -05:00
--disable-pytest-warnings
--cov=perspective"`;
} else {
return bash`cd ${python_path} && PYTHONMALLOC=debug ${PYTHON} -m pytest \
${VERBOSE ? "-vv --full-trace" : ""} perspective \
--ignore=perspective/tests/client_mode \
2022-02-25 03:28:48 -05:00
--disable-pytest-warnings
${COVERAGE ? "--cov=perspective" : ""}`;
}
};
// Check that the `PYTHON` command is valid, else default to `python`.
try {
execute_throw`${PYTHON} --version`;
} catch (e) {
console.warn(`\`${PYTHON}\` not found - using \`python\` instead.`);
PYTHON = "python";
}
2021-08-31 13:25:40 -04:00
// Check that the `PYTHON` command is valid, else default to `python`.
try {
execute_throw`${PYTHON} --version`;
} catch (e) {
console.warn(`\`${PYTHON}\` not found - using \`python\` instead.`);
PYTHON = "python";
}
try {
execute(pytest_client_mode(IS_DOCKER));
execute(pytest(IS_DOCKER));
} catch (e) {
2019-01-17 20:51:06 -05:00
console.log(e.message);
process.exit(1);
}