summaryrefslogtreecommitdiffstats
path: root/testing/mozbase/mozprofile/tests/test_bug758250.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /testing/mozbase/mozprofile/tests/test_bug758250.py
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/mozbase/mozprofile/tests/test_bug758250.py')
-rwxr-xr-xtesting/mozbase/mozprofile/tests/test_bug758250.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/testing/mozbase/mozprofile/tests/test_bug758250.py b/testing/mozbase/mozprofile/tests/test_bug758250.py
new file mode 100755
index 0000000000..526454a476
--- /dev/null
+++ b/testing/mozbase/mozprofile/tests/test_bug758250.py
@@ -0,0 +1,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()