当前位置: 首页>>代码示例>>Python>>正文


Python tools.spawn_process函数代码示例

本文整理汇总了Python中tests.tools.spawn_process函数的典型用法代码示例。如果您正苦于以下问题:Python spawn_process函数的具体用法?Python spawn_process怎么用?Python spawn_process使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了spawn_process函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_insiders_install

    def test_insiders_install(self):
        """Install visual studio insiders"""

        self.installed_path += '-insiders'
        self.desktop_filename = self.desktop_filename.replace('.desktop', '-insiders.desktop')
        self.command_args += ' --insiders'
        self.name += ' Insiders'

        self.child = spawn_process(self.command(self.command_args))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.expect_and_no_warn("\[I Accept.*\]")  # ensure we have a license question
        self.child.sendline("a")
        self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
        self.wait_and_close()

        # we have an installed launcher, added to the launcher and an icon file
        self.assertTrue(self.launcher_exists_and_is_pinned(self.desktop_filename))
        self.assert_exec_exists()
        self.assert_icon_exists()
        self.assert_exec_link_exists()

        # launch it, send SIGTERM and check that it exits fine
        proc = subprocess.Popen(self.command_as_list(self.exec_path), stdout=subprocess.DEVNULL,
                                stderr=subprocess.DEVNULL)

        self.check_and_kill_process([os.path.join(self.installed_path, 'code-insiders')],
                                    wait_before=self.TIMEOUT_START, send_sigkill=True)
        proc.wait(self.TIMEOUT_STOP)

        # ensure that it's detected as installed:
        self.child = spawn_process(self.command(self.command_args))
        self.expect_and_no_warn("Visual Studio Code Insiders is already installed.*\[.*\] ")
        self.child.sendline()
        self.wait_and_close()
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:35,代码来源:test_ide.py

示例2: test_default_install

    def test_default_install(self):
        """Install from scratch test case"""
        self.child = spawn_process(self.command('{} ide netbeans'.format(UMAKE)))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
        self.wait_and_close()

        logger.info("Installed, running...")

        # we have an installed launcher, added to the launcher and an icon file
        self.assertTrue(self.launcher_exists_and_is_pinned(self.desktop_filename))
        self.assert_exec_exists()
        self.assert_icon_exists()
        self.assert_exec_link_exists()

        # launch it, send SIGTERM and check that it exits fine
        proc = subprocess.Popen(self.command_as_list(self.exec_path), stdout=subprocess.DEVNULL,
                                stderr=subprocess.DEVNULL)

        self.check_and_kill_process(["java", self.installed_path], wait_before=self.TIMEOUT_START)
        proc.wait(self.TIMEOUT_STOP)

        # ensure that it's detected as installed:
        self.child = spawn_process(self.command('{} ide netbeans'.format(UMAKE)))
        self.expect_and_no_warn("Netbeans is already installed.*\[.*\] ")
        self.child.sendline()
        self.wait_and_close()
开发者ID:shanenelson,项目名称:ubuntu-make,代码行数:28,代码来源:test_ide.py

示例3: test_eap_install

    def test_eap_install(self):
        self.installed_path += '-eap'
        self.desktop_filename.replace('.desktop', '-eap.desktop')
        self.command_args += ' --eap'
        self.name += ' EAP'

        self.child = spawn_process(self.command(self.command_args))
        result = self.expect_and_no_warn(["ERROR: No EAP version available.*\[.*\]",
                                          "Choose installation path: {}".format(self.installed_path)])
        if result == 1:
            self.child.sendline("")
            self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
            self.wait_and_close()

            # we have an installed launcher, added to the launcher and an icon file
            self.assertTrue(self.launcher_exists_and_is_pinned(self.desktop_filename))
            self.assert_exec_exists()
            self.assert_icon_exists()
            self.assert_exec_link_exists()

            # launch it, send SIGTERM and check that it exits fine
            proc = subprocess.Popen(self.command_as_list(self.exec_path), stdout=subprocess.DEVNULL,
                                    stderr=subprocess.DEVNULL)

            self.check_and_kill_process(self.exec_path,
                                        wait_before=self.TIMEOUT_START, send_sigkill=True)
            proc.wait(self.TIMEOUT_STOP)

            # ensure that it's detected as installed:
            self.child = spawn_process(self.command(self.command_args))
            self.expect_and_no_warn("{} is already installed.*\[.*\] ".format(self.name))
            self.child.sendline()
            self.wait_and_close()
