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
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/performance
parent36584bbc2d347cc1df9fd77b59ff1a3d3d7fef53 (diff)
Cleanup: pep8
Diffstat (limited to 'tests/performance')
-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
10 files changed, 21 insertions, 4 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]