Best Python code snippet using localstack_python
test_install.py
Source:test_install.py  
...8    mozinfo.isWin, reason='Bug 1157352 - New firefox.exe needed for mozinstall 1.12 and higher.')9def test_is_installer(request, get_installer):10    """Test that we can identify a correct installer."""11    if mozinfo.isLinux:12        assert mozinstall.is_installer(get_installer('tar.bz2'))13    if mozinfo.isWin:14        # test zip installer15        assert mozinstall.is_installer(get_installer('zip'))16        # test exe installer17        assert mozinstall.is_installer(get_installer('exe'))18        try:19            # test stub browser file20            # without pefile on the system this test will fail21            import pefile  # noqa22            stub_exe = request.node.fspath.dirpath('build_stub').join('firefox.exe').strpath23            assert not mozinstall.is_installer(stub_exe)24        except ImportError:25            pass26    if mozinfo.isMac:27        assert mozinstall.is_installer(get_installer('dmg'))28def test_invalid_source_error(get_installer):29    """Test that InvalidSource error is raised with an incorrect installer."""30    if mozinfo.isLinux:31        with pytest.raises(mozinstall.InvalidSource):32            mozinstall.install(get_installer('dmg'), 'firefox')33    elif mozinfo.isWin:34        with pytest.raises(mozinstall.InvalidSource):35            mozinstall.install(get_installer('tar.bz2'), 'firefox')36    elif mozinfo.isMac:37        with pytest.raises(mozinstall.InvalidSource):38            mozinstall.install(get_installer('tar.bz2'), 'firefox')39    # Test an invalid url handler40    with pytest.raises(mozinstall.InvalidSource):41        mozinstall.install('file://foo.bar', 'firefox')42@pytest.mark.skipif(43    mozinfo.isWin, reason='Bug 1157352 - New firefox.exe needed for mozinstall 1.12 and higher.')44def test_install(tmpdir, get_installer):45    """Test to install an installer."""46    if mozinfo.isLinux:47        installdir = mozinstall.install(get_installer('tar.bz2'), tmpdir.strpath)48        assert installdir == tmpdir.join('firefox').strpath49    elif mozinfo.isWin:50        installdir_exe = mozinstall.install(get_installer('exe'), tmpdir.join('exe').strpath)51        assert installdir_exe == tmpdir.join('exe', 'firefox').strpath52        installdir_zip = mozinstall.install(get_installer('zip'), tmpdir.join('zip').strpath)53        assert installdir_zip == tmpdir.join('zip', 'firefox').strpath54    elif mozinfo.isMac:55        installdir = mozinstall.install(get_installer('dmg'), tmpdir.strpath)56        assert installdir == tmpdir.realpath().join('Firefox Stub.app').strpath57        mounted_images = subprocess.check_output(['hdiutil', 'info']).decode('ascii')58        assert get_installer('dmg') not in mounted_images59if __name__ == '__main__':...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
