From 7cb50891ddd1ad5525e7d36df43ff6e3835d8f45 Mon Sep 17 00:00:00 2001 From: Robert Loehning <robert.loehning@digia.com> Date: Tue, 26 Feb 2013 16:15:08 +0100 Subject: [PATCH] Squish: Don't use global variable for __isWinFirewallRunning__() Change-Id: Iaad1da549addbb856515ae95ece4ae43246637fa Reviewed-by: Christian Stenger <christian.stenger@digia.com> --- tests/system/shared/hook_utils.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/system/shared/hook_utils.py b/tests/system/shared/hook_utils.py index 7221be65866..07d0b666b25 100644 --- a/tests/system/shared/hook_utils.py +++ b/tests/system/shared/hook_utils.py @@ -1,6 +1,4 @@ import re -# flag that caches the information whether Windows firewall is running or not -fireWallState = None # this function modifies all necessary run settings to make it possible to hook into # the application compiled by Creator @@ -310,17 +308,16 @@ def __configureFW__(workingDir, projectName, isReleaseBuild, addToFW=True): # helper to check whether win firewall is running or not # this doesn't check for other firewalls! def __isWinFirewallRunning__(): - global fireWallState - if fireWallState != None: - return fireWallState + if hasattr(__isWinFirewallRunning__, "fireWallState"): + return __isWinFirewallRunning__.fireWallState if not platform.system() in ('Microsoft' 'Windows'): - fireWallState = False + __isWinFirewallRunning__.fireWallState = False return False result = getOutputFromCmdline("netsh firewall show state") for line in result.splitlines(): if "Operational mode" in line: - fireWallState = not "Disable" in line - return fireWallState + __isWinFirewallRunning__.fireWallState = not "Disable" in line + return __isWinFirewallRunning__.fireWallState return None # this function adds the given executable as an attachable AUT -- GitLab