Debian Codegraph @

testing/mozbase/mozinstall/tests/test_uninstall.py

raw
1 import mozinfo
2 import mozinstall
3 import mozunit
4 import py
5 import pytest
6
7
8 @pytest.mark.skipif(
9 mozinfo.isWin,
10 reason="Bug 1157352 - New firefox.exe needed for mozinstall 1.12 and higher.",
11 )
12 def test_uninstall(tmpdir, get_installer):
13 """Test to uninstall an installed binary."""
14 if mozinfo.isLinux:
15 installdir = mozinstall.install(get_installer("tar.xz"), tmpdir.strpath)
16 mozinstall.uninstall(installdir)
17 assert not py.path.local(installdir).check()
18
19 elif mozinfo.isWin:
20 installdir_exe = mozinstall.install(
21 get_installer("exe"), tmpdir.join("exe").strpath
22 )
23 mozinstall.uninstall(installdir_exe)
24 assert not py.path.local(installdir).check()
25
26 installdir_zip = mozinstall.install(
27 get_installer("zip"), tmpdir.join("zip").strpath
28 )
29 mozinstall.uninstall(installdir_zip)
30 assert not py.path.local(installdir).check()
31
32 elif mozinfo.isMac:
33 installdir = mozinstall.install(get_installer("dmg"), tmpdir.strpath)
34 mozinstall.uninstall(installdir)
35 assert not py.path.local(installdir).check()
36
37
38 if __name__ == "__main__":
39 mozunit.main()