开发者ID:zepeiQin,项目名称:ubuntu-make,代码行数:33,代码来源:test_ide.py

示例4: test_beta_install

    def test_beta_install(self):
        """Install Atom from scratch test case"""
        self.installed_path += '-beta'
        self.desktop_filename = self.desktop_filename.replace('.desktop', '-beta.desktop')
        self.command_args += ' --beta'
        self.name += ' Beta'

        self.child = spawn_process(self.command(self.command_args))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
        self.wait_and_close()

        # we have an installed launcher, added to the launcher and an icon file
        self.assertTrue(self.launcher_exists_and_is_pinned(self.desktop_filename))
        self.assert_exec_exists()
        self.assert_icon_exists()
        self.assert_exec_link_exists()
        # Test if the apm symlink is added correctly:
        self.assertTrue(self.is_in_path(os.path.join(self.install_base_path, 'bin', 'apm')))

        # launch it, send SIGTERM and check that it exits fine
        proc = subprocess.Popen(self.command_as_list(self.exec_path), stdout=subprocess.DEVNULL,
                                stderr=subprocess.DEVNULL)

        self.check_and_kill_process(["atom", self.installed_path],
                                    wait_before=self.TIMEOUT_START, send_sigkill=True)
        proc.wait(self.TIMEOUT_STOP)

        # ensure that it's detected as installed:
        self.child = spawn_process(self.command(self.command_args))
        self.expect_and_no_warn("{} is already installed.*\[.*\] ".format(self.name))
        self.child.sendline()
        self.wait_and_close()
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:34,代码来源:test_ide.py

示例5: test_default_install

    def test_default_install(self):
        """Install visual studio from scratch test case"""

        self.child = spawn_process(self.command('{} web visual-studio-code'.format(UMAKE)))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.expect_and_no_warn("\[I Accept.*\]")  # ensure we have a license question
        self.child.sendline("a")
        self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
        self.wait_and_close()

        # we have an installed launcher, added to the launcher and an icon file
        self.assertTrue(self.launcher_exists_and_is_pinned(self.desktop_filename))
        self.assert_exec_exists()
        self.assert_icon_exists()

        # launch it, send SIGTERM and check that it exits fine
        proc = subprocess.Popen(self.command_as_list(self.exec_path), stdout=subprocess.DEVNULL,
                                stderr=subprocess.DEVNULL)

        self.check_and_kill_process(["Code", self.installed_path],
                                    wait_before=self.TIMEOUT_START, send_sigkill=True)
        proc.wait(self.TIMEOUT_STOP)

        # ensure that it's detected as installed:
        self.child = spawn_process(self.command('{} web visual-studio-code'.format(UMAKE)))
        self.expect_and_no_warn("Visual Studio Code is already installed.*\[.*\] ")
        self.child.sendline()
        self.wait_and_close()
开发者ID:pombredanne,项目名称:ubuntu-make,代码行数:29,代码来源:test_web.py

示例6: test_default_install

    def test_default_install(self):
        """Install from scratch test case"""
        self.child = spawn_process(self.command(self.command_args))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        result = self.return_and_wait_expect(["ERROR: No Stable version available.",
                                              "Installation done"], timeout=self.TIMEOUT_INSTALL_PROGRESS)
        if result == 0:
            self.assertTrue(self.name == 'GoLand')
        elif result == 1:
            # we have an installed launcher, added to the launcher and an icon file
            self.assertTrue(self.launcher_exists_and_is_pinned(self.desktop_filename))
            self.assert_exec_exists()
            self.assert_icon_exists()
            self.assert_exec_link_exists()

            # launch it, send SIGTERM and check that it exits fine
            proc = subprocess.Popen(self.command_as_list(self.exec_path), stdout=subprocess.DEVNULL,
                                    stderr=subprocess.DEVNULL)

            self.check_and_kill_process(["java", self.installed_path], wait_before=self.TIMEOUT_START)
            proc.wait(self.TIMEOUT_STOP)

            # ensure that it's detected as installed:
            self.child = spawn_process(self.command(self.command_args))
            self.expect_and_no_warn("{} is already installed.*\[.*\] ".format(self.name))
            self.child.sendline()
            self.wait_and_close()
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:28,代码来源:test_ide.py

