mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-11-07 17:36:00 +00:00
Have a separate GH action for tests
This commit is contained in:
parent
3f177bd27e
commit
74ca172fe6
2 changed files with 15 additions and 9 deletions
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
|
|
@ -14,12 +14,10 @@ jobs:
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Code Style
|
- name: Install Dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install flake8
|
|
||||||
flake8
|
|
||||||
- name: Tests
|
|
||||||
run: |
|
|
||||||
pip install -r test/pip_reqs.txt
|
pip install -r test/pip_reqs.txt
|
||||||
|
- name: Execute Tests
|
||||||
|
run: |
|
||||||
python -m unittest discover
|
python -m unittest discover
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,24 @@ async def assert_for_md5sum(url, md5sum, aiohttp_session):
|
||||||
async with aiohttp_session.get(url) as response:
|
async with aiohttp_session.get(url) as response:
|
||||||
expected_response_status = 200
|
expected_response_status = 200
|
||||||
assert response.status == expected_response_status, (
|
assert response.status == expected_response_status, (
|
||||||
f'Request to "{url}" returned status code {response.status} (expected {expected_response_status}.'
|
f'Request to "{url}" returned status code {response.status} '
|
||||||
|
f'(expected {expected_response_status}).'
|
||||||
)
|
)
|
||||||
content = await response.read()
|
content = await response.read()
|
||||||
caclulated_md5sum = hashlib.md5(content).hexdigest()
|
caclulated_md5sum = hashlib.md5(content).hexdigest()
|
||||||
assert caclulated_md5sum == md5sum, (
|
assert caclulated_md5sum == md5sum, (
|
||||||
f'"{url}" failed MD5 checksum:\nGot {caclulated_md5sum} (expected {md5sum}).'
|
f'"{url}" failed MD5 checksum:\nGot {caclulated_md5sum} '
|
||||||
|
f'(expected {md5sum}).'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def assert_for_commit_sha_and_md5sum_from_versions(base_url, versions, aiohttp_session):
|
async def assert_for_commit_sha_and_md5sum_from_versions(base_url, versions, aiohttp_session):
|
||||||
tasks = tuple(
|
tasks = tuple(
|
||||||
assert_for_md5sum(
|
assert_for_md5sum(
|
||||||
base_url.format(content_type="raw", tag=version["commit_sha"]),
|
base_url.format(
|
||||||
|
content_type="raw",
|
||||||
|
tag=version["commit_sha"],
|
||||||
|
),
|
||||||
version["md5sum"],
|
version["md5sum"],
|
||||||
aiohttp_session,
|
aiohttp_session,
|
||||||
) for number, version in versions.items()
|
) for number, version in versions.items()
|
||||||
|
|
@ -65,7 +70,10 @@ class TestPluginManagerMetadata(unittest.IsolatedAsyncioTestCase):
|
||||||
),
|
),
|
||||||
# Additionally assert for the latest version with tag as "main".
|
# Additionally assert for the latest version with tag as "main".
|
||||||
assert_for_md5sum(
|
assert_for_md5sum(
|
||||||
self.content["plugin_manager_url"].format(content_type="raw", tag="main"),
|
self.content["plugin_manager_url"].format(
|
||||||
|
content_type="raw",
|
||||||
|
tag="main",
|
||||||
|
),
|
||||||
latest_version["md5sum"],
|
latest_version["md5sum"],
|
||||||
session,
|
session,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue