-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(deps): add `pytest-benchmark` * ci: move `pytest` command * ci: disable `codeql` on `pull_request`
- Loading branch information
Showing
11 changed files
with
125 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ name: CodeQL | |
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
schedule: | ||
- cron: 23 17 * * 0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,7 @@ coverage.xml | |
.hypothesis/ | ||
.pytest_cache/ | ||
cover/ | ||
.benchmarks/ | ||
|
||
# Translations | ||
*.mo | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env python | ||
import pytest | ||
from click.testing import CliRunner | ||
from dotenv import load_dotenv | ||
from images_upload_cli.__main__ import cli | ||
from pytest_httpx import HTTPXMock | ||
|
||
from tests.mock import uploadcare | ||
|
||
|
||
@pytest.fixture() | ||
def runner(): | ||
return CliRunner() | ||
|
||
|
||
@pytest.mark.online() | ||
@pytest.mark.benchmark(max_time=2) | ||
def test_bm_cli_online(benchmark, runner: CliRunner): | ||
@benchmark | ||
def result(): | ||
return runner.invoke( | ||
cli=cli, | ||
args=[ | ||
"-h", | ||
"uploadcare", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
], | ||
) | ||
|
||
assert result.exit_code == 0 | ||
|
||
|
||
@pytest.mark.benchmark(max_time=2) | ||
def test_bm_cli(benchmark, runner: CliRunner, httpx_mock: HTTPXMock): | ||
# mock response | ||
httpx_mock.add_response(text=uploadcare) | ||
|
||
# loading .env variables | ||
load_dotenv(dotenv_path="tests/data/.env.sample") | ||
|
||
@benchmark | ||
def result(): | ||
return runner.invoke( | ||
cli=cli, | ||
args=[ | ||
"-h", | ||
"uploadcare", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
"tests/data/pic.png", | ||
], | ||
) | ||
|
||
assert result.exit_code == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters