[tor-commits] [stem/master] Expanding header documentation

atagar at torproject.org atagar at torproject.org
Thu Oct 27 17:06:08 UTC 2011


commit f07c6cc77f4ad77b2390d03f9aad5f32aecd245e
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Oct 27 09:39:41 2011 -0700

    Expanding header documentation
    
    Adding a summary of a files functions/classes/methods at the top of the file.
    This makes using a library much nicer.
---
 stem/process.py        |    7 +++++--
 stem/types.py          |    3 ++-
 stem/util/__init__.py  |    2 +-
 test/integ/__init__.py |    2 +-
 test/integ/message.py  |    2 +-
 test/runner.py         |   12 ++++++++++++
 6 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/stem/process.py b/stem/process.py
index 934a9c1..0e22685 100644
--- a/stem/process.py
+++ b/stem/process.py
@@ -1,6 +1,9 @@
 """
 Helper functions for working with tor as a process. These are mostly os
 dependent, only working on linux, osx, and bsd.
+
+get_tor_version - gets the version of our system's tor installation
+launch_tor - starts up a tor process
 """
 
 import re
@@ -18,9 +21,9 @@ DEFAULT_INIT_TIMEOUT = 90
 # cache for the get_version function
 VERSION_CACHE = {}
 
-def get_version(tor_cmd = "tor"):
+def get_tor_version(tor_cmd = "tor"):
   """
-  Provides the version of tor.
+  Queries tor for its version.
   
   Arguments:
     tor_cmd (str) - command used to run tor
diff --git a/stem/types.py b/stem/types.py
index 630df9e..10b120b 100644
--- a/stem/types.py
+++ b/stem/types.py
@@ -291,5 +291,6 @@ class Version:
     
     return cmp(my_status, other_status)
 
-REQ_GETINFO_CONFIG_TEXT = get_version("0.2.2.7")
+# TODO: version requirements will probably be moved to another module later
+REQ_GETINFO_CONFIG_TEXT = get_version("0.2.2.7-alpha")
 
diff --git a/stem/util/__init__.py b/stem/util/__init__.py
index 3ddd48b..ef6730b 100644
--- a/stem/util/__init__.py
+++ b/stem/util/__init__.py
@@ -2,5 +2,5 @@
 Utility functions used by the stem library.
 """
 
-__all__ = ["conf", "enum", "system", "term"]
+__all__ = ["conf", "enum", "log", "system", "term"]
 
diff --git a/test/integ/__init__.py b/test/integ/__init__.py
index d6d7b31..718d40a 100644
--- a/test/integ/__init__.py
+++ b/test/integ/__init__.py
@@ -2,5 +2,5 @@
 Integration tests for the stem library.
 """
 
-__all__ = ["system"]
+__all__ = ["message", "system"]
 
diff --git a/test/integ/message.py b/test/integ/message.py
index 2f10ed4..531d4a2 100644
--- a/test/integ/message.py
+++ b/test/integ/message.py
@@ -140,7 +140,7 @@ class TestMessageFunctions(unittest.TestCase):
     Parses the 'GETINFO config-text' response.
     """
     
-    if stem.process.get_version() < stem.types.REQ_GETINFO_CONFIG_TEXT:
+    if stem.process.get_tor_version() < stem.types.REQ_GETINFO_CONFIG_TEXT:
       return
     
     # We can't be certain of the order, and there may be extra config-text
diff --git a/test/runner.py b/test/runner.py
index da65262..5565e3e 100644
--- a/test/runner.py
+++ b/test/runner.py
@@ -2,6 +2,18 @@
 Runtime context for the integration tests. This is used both by the test runner
 to start and stop tor, and by the integration tests themselves for information
 about the tor test instance they're running against.
+
+RunnerStopped - Runner doesn't have an active tor instance.
+
+get_runner - Singleton for fetching our runtime context.
+Runner - Runtime context for our integration tests.
+  |- start - prepares and starts a tor instance for our tests to run against
+  |- stop - stops our tor instance and cleans up any temporary files
+  |- is_running - checks if our tor test instance is running
+  |- get_torrc_path - path to our tor instance's torrc
+  |- get_torrc_contents - contents of our tor instance's torrc
+  |- get_control_port - port that our tor instance is listening on
+  +- get_pid - process id of our tor process
 """
 
 import os



More information about the tor-commits mailing list