def setUpClass(self): """ Load in the main pebble shell module """ global root_dir self.root_dir = root_dir pebble_shell = imp.load_source('pebble_shell', os.path.join(root_dir, 'pebble.py')) from pebble_shell import PbSDKShell self.p_sh = PbSDKShell() # What directory is our data in? self.data_dir = os.path.join(os.path.dirname(__file__), 'projects') # Create a temp directory to use self.tmp_dir = tempfile.mkdtemp() # Process command line options global g_cmd_args if g_cmd_args is not None: self.debug = g_cmd_args.debug else: self.debug = False # Setup the pebble command arguments self.pebble_cmd_line = ['pebble'] if self.debug: self.pebble_cmd_line += ['--debug']
def setUpClass(self): """ Load in the main pebble shell module """ global root_dir self.root_dir = root_dir pebble_shell = imp.load_source('pebble_shell', os.path.join(root_dir, 'pebble.py')) from pebble_shell import PbSDKShell self.p_sh = PbSDKShell() self.sdk_version = self.p_sh._get_version() # What directory is our data in? self.data_dir = os.path.join(os.path.dirname(__file__), 'analytics_data') # Create a temp directory to use self.tmp_dir = tempfile.mkdtemp() # Process command line options global g_cmd_args if g_cmd_args is not None: self.debug = g_cmd_args.debug else: self.debug = False # Setup the pebble command arguments self.pebble_cmd_line = ['pebble'] if self.debug: self.pebble_cmd_line += ['--debug'] # Delete the NO_TRACKING file if it exists self.no_tracking_file_path = os.path.normpath( os.path.join(root_dir, os.pardir, 'NO_TRACKING')) self.has_no_tracking_file = os.path.exists(self.no_tracking_file_path) if self.has_no_tracking_file: os.remove(self.no_tracking_file_path) # pre-cache path to pebble settings dir home_dir = os.path.expanduser("~") self.settings_dir = os.path.join(home_dir, ".pebble") # Create the set of common fields we expect to see in every event analytics = pebble.PblAnalytics._Analytics.get() client_id = open(os.path.join(self.settings_dir, "client_id")).read() self.common_evt_fields = { 'v': '1', 'tid': analytics.tracking_id, 'cid': client_id, 'cn': re.escape(platform.platform()), 'ck': re.escape(platform.python_version()), 'cs': client_id, }