test_is_installer.py (1114B)
1 import mozinfo 2 import mozinstall 3 import mozunit 4 import pytest 5 6 7 @pytest.mark.skipif( 8 mozinfo.isWin, 9 reason="Bug 1157352 - New firefox.exe needed for mozinstall 1.12 and higher.", 10 ) 11 def test_is_installer(request, get_installer): 12 """Test that we can identify a correct installer.""" 13 14 assert mozinstall.is_installer(get_installer("tar.xz")) 15 assert mozinstall.is_installer(get_installer("zip")) 16 17 if mozinfo.isWin: 18 assert mozinstall.is_installer(get_installer("msix")) 19 20 # test exe installer 21 assert mozinstall.is_installer(get_installer("exe")) 22 23 try: 24 # test stub browser file 25 # without pefile on the system this test will fail 26 import pefile # noqa 27 28 stub_exe = ( 29 request.node.fspath.dirpath("build_stub").join("firefox.exe").strpath 30 ) 31 assert not mozinstall.is_installer(stub_exe) 32 except ImportError: 33 pass 34 35 if mozinfo.isMac or mozinfo.isLinux: 36 assert mozinstall.is_installer(get_installer("dmg")) 37 38 39 if __name__ == "__main__": 40 mozunit.main()