blob: 526454a476d50612b599eb23a33eab9118c69b7f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/usr/bin/env python
import os
import shutil
import mozprofile
import mozunit
here = os.path.dirname(os.path.abspath(__file__))
"""
use of --profile in mozrunner just blows away addon sources:
https://bugzilla.mozilla.org/show_bug.cgi?id=758250
"""
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.rmtree(tmpdir)
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])
newprofile.cleanup()
# the source addon *should* still exist
assert os.path.exists(tmpdir)
assert os.path.exists(os.path.join(tmpdir, "install.rdf"))
if __name__ == "__main__":
mozunit.main()
|