Skip to content

Commit

Permalink
Run formatter for new test
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-tianquaw committed Apr 4, 2024
1 parent 54bea35 commit 4ba22c0
Showing 1 changed file with 16 additions and 31 deletions.
47 changes: 16 additions & 31 deletions test/test_package_report.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
from __future__ import absolute_import

import json

import pytest

pytestmark = pytest.mark.unit

from unittest.mock import patch

from config import _image_generator_configs
from package_report import _get_installed_package_versions_and_conda_versions, _generate_python_package_size_report_per_image
from package_report import (
_generate_python_package_size_report_per_image,
_get_installed_package_versions_and_conda_versions,
)
from utils import get_match_specs, get_semver


Expand All @@ -34,41 +38,20 @@ def _create_env_out_docker_file(file_path):

def _create_base_image_package_metadata(file_path):
metadata = {
"libllvm18": {
"version": "18.1.1",
"size": 37301754
},
"python": {
"version": "3.12.1",
"size": 30213651
},
"tqdm": {
"version": "4.66.2",
"size": 89567
}
"libllvm18": {"version": "18.1.1", "size": 37301754},
"python": {"version": "3.12.1", "size": 30213651},
"tqdm": {"version": "4.66.2", "size": 89567},
}
with open(file_path, "w") as metadata_file:
json.dump(metadata, metadata_file)


def _create_target_image_package_metadata(file_path):
metadata = {
"libllvm18": {
"version": "18.1.2",
"size": 38407510
},
"python": {
"version": "3.12.2",
"size": 32312631
},
"libclang": {
"version": "18.1.2",
"size": 19272925
},
"tqdm": {
"version": "4.66.2",
"size": 89567
}
"libllvm18": {"version": "18.1.2", "size": 38407510},
"python": {"version": "3.12.2", "size": 32312631},
"libclang": {"version": "18.1.2", "size": 19272925},
"tqdm": {"version": "4.66.2", "size": 89567},
}
with open(file_path, "w") as metadata_file:
json.dump(metadata, metadata_file)
Expand Down Expand Up @@ -148,7 +131,9 @@ def test_generate_package_size_report(capsys, tmp_path):
target_version_metadata_file = target_version_path / _image_generator_configs[1]["package_metadata_filename"]
_create_target_image_package_metadata(target_version_metadata_file)

_generate_python_package_size_report_per_image(base_version_path, target_version_path, _image_generator_configs[1], "1.6.2")
_generate_python_package_size_report_per_image(
base_version_path, target_version_path, _image_generator_configs[1], "1.6.2"
)

captured = capsys.readouterr()
# Assert total size delta report
Expand All @@ -164,4 +149,4 @@ def test_generate_package_size_report(capsys, tmp_path):
assert "libllvm18|18.1.2|36.63MB" in captured.out
assert "python|3.12.2|30.82MB" in captured.out
assert "libclang|18.1.2|18.38MB" in captured.out
assert "tqdm|4.66.2|87.47KB" in captured.out
assert "tqdm|4.66.2|87.47KB" in captured.out

0 comments on commit 4ba22c0

Please sign in to comment.