[Bf-blender-cvs] [cb66a28d821] blender2.8: Cleanup: unused vars, imports

Campbell Barton noreply at git.blender.org
Sun Nov 25 23:28:33 CET 2018


Commit: cb66a28d821906957a8f092b999f531e4a3a4571
Author: Campbell Barton
Date:   Mon Nov 26 09:26:15 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBcb66a28d821906957a8f092b999f531e4a3a4571

Cleanup: unused vars, imports

===================================================================

M	tests/python/alembic_tests.py
M	tests/python/batch_import.py
M	tests/python/bl_alembic_import_test.py
M	tests/python/bl_load_addons.py
M	tests/python/bl_load_py_modules.py
M	tests/python/bl_mesh_validate.py
M	tests/python/bl_run_operators.py
M	tests/python/ffmpeg_tests.py
M	tests/python/modules/test_utils.py
M	tests/python/pep8.py
M	tests/python/rna_info_dump.py

===================================================================

diff --git a/tests/python/alembic_tests.py b/tests/python/alembic_tests.py
index d872e699cea..09e9b8981e3 100755
--- a/tests/python/alembic_tests.py
+++ b/tests/python/alembic_tests.py
@@ -20,17 +20,15 @@
 # <pep8 compliant>
 
 import argparse
-import functools
-import shutil
 import pathlib
 import subprocess
 import sys
-import tempfile
 import unittest
 
-from modules.test_utils import (with_tempdir,
-                                AbstractBlenderRunnerTest,
-                                )
+from modules.test_utils import (
+    with_tempdir,
+    AbstractBlenderRunnerTest,
+)
 
 
 class AbcPropError(Exception):
diff --git a/tests/python/batch_import.py b/tests/python/batch_import.py
index a6e2469349b..20d96a69a79 100644
--- a/tests/python/batch_import.py
+++ b/tests/python/batch_import.py
@@ -157,7 +157,7 @@ def main():
     parser.add_option("-S", "--start", dest="start", help="From collected files, start with this index", metavar='int')
     parser.add_option("-E", "--end", dest="end", help="From collected files, end with this index", metavar='int')
 
-    options, args = parser.parse_args(argv)  # In this example we wont use the args
+    options, _args = parser.parse_args(argv)  # In this example we wont use the args
 
     if not argv:
         parser.print_help()
diff --git a/tests/python/bl_alembic_import_test.py b/tests/python/bl_alembic_import_test.py
index 95afff53ed4..ad7d2fd398a 100644
--- a/tests/python/bl_alembic_import_test.py
+++ b/tests/python/bl_alembic_import_test.py
@@ -175,8 +175,6 @@ class SimpleImportTest(AbstractAlembicTest):
         self.assertAlmostEqual(z, 0)
 
     def test_change_path_modifier(self):
-        import math
-
         fname = 'animated-mesh.abc'
         abc = self.testdir / fname
         relpath = bpy.path.relpath(str(abc))
@@ -188,7 +186,6 @@ class SimpleImportTest(AbstractAlembicTest):
         # Check that the file loaded ok.
         bpy.context.scene.frame_set(6)
         scene = bpy.context.scene
-        layer = scene.view_layers[scene.active_layer]
         mesh = plane.to_mesh(bpy.context.depsgraph, True, True, False)
         self.assertAlmostEqual(-1, mesh.vertices[0].co.x)
         self.assertAlmostEqual(-1, mesh.vertices[0].co.y)
diff --git a/tests/python/bl_load_addons.py b/tests/python/bl_load_addons.py
index 16ddea24756..e404e2340ce 100644
--- a/tests/python/bl_load_addons.py
+++ b/tests/python/bl_load_addons.py
@@ -102,7 +102,7 @@ def reload_addons(do_reload=True, do_reverse=True):
     disable_addons()
 
     # Run twice each time.
-    for i in (0, 1):
+    for _ in (0, 1):
         for mod in modules:
             mod_name = mod.__name__
             print("\tenabling:", mod_name)
diff --git a/tests/python/bl_load_py_modules.py b/tests/python/bl_load_py_modules.py
index 437a425a36d..b7b0db76b63 100644
--- a/tests/python/bl_load_py_modules.py
+++ b/tests/python/bl_load_py_modules.py
@@ -197,7 +197,7 @@ def load_modules():
                     assert(os.path.samefile(mod_imp.__file__, submod_full))
 
                     modules.append(mod_imp)
