author Andreea Pavel <apavel@mozilla.com>
Fri, 21 Jan 2022 23:41:00 +0200
changeset 605190 00753e705770d35e46096f2894203b92910e98ce
parent 554551 994ae8e4833c90447d91f0e26a718573cff5a514
permissions -rwxr-xr-x
Merge autoland to mozilla-central a=merge

#!/usr/bin/env python

from __future__ import absolute_import

import mozprofile
import os
import shutil

import mozunit

here = os.path.dirname(os.path.abspath(__file__))

use of --profile in mozrunner just blows away addon sources:

def test_profile_addon_cleanup(tmpdir):
    tmpdir = tmpdir.mkdtemp().strpath
    addon = os.path.join(here, "addons", "empty")

    # sanity check: the empty addon should be here
    assert os.path.exists(addon)
    assert os.path.isdir(addon)
    assert os.path.exists(os.path.join(addon, "install.rdf"))

    # because we are testing data loss, let's make sure we make a copy
    shutil.copytree(addon, tmpdir)
    assert os.path.exists(os.path.join(tmpdir, "install.rdf"))

    # make a starter profile
    profile = mozprofile.FirefoxProfile()
    path = profile.profile

    # make a new profile based on the old
    newprofile = mozprofile.FirefoxProfile(profile=path, addons=[tmpdir])

    # the source addon *should* still exist
    assert os.path.exists(tmpdir)
    assert os.path.exists(os.path.join(tmpdir, "install.rdf"))

if __name__ == "__main__":