Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
nutti committed Sep 30, 2024
1 parent 143eb23 commit d4efd56
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on: # yamllint disable-line rule:truthy

jobs:
test-addon-blender-before-v41:
name: Test add-on (Blender < 4.2)
name: Test add-on
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
SK_CONSOLE_MODE: true

test-addon-blender-after-v42:
name: Test add-on (Blender >= 4.2)
name: Test add-on
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
28 changes: 18 additions & 10 deletions tests/python/screencast_keys_test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,31 @@ def get_user_preferences(context):


def check_addon_enabled(mod):
if check_version(2, 80, 0) < 0:
if check_version(2, 80, 0) >= 0:
result = bpy.ops.preferences.addon_enable(module=mod)
else:
result = bpy.ops.wm.addon_enable(module=mod)
assert (result == {'FINISHED'}), "Failed to enable add-on {}".format(mod)
if check_version(2, 80, 0) >= 0:
assert mod in bpy.context.preferences.addons.keys(),\
"Failed to enable add-on {}".format(mod)
else:
result = bpy.ops.preferences.addon_enable(module=mod)
assert (result == {'FINISHED'}), "Failed to enable add-on %s" % (mod)
assert (mod in get_user_preferences(bpy.context).addons.keys()), \
"Failed to enable add-on %s" % (mod)
assert mod in bpy.context.user_preferences.addons.keys(),\
"Failed to enable add-on {}".format(mod)


def check_addon_disabled(mod):
if check_version(2, 80, 0) < 0:
if check_version(2, 80, 0) >= 0:
result = bpy.ops.preferences.addon_disable(module=mod)
else:
result = bpy.ops.wm.addon_disable(module=mod)
assert (result == {'FINISHED'}), "Failed to disable add-on {}".format(mod)
if check_version(2, 80, 0) >= 0:
assert mod not in bpy.context.preferences.addons.keys(),\
"Failed to disable add-on {}".format(mod)
else:
result = bpy.ops.preferences.addon_disable(module=mod)
assert (result == {'FINISHED'}), "Failed to disable add-on %s" % (mod)
assert (mod not in get_user_preferences(bpy.context).addons.keys()), \
"Failed to disable add-on %s" % (mod)
assert mod not in bpy.context.user_preferences.addons.keys(),\
"Failed to disable add-on {}".format(mod)


def operator_exists(idname):
Expand Down

0 comments on commit d4efd56

Please sign in to comment.