-                except Exception as e:
+                except Exception:
                     import traceback
                     # Module might fail to import, but we don't want whole test to fail here.
                     # Reasoning:
diff --git a/tests/python/bl_mesh_validate.py b/tests/python/bl_mesh_validate.py
index e1dd097b2e0..47a5e5efe47 100644
--- a/tests/python/bl_mesh_validate.py
+++ b/tests/python/bl_mesh_validate.py
@@ -114,7 +114,7 @@ def test_builtins():
             getattr(bpy.ops.mesh, func)(location=(x * 2.5, y * 2.5, 0))
             data = bpy.context.active_object.data
             try:
-                for n in range(BUILTINS_NBRCHANGES):
+                for _ in range(BUILTINS_NBRCHANGES):
                     rnd = random.randint(1, 3)
                     if rnd == 1:
                         # Make fun with some edge.
diff --git a/tests/python/bl_run_operators.py b/tests/python/bl_run_operators.py
index f3b1ec2f4c2..5954f7d9381 100644
--- a/tests/python/bl_run_operators.py
+++ b/tests/python/bl_run_operators.py
@@ -141,7 +141,7 @@ def reset_blend():
 
     if USE_RANDOM_SCREEN:
         import random
-        for i in range(random.randint(0, len(bpy.data.screens))):
+        for _ in range(random.randint(0, len(bpy.data.screens))):
             bpy.ops.screen.delete()
         print("Scree IS", bpy.context.screen)
 
@@ -237,7 +237,7 @@ if USE_ATTRSET:
             seq = getattr(bpy.data, attr)
             if seq.__class__.__name__ == 'bpy_prop_collection':
                 for id_data in seq:
-                    for val, prop, tp in id_walk(id_data, bpy.data):
+                    for val, prop, _tp in id_walk(id_data, bpy.data):
                         # print(id_data)
                         for val_rnd in _random_values:
                             try:
diff --git a/tests/python/ffmpeg_tests.py b/tests/python/ffmpeg_tests.py
index 70677677667..3d38ebd5edc 100755
--- a/tests/python/ffmpeg_tests.py
+++ b/tests/python/ffmpeg_tests.py
@@ -20,12 +20,8 @@
 # <pep8 compliant>
 
 import argparse
-import functools
-import shutil
 import pathlib
-import subprocess
 import sys
-import tempfile
 import unittest
 
 from modules.test_utils import AbstractBlenderRunnerTest
diff --git a/tests/python/modules/test_utils.py b/tests/python/modules/test_utils.py
index 47d720684ba..46c1626493f 100755
--- a/tests/python/modules/test_utils.py
+++ b/tests/python/modules/test_utils.py
@@ -19,13 +19,10 @@
 
 # <pep8 compliant>
 
-import argparse
 import functools
 import shutil
 import pathlib
-import re
 import subprocess
-import sys
 import tempfile
 import unittest
 
diff --git a/tests/python/pep8.py b/tests/python/pep8.py
index ccc2dddbbd9..78f0c82d00f 100644
--- a/tests/python/pep8.py
+++ b/tests/python/pep8.py
@@ -62,7 +62,7 @@ def is_pep8(path):
             return 1
 
     f = open(path, 'r', encoding="utf8")
-    for i in range(PEP8_SEEK_COMMENT):
+    for _ in range(PEP8_SEEK_COMMENT):
         line = f.readline()
         if line.startswith("# <pep8"):
             if line.startswith("# <pep8 compliant>"):
diff --git a/tests/python/rna_info_dump.py b/tests/python/rna_info_dump.py
index da228e52652..01cbe8d290b 100644
--- a/tests/python/rna_info_dump.py
+++ b/tests/python/rna_info_dump.py
@@ -71,7 +71,7 @@ def api_dump(use_properties=True, use_functions=True):
 
     def dump_funcs():
         data = []
-        for struct_id, v in sorted(struct.items()):
+        for _struct_id, v in sorted(struct.items()):
             struct_id_str = struct_full_id(v)
 
             funcs = [(func.identifier, func) for func in v.functions]
@@ -90,7 +90,7 @@ def api_dump(use_properties=True, use_functions=True):
 
     def dump_props():
         data = []
-        for struct_id, v in sorted(struct.items()):
+        for _struct_id, v in sorted(struct.items()):
             struct_id_str = struct_full_id(v)
 
             props = [(prop.identifier, prop) for prop in v.properties]



More information about the Bf-blender-cvs mailing list