示例7: test_default_swift_install

    def test_default_swift_install(self):
        """Install Swift from scratch test case"""
        if not self.in_container:
            self.example_prog_dir = tempfile.mkdtemp()
            self.additional_dirs.append(self.example_prog_dir)
            example_file = os.path.join(self.example_prog_dir, "Package.swift")
            open(example_file, "w").write("")
            os.mkdir(os.path.join(self.example_prog_dir, "Sources"))
            example_file = os.path.join(self.example_prog_dir, "Sources", "main.swift")
            open(example_file, "w").write(self.EXAMPLE_PROJECT)
            compile_command = ["bash", "-l", "-c", "swift build"]
        else:  # our mock expects getting that command parameter
            self.example_prog_dir = "/tmp"
            compile_command = ["bash", "-l", "swift build"]

        self.child = spawn_process(self.command('{} swift'.format(UMAKE)))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
        self.wait_and_close()

        self.assert_exec_exists()
        self.assertTrue(self.is_in_path(self.exec_path))
        resulting_binary = os.path.join(self.example_prog_dir, ".build", "debug", self.example_prog_dir.split('/')[-1])

        # compile a small project
        subprocess.check_call(self.command_as_list(compile_command), cwd=self.example_prog_dir)

        # run the compiled result
        output = subprocess.check_output(self.command(resulting_binary),
                                         cwd=self.example_prog_dir, shell=True).decode()\
            .replace('\r', '').replace('\n', '')

        self.assertEqual(output, "Hello, world!")
开发者ID:om26er,项目名称:ubuntu-make,代码行数:34,代码来源:test_swift.py

示例8: test_default_scala_install

    def test_default_scala_install(self):
        """Install Scala from scratch test case"""
        if not self.in_container:
            self.example_prog_dir = tempfile.mkdtemp()
            self.additional_dirs.append(self.example_prog_dir)
            example_file = os.path.join(self.example_prog_dir, "hello.scala")
            open(example_file, "w").write(self.EXAMPLE_PROJECT)
            compile_command = ["bash", "-l", "-c", "scala {}".format(example_file)]
        else:  # our mock expects getting that path
            compile_command = ["bash", "-l", "scala /tmp/hello.scala"]

        self.child = spawn_process(self.command('{} scala'.format(UMAKE)))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
        self.wait_and_close()

        self.assert_exec_exists()
        self.assertTrue(self.is_in_path(self.exec_path))

        # compile a small project
        output = subprocess.check_output(self.command_as_list(compile_command)).decode()

        if self.in_container:
            self.assertEqual(output, "hello, world\r\n")
        else:
            self.assertEqual(output, "hello, world\n")
开发者ID:pombredanne,项目名称:ubuntu-make,代码行数:27,代码来源:test_scala.py

示例9: test_lts_select_install

 def test_lts_select_install(self):
     """Install nodejs lts"""
     self.child = spawn_process(self.command('{} nodejs --lts').format(UMAKE))
     self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
     self.child.sendline("")
     self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
     self.wait_and_close()
开发者ID:jravetch,项目名称:ubuntu-make,代码行数:7,代码来源:test_nodejs.py

示例10: test_default_dart_install

    def test_default_dart_install(self):
        """Install dart editor from scratch test case"""
        self.child = spawn_process(self.command('{} dart flutter-sdk'.format(UMAKE)))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
        self.wait_and_close()

        # we have an installed launcher, added to the launcher and an icon file
        self.assert_exec_exists()
        self.assertTrue(self.is_in_path(self.exec_path))

        # ensure that it's detected as installed:
        self.child = spawn_process(self.command('{} dart flutter-sdk'.format(UMAKE)))
        self.expect_and_no_warn("Flutter SDK is already installed.*\[.*\] ")
        self.child.sendline()
        self.wait_and_close()
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:17,代码来源:test_dart.py

示例11: test_unavailable_language_select_install

    def test_unavailable_language_select_install(self):
        """Installing Firefox-dev in unavailable language should be rejected"""
        install_language = "ABCdwXYZ"
        self.child = spawn_process(self.command('{} web firefox-dev --lang={}'.format(UMAKE, install_language)))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.wait_and_close(expect_warn=True, exit_status=1)

        self.assertFalse(self.launcher_exists_and_is_pinned(self.desktop_filename))
开发者ID:pombredanne,项目名称:ubuntu-make,代码行数:9,代码来源:test_web.py

