Skip to content

ci: Measure time it takes to run specific tests #804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const performance = require('perf_hooks').performance;
const crossSpawn = require('cross-spawn');
const glob = require('glob-all');
const JSZip = require('jszip');
Expand Down Expand Up @@ -108,6 +109,7 @@ const testFilter = (() => {

const test = (desc, func, opts = {}) =>
testFilter(desc)(desc, opts, async (t) => {
const startTime = performance.now();
setup();
let ended = false;
try {
Expand All @@ -123,6 +125,8 @@ const test = (desc, func, opts = {}) =>
}
if (!ended) t.end();
}
const endTime = performance.now();
console.log(`Execution time for "${desc}": ${endTime - startTime} ms`);
});

const availablePythons = (() => {
Expand Down Expand Up @@ -1373,23 +1377,25 @@ test(
{ skip: !canUseDocker() || process.platform === 'win32' }
);

test('py3.7 uses download cache by default option',
test(
'py3.7 uses download cache by default option',
async (t) => {
process.chdir('tests/base');
const path = npm(['pack', '../..']);
npm(['i', path]);
sls(['package'], { env: {} });
const cachepath = getUserCachePath();
t.true(
pathExistsSync(`${cachepath}${sep}downloadCacheslspyc${sep}http`),
pathExistsSync(`${cachepath}${sep}downloadCacheslspyc${sep}http`),
'cache directory exists'
);
t.end();
},
{ skip: true }
);

test('py3.7 uses download cache by default',
test(
'py3.7 uses download cache by default',
async (t) => {
process.chdir('tests/base');
const path = npm(['pack', '../..']);
Expand Down Expand Up @@ -1441,7 +1447,8 @@ test(
{ skip: true }
);

test('py3.7 uses static and download cache',
test(
'py3.7 uses static and download cache',
async (t) => {
process.chdir('tests/base');
const path = npm(['pack', '../..']);
Expand Down
9 changes: 5 additions & 4 deletions tests/poetry/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ description = ""
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
Flask = "^1.0"
python = "^3.7"
Flask = "2.0"
bottle = {git = "https://[email protected]/bottlepy/bottle.git", tag = "0.12.16"}
boto3 = "^1.9"
boto3 = "1.29.6"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
requires = ["poetry"]
build-backend = "poetry.masonry.api"

8 changes: 4 additions & 4 deletions tests/poetry_individually/module1/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ description = ""
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
Flask = "^1.0"
python = "^3.7"
Flask = "2.0"
bottle = {git = "https://[email protected]/bottlepy/bottle.git", tag = "0.12.16"}
boto3 = "^1.9"
boto3 = "1.29.6"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
requires = ["poetry"]
build-backend = "poetry.masonry.api"
6 changes: 3 additions & 3 deletions tests/poetry_packages/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ description = ""
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
Flask = "^1.0"
python = "^3.7"
Flask = "2.0"

[tool.poetry.group.custom1.dependencies]
bottle = {git = "https://[email protected]/bottlepy/bottle.git", tag = "0.12.16"}

[tool.poetry.group.custom2.dependencies]
boto3 = "^1.9"
boto3 = "1.29.6"

[build-system]
requires = ["poetry-core"]
Expand Down