Пример #1
0
Файл: proc.py Проект: ouzel/stem
  def test_get_cwd(self, readlink_mock):
    """
    Tests the get_cwd function with a given pid.
    """

    readlink_mock.side_effect = lambda param: {
      '/proc/24019/cwd': '/home/directory/TEST'
    }[param]

    self.assertEquals('/home/directory/TEST', proc.get_cwd(24019))
Пример #2
0
  def test_get_cwd(self):
    """
    Tests the get_cwd function with a given pid.
    """

    mocking.mock(os.readlink, mocking.return_for_args({
      ('/proc/24019/cwd',): '/home/directory/TEST'
    }), os)

    self.assertEquals('/home/directory/TEST', proc.get_cwd(24019))
Пример #3
0
    def test_get_cwd(self, readlink_mock):
        """
    Tests the get_cwd function with a given pid.
    """

        readlink_mock.side_effect = lambda param: {
            '/proc/24019/cwd': '/home/directory/TEST'
        }[param]

        self.assertEquals('/home/directory/TEST', proc.get_cwd(24019))
Пример #4
0
  def test_get_cwd(self):
    """
    Checks that stem.util.proc.get_cwd matches our tor instance's cwd.
    """

    if not proc.is_available():
      test.runner.skip(self, "(proc unavailable)")
      return
    elif not test.runner.get_runner().is_ptraceable():
      test.runner.skip(self, "(DisableDebuggerAttachment is set)")
      return

    runner = test.runner.get_runner()
    runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
    self.assertEquals(tor_cwd, proc.get_cwd(runner_pid))
Пример #5
0
    def test_get_cwd(self):
        """
    Checks that stem.util.proc.get_cwd matches our tor instance's cwd.
    """

        if not proc.is_available():
            test.runner.skip(self, "(proc unavailable)")
            return
        elif not test.runner.get_runner().is_ptraceable():
            test.runner.skip(self, "(DisableDebuggerAttachment is set)")
            return

        runner = test.runner.get_runner()
        runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
        self.assertEquals(tor_cwd, proc.get_cwd(runner_pid))