mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 21:44:01 -06:00
Add test to force submitters to stay below 1MB for platform meshes
This is our current policy. So this way we'll let submitters of new definition files know that their platform meshes might be too big. If they are too big they'll get a fat X at their PR.
This commit is contained in:
parent
ca25ec3dbc
commit
842bdfbf64
1 changed files with 20 additions and 0 deletions
20
tests/Resources/TestMeshes.py
Normal file
20
tests/Resources/TestMeshes.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Copyright (c) 2020 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import os.path # To find the platform meshes.
|
||||
import os # To test the file size of platform meshes.
|
||||
import pytest # To define parametrised tests.
|
||||
|
||||
# Make sure we have the paths to the platform meshes.
|
||||
all_meshes = sorted(os.listdir(os.path.join(os.path.dirname(__file__), "..", "..", "resources", "meshes")))
|
||||
all_meshes = [os.path.join(os.path.dirname(__file__), "..", "..", "resources", "meshes", filename) for filename in all_meshes]
|
||||
|
||||
@pytest.mark.parametrize("file_path", all_meshes)
|
||||
def test_meshSize(file_path: str) -> None:
|
||||
"""
|
||||
Tests if the mesh files are not too big.
|
||||
|
||||
Our policy is that platform meshes should not exceed 1MB.
|
||||
:param file_path: The path to the platform mesh to test.
|
||||
"""
|
||||
assert os.stat(file_path).st_size < 1024 * 1024 * 1.1 # Even though our policy is 1MB, allow for 10% leniency.
|
Loading…
Add table
Add a link
Reference in a new issue