diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-02 13:16:59 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-03-02 13:18:12 +0300 |
commit | b5b34bc2c0ae4004bd4f04a4f46a85f347a92214 (patch) | |
tree | 7944850ba8d9c23e28a050408189874940895b26 /tests | |
parent | f2a2d5492b977bd4b6d03160e19dad6d2ff2f551 (diff) |
Tests: Avoid access globals from abstract base class
Delegate functionality to subclasses, assert when subclasses didn't do
job the are supposed to do.
Thanks Sybren for pointing to a proper solution.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/python/modules/test_utils.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/python/modules/test_utils.py b/tests/python/modules/test_utils.py index 489f36c913f..6ca498d8cdf 100755 --- a/tests/python/modules/test_utils.py +++ b/tests/python/modules/test_utils.py @@ -58,11 +58,10 @@ def with_tempdir(wrapped): class AbstractBlenderRunnerTest(unittest.TestCase): """Base class for all test suites which needs to run Blender""" - @classmethod - def setUpClass(cls): - global args - cls.blender = args.blender - cls.testdir = pathlib.Path(args.testdir) + # Set in a subclass + blender: pathlib.Path = None + testdir: pathlib.Path = None + def run_blender(self, filepath: str, python_script: str, timeout: int=300) -> str: """Runs Blender by opening a blendfile and executing a script. @@ -73,6 +72,9 @@ class AbstractBlenderRunnerTest(unittest.TestCase): :param timeout: in seconds """ + assert self.blender, "Path to Blender binary is to be set in setUpClass()" + assert self.testdir, "Path to tests binary is to be set in setUpClass()" + blendfile = self.testdir / filepath command = ( |