OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 3 import mozprofile |
| 4 import os |
| 5 import shutil |
| 6 import tempfile |
| 7 import unittest |
| 8 |
| 9 here = os.path.dirname(os.path.abspath(__file__)) |
| 10 |
| 11 class Bug758250(unittest.TestCase): |
| 12 """ |
| 13 use of --profile in mozrunner just blows away addon sources: |
| 14 https://bugzilla.mozilla.org/show_bug.cgi?id=758250 |
| 15 """ |
| 16 |
| 17 def test_profile_addon_cleanup(self): |
| 18 |
| 19 # sanity check: the empty addon should be here |
| 20 empty = os.path.join(here, 'empty') |
| 21 self.assertTrue(os.path.exists(empty)) |
| 22 self.assertTrue(os.path.isdir(empty)) |
| 23 self.assertTrue(os.path.exists(os.path.join(empty, 'install.rdf'))) |
| 24 |
| 25 # because we are testing data loss, let's make sure we make a copy |
| 26 tmpdir = tempfile.mktemp() |
| 27 shutil.copytree(empty, tmpdir) |
| 28 self.assertTrue(os.path.exists(os.path.join(tmpdir, 'install.rdf'))) |
| 29 |
| 30 # make a starter profile |
| 31 profile = mozprofile.FirefoxProfile() |
| 32 path = profile.profile |
| 33 |
| 34 # make a new profile based on the old |
| 35 newprofile = mozprofile.FirefoxProfile(profile=path, addons=[tmpdir]) |
| 36 newprofile.cleanup() |
| 37 |
| 38 # the source addon *should* still exist |
| 39 self.assertTrue(os.path.exists(tmpdir)) |
| 40 self.assertTrue(os.path.exists(os.path.join(tmpdir, 'install.rdf'))) |
| 41 |
| 42 # remove vestiges |
| 43 shutil.rmtree(tmpdir) |
| 44 |
| 45 if __name__ == '__main__': |
| 46 unittest.main() |
OLD | NEW |