[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Fix test.require.module



commit bf59c074a97c93e6788fe48fafbafea7e84ccbaa
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Jul 19 14:51:04 2020 -0700

    Fix test.require.module
    
    Oops, with python 3 our 'import module_name' literally imported a module by
    that name (always skipping tests with this check).
---
 stem/settings.cfg   | 8 ++++++--
 test/require.py     | 6 ++++--
 test/unit/manual.py | 6 +++---
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/stem/settings.cfg b/stem/settings.cfg
index c8cb29c9..b82abed8 100644
--- a/stem/settings.cfg
+++ b/stem/settings.cfg
@@ -103,6 +103,7 @@ manual.summary.LogMessageDomains Includes a domain when logging messages
 manual.summary.MaxUnparseableDescSizeToLog Size of the dedicated log for unparseable descriptors
 manual.summary.OutboundBindAddress Sets the IP used for connecting to tor
 manual.summary.OutboundBindAddressOR Make outbound non-exit connections originate from this address
+manual.summary.__OwningControllerProcess Terminate tor process if this pid is not present
 manual.summary.OutboundBindAddressExit Make outbound exit connections originate from this address
 manual.summary.PidFile Path for a file tor writes containing its process id
 manual.summary.ProtocolWarnings Toggles if protocol errors give warnings or not
@@ -110,6 +111,7 @@ manual.summary.RunAsDaemon Toggles if tor runs as a daemon process
 manual.summary.LogTimeGranularity limits granularity of log message timestamps
 manual.summary.TruncateLogFile Overwrites log file rather than appending when restarted
 manual.summary.SyslogIdentityTag Tag logs appended to the syslog as being from tor
+manual.summary.TCPProxy Proxy connections rather than connect directly to relays
 manual.summary.AndroidIdentityTag Tag when logging to android subsystem
 manual.summary.SafeLogging Toggles if logs are scrubbed of sensitive information
 manual.summary.User UID for the process when started
@@ -209,7 +211,6 @@ manual.summary.ClientUseIPv4 Allow IPv4 connections to guards and fetching conse
 manual.summary.ClientUseIPv6 Allow IPv6 connections to guards and fetching consensus
 manual.summary.ClientPreferIPv6DirPort Perfer relays with IPv6 when fetching consensus
 manual.summary.ClientPreferIPv6ORPort Prefer a guard's IPv6 rather than IPv4 endpoint
-manual.summary.ClientAutoIPv6ORPort Connect to IPv6 ORPorts when available
 manual.summary.PathsNeededToBuildCircuits Portion of relays to require information for before making circuits
 manual.summary.ClientBootstrapConsensusAuthorityDownloadInitialDelay Delay when bootstrapping before downloading descriptors from authorities
 manual.summary.ClientBootstrapConsensusFallbackDownloadInitialDelay Delay when bootstrapping before downloading descriptors from fallbacks
@@ -224,6 +225,7 @@ manual.summary.DormantCanceledByStartup Disable dormant mode when tor's restarte
 
 manual.summary.Address Overwrites address others will use to reach this relay
 manual.summary.AssumeReachable Skips reachability test at startup
+manual.summary.AssumeReachableIPv6 Skip IPv6 reachability test at startup
 manual.summary.BridgeRelay Act as a bridge
 manual.summary.BridgeDistribution Distribution method BrideDB should provide our address by
 manual.summary.ContactInfo Contact information for this relay
@@ -298,6 +300,7 @@ manual.summary.AuthDirInvalid Relays from which the valid flag is withheld
 manual.summary.AuthDirReject Relays to be dropped from the consensus
 manual.summary.AuthDirBadExitCCs Countries for which to flag all relays as bad exits
 manual.summary.AuthDirInvalidCCs Countries for which the valid flag is withheld
+manual.summary.AuthDirRejectRequestsUnderLoad Reject non-relay connections while under load
 manual.summary.AuthDirRejectCCs Countries for which relays aren't accepted into the consensus
 manual.summary.AuthDirListBadExits Toggles if we provide an opinion on bad exits
 manual.summary.AuthDirMaxServersPerAddr Limit on the number of relays accepted per ip
@@ -306,6 +309,7 @@ manual.summary.AuthDirGuardBWGuarantee Advertised rate necessary to be a guard
 manual.summary.AuthDirPinKeys Don't accept descriptors with conflicting identity keypairs
 manual.summary.AuthDirSharedRandomness Participates in shared randomness voting
 manual.summary.AuthDirTestEd25519LinkKeys Require proper Ed25519 key for the Running flag
+manual.summary.AuthDirTestReachability Check relay reachability prior to granting a Running flag
 manual.summary.BridgePassword Password for requesting bridge information
 manual.summary.V3AuthVotingInterval Consensus voting interval
 manual.summary.V3AuthVoteDelay Wait time to collect votes of other authorities
@@ -326,6 +330,7 @@ manual.summary.HiddenServiceVersion Version for published hidden service descrip
 manual.summary.HiddenServiceAuthorizeClient Restricts access to the hidden service
 manual.summary.HiddenServiceAllowUnknownPorts Allow rendezvous circuits on unrecognized ports
 manual.summary.HiddenServiceExportCircuitID Exposes incoming client circuits via the given protocol
+manual.summary.HiddenServiceOnionBalanceInstance Flag this service as an OnionBalance instance
 manual.summary.HiddenServiceMaxStreams Maximum streams per rendezvous circuit
 manual.summary.HiddenServiceMaxStreamsCloseCircuit Closes rendezvous circuits that exceed the maximum number of streams
 manual.summary.RendPostPeriod Period at which the rendezvous service descriptors are refreshed
@@ -358,7 +363,6 @@ manual.summary.TestingV3AuthInitialVoteDelay Overrides TestingV3AuthInitialVoteD
 manual.summary.TestingV3AuthInitialDistDelay Overrides TestingV3AuthInitialDistDelay for the first consensus
 manual.summary.TestingV3AuthVotingStartOffset Offset for the point at which the authority votes
 manual.summary.TestingAuthDirTimeToLearnReachability Delay until opinions are given about which relays are running or not
-manual.summary.TestingEstimatedDescriptorPropagationTime Delay before clients attempt to fetch descriptors from directory caches
 manual.summary.TestingMinFastFlagThreshold Minimum value for the Fast flag
 manual.summary.TestingServerDownloadInitialDelay Delay before downloading resources for relaying
 manual.summary.TestingClientDownloadInitialDelay Delay before downloading resources for client usage
diff --git a/test/require.py b/test/require.py
index 8054bfad..ff185073 100644
--- a/test/require.py
+++ b/test/require.py
@@ -21,6 +21,8 @@ run.
   +- online - skips unless targets allow for online tests
 """
 
+import importlib
+
 import stem.util.system
 import stem.version
 import test
@@ -105,9 +107,9 @@ def module(module_name):
   """
 
   try:
-    import module_name
+    importlib.import_module(module_name)
     available = True
-  except ImportError:
+  except:
     available = False
 
   return needs(lambda: available, '%s unavailable' % module_name)
diff --git a/test/unit/manual.py b/test/unit/manual.py
index 26cb83d8..9d842972 100644
--- a/test/unit/manual.py
+++ b/test/unit/manual.py
@@ -91,8 +91,8 @@ def _cached_manual():
 class TestManual(unittest.TestCase):
   @test.require.module('sqlite3')
   def test_query(self):
-    self.assertEqual("If set, this option overrides the default location and file name for Tor's cookie file. (See CookieAuthentication above.)", stem.manual.query('SELECT description FROM torrc WHERE name="CookieAuthFile"').fetchone()[0])
-    self.assertEqual("If set, this option overrides the default location and file name for Tor's cookie file. (See CookieAuthentication above.)", stem.manual.query('SELECT description FROM torrc WHERE name=?', 'CookieAuthFile').fetchone()[0])
+    self.assertEqual("If set, this option overrides the default location and file name for Tor's cookie file. (See CookieAuthentication.)", stem.manual.query('SELECT description FROM torrc WHERE name="CookieAuthFile"').fetchone()[0])
+    self.assertEqual("If set, this option overrides the default location and file name for Tor's cookie file. (See CookieAuthentication.)", stem.manual.query('SELECT description FROM torrc WHERE name=?', 'CookieAuthFile').fetchone()[0])
 
   @test.require.module('sqlite3')
   def test_query_on_failure(self):
@@ -244,7 +244,7 @@ class TestManual(unittest.TestCase):
   @patch('stem.manual.open', Mock(side_effect = IOError('unable to write to file')), create = True)
   @patch('stem.util.system.is_available', Mock(return_value = True))
   def test_download_man_page_when_unable_to_write(self):
-    exc_msg = "Unable to download tor's manual from https://gitweb.torproject.org/tor.git/plain/doc/tor.1.txt to /no/such/path/tor.1.txt: unable to write to file"
+    exc_msg = "Unable to download tor's manual from https://gitweb.torproject.org/tor.git/plain/doc/man/tor.1.txt to /no/such/path/tor.1.txt: unable to write to file"
     self.assertRaisesWith(IOError, exc_msg, stem.manual.download_man_page, '/tmp/no_such_file')
 
   @patch('tempfile.TemporaryDirectory', Mock(return_value = TEMP_DIR_MOCK))

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits