diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-07-06 05:05:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-07-06 05:05:27 +0300 |
commit | 432bfbf7a3b74943b1c251c12bd76616da23991f (patch) | |
tree | 4fff10c2aaca9d48ac4ccc1b368124ce102a53a1 /tests/performance/api | |
parent | 36584bbc2d347cc1df9fd77b59ff1a3d3d7fef53 (diff) |
Cleanup: pep8
Diffstat (limited to 'tests/performance/api')
-rw-r--r-- | tests/performance/api/__init__.py | 1 | ||||
-rw-r--r-- | tests/performance/api/config.py | 4 | ||||
-rw-r--r-- | tests/performance/api/device.py | 5 | ||||
-rw-r--r-- | tests/performance/api/environment.py | 1 | ||||
-rw-r--r-- | tests/performance/api/graph.py | 2 | ||||
-rw-r--r-- | tests/performance/api/test.py | 2 |
6 files changed, 12 insertions, 3 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 |