Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-07-06 05:05:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-07-06 05:05:27 +0300
commit432bfbf7a3b74943b1c251c12bd76616da23991f (patch)
tree4fff10c2aaca9d48ac4ccc1b368124ce102a53a1 /tests
parent36584bbc2d347cc1df9fd77b59ff1a3d3d7fef53 (diff)
Cleanup: pep8
Diffstat (limited to 'tests')
-rw-r--r--tests/performance/api/__init__.py1
-rw-r--r--tests/performance/api/config.py4
-rw-r--r--tests/performance/api/device.py5
-rw-r--r--tests/performance/api/environment.py1
-rw-r--r--tests/performance/api/graph.py2
-rw-r--r--tests/performance/api/test.py2
-rw-r--r--tests/performance/tests/__init__.py1
-rw-r--r--tests/performance/tests/animation.py3
-rw-r--r--tests/performance/tests/blend_load.py3
-rw-r--r--tests/performance/tests/cycles.py3
-rw-r--r--tests/python/bl_animation_fcurves.py1
-rw-r--r--tests/python/bl_blendfile_library_overrides.py8
-rw-r--r--tests/python/bl_pyapi_idprop.py1
-rw-r--r--tests/python/compositor_render_tests.py1
-rw-r--r--tests/python/cycles_render_tests.py1
-rw-r--r--tests/python/modules/mesh_test.py2
-rw-r--r--tests/python/operators.py2
17 files changed, 31 insertions, 10 deletions
diff --git a/tests/performance/api/__init__.py b/tests/performance/api/__init__.py
index 6f344a41841..2dc9283c44a 100644
--- a/tests/performance/api/__init__.py
+++ b/tests/performance/api/__init__.py
@@ -5,4 +5,3 @@ from .device import TestDevice, TestMachine
from .config import TestEntry, TestQueue, TestConfig
from .test import Test, TestCollection
from .graph import TestGraph
-
diff --git a/tests/performance/api/config.py b/tests/performance/api/config.py
index 900cac0a0bb..68f4df8d487 100644
--- a/tests/performance/api/config.py
+++ b/tests/performance/api/config.py
@@ -10,12 +10,14 @@ from typing import Dict, List
from .test import TestCollection
+
def get_build_hash(args: None) -> str:
import bpy
import sys
build_hash = bpy.app.build_hash.decode('utf-8')
return '' if build_hash == 'Unknown' else build_hash
+
@dataclass
class TestEntry:
"""Test to run, a combination of revision, test and device."""
@@ -42,6 +44,7 @@ class TestEntry:
for field in self.__dataclass_fields__:
setattr(self, field, json_dict[field])
+
class TestQueue:
"""Queue of tests to be run or inspected. Matches JSON file on disk."""
@@ -99,6 +102,7 @@ class TestQueue:
with open(self.filepath, 'w') as f:
json.dump(json_entries, f, indent=2)
+
class TestConfig:
"""Test configuration, containing a subset of revisions, tests and devices."""
diff --git a/tests/performance/api/device.py b/tests/performance/api/device.py
index e27540da747..b61ae42be36 100644
--- a/tests/performance/api/device.py
+++ b/tests/performance/api/device.py
@@ -4,6 +4,7 @@ import platform
import subprocess
from typing import List
+
def get_cpu_name() -> str:
# Get full CPU name.
if platform.system() == "Windows":
@@ -19,6 +20,7 @@ def get_cpu_name() -> str:
return "Unknown CPU"
+
def get_gpu_device(args: None) -> List:
# Get the list of available Cycles GPU devices.
import bpy
@@ -41,6 +43,7 @@ def get_gpu_device(args: None) -> List:
return result
+
class TestDevice:
def __init__(self, device_type: str, device_id: str, name: str, operating_system: str):
self.type = device_type
@@ -48,6 +51,7 @@ class TestDevice:
self.name = name
self.operating_system = operating_system
+
class TestMachine:
def __init__(self, env, need_gpus: bool):
operating_system = platform.system()
@@ -65,4 +69,3 @@ class TestMachine:
def cpu_device(self) -> TestDevice:
return self.devices[0]
-
diff --git a/tests/performance/api/environment.py b/tests/performance/api/environment.py
index 7c4e5e761a6..c9ddd493394 100644
--- a/tests/performance/api/environment.py
+++ b/tests/performance/api/environment.py
@@ -15,6 +15,7 @@ from typing import Callable, Dict, List
from .config import TestConfig
from .device import TestMachine
+
class TestEnvironment:
def __init__(self, blender_git_dir: pathlib.Path, base_dir: pathlib.Path):
self.blender_git_dir = blender_git_dir
diff --git a/tests/performance/api/graph.py b/tests/performance/api/graph.py
index e2d2e7d2058..eb411915ad9 100644
--- a/tests/performance/api/graph.py
+++ b/tests/performance/api/graph.py
@@ -6,6 +6,7 @@ import json
import pathlib
from typing import Dict, List
+
class TestGraph:
def __init__(self, json_filepaths: List[pathlib.Path]):
# Initialize graph from JSON file. Note that this is implemented without
@@ -102,4 +103,3 @@ class TestGraph:
contents = template.replace('%JSON_DATA%', self.json)
with open(filepath, "w") as f:
f.write(contents)
-
diff --git a/tests/performance/api/test.py b/tests/performance/api/test.py
index 23459b4b421..7e8193d2c21 100644
--- a/tests/performance/api/test.py
+++ b/tests/performance/api/test.py
@@ -4,6 +4,7 @@ import abc
import fnmatch
from typing import Dict, List
+
class Test:
@abc.abstractmethod
def name(self) -> str:
@@ -29,6 +30,7 @@ class Test:
Execute the test and report results.
"""
+
class TestCollection:
def __init__(self, env, names_filter: List=['*'], categories_filter: List=['*']):
import importlib
diff --git a/tests/performance/tests/__init__.py b/tests/performance/tests/__init__.py
index 69b72d23c3f..ac3e613174f 100644
--- a/tests/performance/tests/__init__.py
+++ b/tests/performance/tests/__init__.py
@@ -1,2 +1 @@
# Apache License, Version 2.0
-
diff --git a/tests/performance/tests/animation.py b/tests/performance/tests/animation.py
index de3b8817820..1a92f1a9718 100644
--- a/tests/performance/tests/animation.py
+++ b/tests/performance/tests/animation.py
@@ -3,6 +3,7 @@
import api
import os
+
def _run(args):
import bpy
import time
@@ -18,6 +19,7 @@ def _run(args):
result = {'time': elapsed_time}
return result
+
class AnimationTest(api.Test):
def __init__(self, filepath):
self.filepath = filepath
@@ -33,6 +35,7 @@ class AnimationTest(api.Test):
result, _ = env.run_in_blender(_run, args)
return result
+
def generate(env):
filepaths = env.find_blend_files('animation')
return [AnimationTest(filepath) for filepath in filepaths]
diff --git a/tests/performance/tests/blend_load.py b/tests/performance/tests/blend_load.py
index 4df8bd774d3..5fe498fd3d7 100644
--- a/tests/performance/tests/blend_load.py
+++ b/tests/performance/tests/blend_load.py
@@ -4,6 +4,7 @@ import api
import os
import pathlib
+
def _run(filepath):
import bpy
import time
@@ -20,6 +21,7 @@ def _run(filepath):
result = {'time': elapsed_time}
return result
+
class BlendLoadTest(api.Test):
def __init__(self, filepath):
self.filepath = filepath
@@ -34,6 +36,7 @@ class BlendLoadTest(api.Test):
result, _ = env.run_in_blender(_run, str(self.filepath))
return result
+
def generate(env):
filepaths = env.find_blend_files('*/*')
return [BlendLoadTest(filepath) for filepath in filepaths]
diff --git a/tests/performance/tests/cycles.py b/tests/performance/tests/cycles.py
index 185d4e8e6c0..f79e7333458 100644
--- a/tests/performance/tests/cycles.py
+++ b/tests/performance/tests/cycles.py
@@ -3,6 +3,7 @@
import api
import os
+
def _run(args):
import bpy
import time
@@ -39,6 +40,7 @@ def _run(args):
return None
+
class CyclesTest(api.Test):
def __init__(self, filepath):
self.filepath = filepath
@@ -74,6 +76,7 @@ class CyclesTest(api.Test):
raise Exception("Error parsing render time output")
+
def generate(env):
filepaths = env.find_blend_files('cycles-x/*')
return [CyclesTest(filepath) for filepath in filepaths]
diff --git a/tests/python/bl_animation_fcurves.py b/tests/python/bl_animation_fcurves.py
index 2ec04749d70..9017c1ee037 100644
--- a/tests/python/bl_animation_fcurves.py
+++ b/tests/python/bl_animation_fcurves.py
@@ -40,6 +40,7 @@ class AbstractAnimationTest:
self.assertTrue(self.testdir.exists(),
'Test dir %s should exist' % self.testdir)
+
class FCurveEvaluationTest(AbstractAnimationTest, unittest.TestCase):
def test_fcurve_versioning_291(self):
# See D8752.
diff --git a/tests/python/bl_blendfile_library_overrides.py b/tests/python/bl_blendfile_library_overrides.py
index 48625a1ecdb..c9c89c01cee 100644
--- a/tests/python/bl_blendfile_library_overrides.py
+++ b/tests/python/bl_blendfile_library_overrides.py
@@ -69,7 +69,7 @@ class TestLibraryOverrides(TestHelper, unittest.TestCase):
assert(len(local_id.override_library.properties) == 1)
override_prop = local_id.override_library.properties[0]
- assert(override_prop.rna_path == "location");
+ assert(override_prop.rna_path == "location")
assert(len(override_prop.operations) == 1)
override_operation = override_prop.operations[0]
assert(override_operation.operation == 'REPLACE')
@@ -96,7 +96,7 @@ class TestLibraryOverrides(TestHelper, unittest.TestCase):
self.assertIsNone(local_id.data.override_library)
assert(len(local_id.override_library.properties) == 1)
override_prop = local_id.override_library.properties[0]
- assert(override_prop.rna_path == "scale");
+ assert(override_prop.rna_path == "scale")
assert(len(override_prop.operations) == 1)
override_operation = override_prop.operations[0]
assert(override_operation.operation == 'NOOP')
@@ -116,14 +116,14 @@ class TestLibraryOverrides(TestHelper, unittest.TestCase):
assert(len(local_id.override_library.properties) == 2)
override_prop = local_id.override_library.properties[0]
- assert(override_prop.rna_path == "scale");
+ assert(override_prop.rna_path == "scale")
assert(len(override_prop.operations) == 1)
override_operation = override_prop.operations[0]
assert(override_operation.operation == 'NOOP')
assert(override_operation.subitem_local_index == -1)
override_prop = local_id.override_library.properties[1]
- assert(override_prop.rna_path == "location");
+ assert(override_prop.rna_path == "location")
assert(len(override_prop.operations) == 1)
override_operation = override_prop.operations[0]
assert(override_operation.operation == 'REPLACE')
diff --git a/tests/python/bl_pyapi_idprop.py b/tests/python/bl_pyapi_idprop.py
index 1e570bf9a7f..38cd9d04a6b 100644
--- a/tests/python/bl_pyapi_idprop.py
+++ b/tests/python/bl_pyapi_idprop.py
@@ -140,6 +140,7 @@ class TestIdPropertyCreation(TestHelper, unittest.TestCase):
with self.assertRaises(TypeError):
self.id["a"] = self
+
class TestIdPropertyGroupView(TestHelper, unittest.TestCase):
def test_type(self):
diff --git a/tests/python/compositor_render_tests.py b/tests/python/compositor_render_tests.py
index 057d4a2e6dd..199e1c13b8e 100644
--- a/tests/python/compositor_render_tests.py
+++ b/tests/python/compositor_render_tests.py
@@ -16,6 +16,7 @@ try:
except ImportError:
inside_blender = False
+
def get_arguments(filepath, output_filepath):
return [
"--background",
diff --git a/tests/python/cycles_render_tests.py b/tests/python/cycles_render_tests.py
index 36c3f7d9fe5..ca0bc9f18b9 100644
--- a/tests/python/cycles_render_tests.py
+++ b/tests/python/cycles_render_tests.py
@@ -57,6 +57,7 @@ BLACKLIST_GPU = [
'transparent_shadow_hair.*.blend',
]
+
def get_arguments(filepath, output_filepath):
dirname = os.path.dirname(filepath)
basedir = os.path.dirname(dirname)
diff --git a/tests/python/modules/mesh_test.py b/tests/python/modules/mesh_test.py
index 1749e798a32..6d921959e6f 100644
--- a/tests/python/modules/mesh_test.py
+++ b/tests/python/modules/mesh_test.py
@@ -680,7 +680,7 @@ class RunTest:
test_name = each_test.test_name
if self.verbose:
print()
- print("Running test {}/{}: {}...".format(test_number+1, len(self.tests), test_name))
+ print("Running test {}/{}: {}...".format(test_number + 1, len(self.tests), test_name))
success = self.run_test(test_name)
if not success:
diff --git a/tests/python/operators.py b/tests/python/operators.py
index c209b01c20c..4501df82175 100644
--- a/tests/python/operators.py
+++ b/tests/python/operators.py
@@ -321,7 +321,7 @@ def main():
MeshTest("CubeEdgeUnsubdivide", "testCubeEdgeUnsubdivide", "expectedCubeEdgeUnsubdivide",
[OperatorSpecEditMode("unsubdivide", {}, "EDGE", {i for i in range(6)})]),
MeshTest("UVSphereUnsubdivide", "testUVSphereUnsubdivide", "expectedUVSphereUnsubdivide",
- [OperatorSpecEditMode("unsubdivide", {'iterations': 9}, "FACE", {i for i in range(512)})]),
+ [OperatorSpecEditMode("unsubdivide", {'iterations': 9}, "FACE", {i for i in range(512)})]),
# vert connect path
# Tip: It works only if there is an already existing face or more than 2 vertices.