示例12: test_arg_language_select_install

 def test_arg_language_select_install(self):
     """Install firefox dev with language selected by --lang"""
     install_language = "bg"
     self.child = spawn_process(self.command('{} web firefox-dev --lang={}'.format(UMAKE, install_language)))
     self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
     self.child.sendline("")
     self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
     self.wait_and_close()
     self.verify_install(install_language)
开发者ID:pombredanne,项目名称:ubuntu-make,代码行数:9,代码来源:test_web.py

示例13: test_default_maven_install

    def test_default_maven_install(self):
        """Install Maven from scratch test case"""

        self.child = spawn_process(self.command('{} maven'.format(UMAKE)))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
        self.wait_and_close()

        self.assert_exec_exists()
        self.assertTrue(self.is_in_path(self.exec_path))
开发者ID:ubuntu,项目名称:ubuntu-make,代码行数:11,代码来源:test_maven.py

示例14: test_default_rust_install

    def test_default_rust_install(self):
        """Install Rust from scratch test case"""
        if not self.in_container:
            self.example_prog_dir = tempfile.mkdtemp()
            self.additional_dirs.append(self.example_prog_dir)
            example_file = os.path.join(self.example_prog_dir, "hello.rs")
            open(example_file, "w").write(self.EXAMPLE_PROJECT)
            # rust compile in pwd by default, do not pollute ubuntu make source code
            compile_command = ["bash", "-l", "-c", "rustc --out-dir {} {}".format(self.example_prog_dir, example_file)]
        else:  # our mock expects getting that path
            self.example_prog_dir = "/tmp"
            example_file = os.path.join(self.example_prog_dir, "hello.rs")
            # rust compile in pwd by default, do not pollute ubuntu make source code
            compile_command = ["bash", "-l", "rustc --out-dir {} {}".format(self.example_prog_dir, example_file)]
        resulting_binary = os.path.join(self.example_prog_dir, "hello")

        self.child = spawn_process(self.command('{} rust'.format(UMAKE)))
        self.expect_and_no_warn("Choose installation path: {}".format(self.installed_path))
        self.child.sendline("")
        self.expect_and_no_warn("Installation done", timeout=self.TIMEOUT_INSTALL_PROGRESS)
        self.wait_and_close()

        self.assert_exec_exists()
        self.assertTrue(self.is_in_path(self.exec_path))
        self.assertTrue(self.is_in_path(os.path.join(self.installed_path, "cargo", "bin", "cargo")))
        cmd_list = ["echo $LD_LIBRARY_PATH"]
        if not self.in_container:
            relogging_command = ["bash", "-l", "-c"]
            relogging_command.extend(cmd_list)
            cmd_list = relogging_command
        self.assertIn(os.path.join(self.installed_path, "rustc", "lib"),
                      subprocess.check_output(self.command_as_list(cmd_list)).decode("utf-8").strip().split(":"))

        # compile a small project
        subprocess.check_call(self.command_as_list(compile_command))

        # run the compiled result
        output = subprocess.check_output(self.command_as_list(resulting_binary)).decode()
        if self.in_container:
            self.assertEqual(output, "hello, world\r\n")
        else:
            self.assertEqual(output, "hello, world\n")
开发者ID:pombredanne,项目名称:ubuntu-make,代码行数:42,代码来源:test_rust.py

示例15: verify_install

    def verify_install(self, installed_language):
        # we have an installed launcher, added to the launcher, a dictionary file and an icon file
        self.assertTrue(self.launcher_exists_and_is_pinned(self.desktop_filename))
        self.assertTrue(self.language_file_exists(installed_language))
        self.assert_exec_exists()
        self.assert_icon_exists()

        # launch it, send SIGTERM and check that it exits fine
        proc = subprocess.Popen(self.command_as_list(self.exec_path), stdout=subprocess.DEVNULL,
                                stderr=subprocess.DEVNULL)

        self.check_and_kill_process(["firefox-dev", self.installed_path],
                                    wait_before=self.TIMEOUT_START, send_sigkill=True)
        proc.wait(self.TIMEOUT_STOP)

        # ensure that it's detected as installed:
        self.child = spawn_process(self.command('{} web firefox-dev'.format(UMAKE)))
        self.expect_and_no_warn("Firefox Dev is already installed.*\[.*\] ")
        self.child.sendline()
        self.wait_and_close()
开发者ID:pombredanne,项目名称:ubuntu-make,代码行数:20,代码来源:test_web.py


注:本文中的tests.tools.spawn_process函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。