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"))
def test_is_installer(self): """ Test we can identify a correct installer """ if mozinfo.isLinux: self.assertTrue(mozinstall.is_installer(self.bz2)) if mozinfo.isWin: # test zip installer self.assertTrue(mozinstall.is_installer(self.zipfile)) # test exe installer self.assertTrue(mozinstall.is_installer(self.exe)) try: # test stub browser file # without pefile on the system this test will fail import pefile stub_exe = os.path.join(here, "build_stub", "firefox.exe") self.assertFalse(mozinstall.is_installer(stub_exe)) except ImportError: pass if mozinfo.isMac: self.assertTrue(mozinstall.is_installer(self.dmg))
def test_is_installer(self): """ Test we can identify a correct installer """ if mozinfo.isLinux: self.assertTrue(mozinstall.is_installer(self.bz2)) if mozinfo.isWin: # test zip installer self.assertTrue(mozinstall.is_installer(self.zipfile)) # test exe installer self.assertTrue(mozinstall.is_installer(self.exe)) if mozinfo.isMac: self.assertTrue(mozinstall.is_installer(self.dmg))
def download(self): url = self.config["thing_url"] fn = "thing." + url.split(".")[-1] self.download_file(self.config["thing_url"], file_name=fn) if mozinstall.is_installer(fn): self.install_dir = mozinstall.install(fn, "thing") else: self.install_dir = ""
def test_is_installer(self): """ Test we can identify a correct installer """ if mozinfo.isLinux: self.assertTrue(mozinstall.is_installer(self.bz2)) if mozinfo.isWin: # test zip installer self.assertTrue(mozinstall.is_installer(self.zipfile)) # test exe installer self.assertTrue(mozinstall.is_installer(self.exe)) # test stub browser file stub_exe = os.path.join(here, 'build_stub', 'firefox.exe') self.assertFalse(mozinstall.is_installer(stub_exe)) if mozinfo.isMac: self.assertTrue(mozinstall.is_installer(self.dmg))
def test_is_installer(self): """ Test we can identify a correct installer """ if mozinfo.isLinux: self.assertTrue(mozinstall.is_installer(self.bz2)) if mozinfo.isWin: # test zip installer self.assertTrue(mozinstall.is_installer(self.zipfile)) # test exe installer self.assertTrue(mozinstall.is_installer(self.exe)) try: # test stub browser file # without pefile on the system this test will fail import pefile # noqa stub_exe = os.path.join(here, 'build_stub', 'firefox.exe') self.assertFalse(mozinstall.is_installer(stub_exe)) except ImportError: pass if mozinfo.isMac: self.assertTrue(mozinstall.is_installer(self.dmg))
def prepare_application(self, binary): # Prepare the binary for the test run if mozinstall.is_installer(self.binary): install_path = tempfile.mkdtemp(".binary") print "Install build: %s" % self.binary self._folder = mozinstall.install(self.binary, install_path) self._application = mozinstall.get_binary(self._folder, self.options.application) else: if os.path.isdir(self.binary): self._folder = self.binary else: if sys.platform == "darwin": # Ensure that self._folder is the app bundle on OS X p = re.compile(".*\.app/") self._folder = p.search(self.binary).group() else: self._folder = os.path.dirname(self.binary) self._application = mozinstall.get_binary(self._folder, self.options.application)
def prepare_application(self, binary): # Prepare the binary for the test run if mozinstall.is_installer(self.binary): install_path = tempfile.mkdtemp(".binary") print "Install build: %s" % self.binary self._folder = mozinstall.install(self.binary, install_path) self._application = mozinstall.get_binary(self._folder, self.options.application) else: if os.path.isdir(self.binary): self._folder = self.binary else: if sys.platform == "darwin": # Ensure that self._folder is the app bundle on OS X p = re.compile('.*\.app/') self._folder = p.search(self.binary).group() else: self._folder = os.path.dirname(self.binary) self._application = mozinstall.get_binary(self._folder, self.options.application)
if self.options.screenshot_path: path = os.path.abspath(self.options.screenshot_path) if not os.path.isdir(path): os.makedirs(path) self.persisted["screenshotPath"] = path self.run_tests() except Exception, e: exception_type, exception, tb = sys.exc_info() traceback.print_exception(exception_type, exception, tb) finally: # Remove the build when it has been installed before if mozinstall.is_installer(self.binary): print "Uninstall build: %s" % self._folder mozinstall.uninstall(self._folder) self.remove_downloaded_addons() # Remove the temporarily cloned repository if self._repository: self._repository.remove() # If a test has been failed ensure that we exit with status 2 if self.last_failed_tests: raise errors.TestFailedException() class AddonsTestRun(TestRun):