Beispiel #1
0
 def test_install(self):
     # Get install directory.
     install_dir = install_test_helper.get_install_dir()
     # Override PYTHONPATH to only use the installed `pydrake` module.
     env_python_path = "PYTHONPATH"
     tool_env = dict(os.environ)
     tool_env[env_python_path] = \
         install_test_helper.get_python_site_packages_dir(install_dir)
     # Ensure we can import all user-visible modules.
     script = "import pydrake.all"
     install_test_helper.check_call(
         [install_test_helper.get_python_executable(), "-c", script],
         env=tool_env)
 def test_install(self):
     # Get install directory.
     install_dir = install_test_helper.get_install_dir()
     # Override PYTHONPATH to only use the installed `pydrake` module.
     env_python_path = "PYTHONPATH"
     tool_env = dict(os.environ)
     tool_env[env_python_path] = \
         install_test_helper.get_python_site_packages_dir(install_dir)
     # Ensure we can import all user-visible modules.
     script = "import pydrake.all"
     install_test_helper.check_call(
         [install_test_helper.get_python_executable(), "-c", script],
         env=tool_env
     )
 def testDrakeFindResourceOrThrowInInstall(self):
     # Override PYTHONPATH to only use the installed `pydrake` module.
     install_dir = install_test_helper.get_install_dir()
     env_python_path = "PYTHONPATH"
     tool_env = dict(os.environ)
     tool_env[env_python_path] = \
         install_test_helper.get_python_site_packages_dir(install_dir)
     data_folder = os.path.join(install_dir, "share", "drake")
     # Calling `pydrake.getDrakePath()` twice verifies that there
     # is no memory allocation issue in the C code.
     output_path = install_test_helper.check_output(
         [install_test_helper.get_python_executable(),
          "-c", "import pydrake; print(pydrake.getDrakePath());\
          import pydrake; print(pydrake.getDrakePath())"
          ],
         env=tool_env,
         ).strip()
     self.assertIn(data_folder, output_path)
 def testDrakeFindResourceOrThrowInInstall(self):
     # Override PYTHONPATH to only use the installed `pydrake` module.
     install_dir = install_test_helper.get_install_dir()
     env_python_path = "PYTHONPATH"
     tool_env = dict(os.environ)
     tool_env[env_python_path] = \
         install_test_helper.get_python_site_packages_dir(install_dir)
     data_folder = os.path.join(install_dir, "share", "drake")
     # Calling `pydrake.getDrakePath()` twice verifies that there
     # is no memory allocation issue in the C code.
     output_path = install_test_helper.check_output(
         [
             install_test_helper.get_python_executable(), "-c",
             "import pydrake; print(pydrake.getDrakePath());\
          import pydrake; print(pydrake.getDrakePath())"
         ],
         env=tool_env,
     ).strip()
     self.assertIn(data_folder, output_path)
 def test_check_output(self):
     python = install_test_helper.get_python_executable()
     output = install_test_helper.check_output([python, "--help"])
     self.assertIn('PYTHONPATH', output)
 def test_check_call(self):
     python = install_test_helper.get_python_executable()
     install_test_helper.check_call([python, "--help"])
 def test_run_and_kill(self):
     python = install_test_helper.get_python_executable()
     install_test_helper.run_and_kill([python, "-c",
                                      "import time; time.sleep(5)"], 0.5,
                                      from_install_dir=False)
 def test_get_python_executable(self):
     self.assertIn("python", install_test_helper.get_python_executable())
 def test_check_output(self):
     python = install_test_helper.get_python_executable()
     output = install_test_helper.check_output([python, "--help"])
     self.assertIn('PYTHONPATH', output)
 def test_check_call(self):
     python = install_test_helper.get_python_executable()
     install_test_helper.check_call([python, "--help"])
 def test_run_and_kill(self):
     python = install_test_helper.get_python_executable()
     install_test_helper.run_and_kill(
         [python, "-c", "import time; time.sleep(5)"],
         0.5,
         from_install_dir=False)
 def test_get_python_executable(self):
     self.assertIn("python", install_test_helper.get_python_executable())