Пример #1
0
    def test_cwd(self):
        """
    Checks that stem.util.proc.cwd matches our tor instance's cwd.
    """

        runner = test.runner.get_runner()
        runner_pid, tor_cwd = runner.get_pid(), runner.get_tor_cwd()
        self.assertEqual(tor_cwd, proc.cwd(runner_pid))
Пример #2
0
    def test_cwd(self, readlink_mock):
        """
    Tests the cwd function with a given pid.
    """

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

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

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

    self.assertEqual('/home/directory/TEST', proc.cwd(24019))
Пример #4
0
  def test_cwd(self):
    """
    Checks that stem.util.proc.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.assertEqual(tor_cwd, proc.cwd(runner_pid))