def create_profile(addons, pref_categories, profile=None): from mozprofile.prefs import Preferences from mozprofile.profile import Profile from subprocess import check_output prefs = Preferences() for category in pref_categories: prefs.add_file("{}:{}".format(C.MOZRUNNER_PREFS_INI, category)) return Profile( addons=addons, preferences=prefs(), restore=False, )