diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /testing/mozbase/mozinstall/tests/test_is_installer.py | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/mozbase/mozinstall/tests/test_is_installer.py')
-rw-r--r-- | testing/mozbase/mozinstall/tests/test_is_installer.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/mozbase/mozinstall/tests/test_is_installer.py b/testing/mozbase/mozinstall/tests/test_is_installer.py new file mode 100644 index 0000000000..8cba4395af --- /dev/null +++ b/testing/mozbase/mozinstall/tests/test_is_installer.py @@ -0,0 +1,42 @@ +from __future__ import absolute_import + +import mozinfo +import mozinstall +import mozunit +import pytest + + +@pytest.mark.skipif( + mozinfo.isWin, + reason="Bug 1157352 - New firefox.exe needed for mozinstall 1.12 and higher.", +) +def test_is_installer(request, get_installer): + """Test that we can identify a correct installer.""" + if mozinfo.isLinux: + assert mozinstall.is_installer(get_installer("tar.bz2")) + + if mozinfo.isWin: + # test zip installer + assert mozinstall.is_installer(get_installer("zip")) + + # test exe installer + assert mozinstall.is_installer(get_installer("exe")) + + try: + # test stub browser file + # without pefile on the system this test will fail + import pefile # noqa + + stub_exe = ( + request.node.fspath.dirpath("build_stub").join("firefox.exe").strpath + ) + assert not mozinstall.is_installer(stub_exe) + except ImportError: + pass + + if mozinfo.isMac: + assert mozinstall.is_installer(get_installer("dmg")) + + +if __name__ == "__main__": + mozunit.main() |