[tor-commits] [stem/master] Stub example directory tests
atagar at torproject.org
atagar at torproject.org
Fri Oct 2 23:16:05 UTC 2020
commit 4451830442de64596c89e9d289718ebc03313e2c
Author: Damian Johnson <atagar at torproject.org>
Date: Sun Sep 20 15:02:11 2020 -0700
Stub example directory tests
Code within our example directory are untested. Stubbing a test module to
remedy that.
---
docs/_static/example/relay_connections.py | 0
test/settings.cfg | 1 +
test/unit/doctest.py | 2 +-
test/unit/examples.py | 173 ++++++++++++++++++++++++++++++
4 files changed, 175 insertions(+), 1 deletion(-)
diff --git a/docs/_static/example/relay_connections.py b/docs/_static/example/relay_connections.py
old mode 100755
new mode 100644
diff --git a/test/settings.cfg b/test/settings.cfg
index b1d26d92..a7bf1e1c 100644
--- a/test/settings.cfg
+++ b/test/settings.cfg
@@ -314,6 +314,7 @@ test.unit_tests
|test.unit.interpreter.autocomplete.TestAutocompletion
|test.unit.interpreter.help.TestHelpResponses
|test.unit.interpreter.commands.TestInterpreterCommands
+|test.unit.examples.TestExamples
|test.unit.doctest.TestDocumentation
test.integ_tests
diff --git a/test/unit/doctest.py b/test/unit/doctest.py
index 791e98b4..f72d845f 100644
--- a/test/unit/doctest.py
+++ b/test/unit/doctest.py
@@ -1,5 +1,5 @@
"""
-Tests examples from our documentation.
+Test inline examples from our documentation.
"""
import doctest
diff --git a/test/unit/examples.py b/test/unit/examples.py
new file mode 100644
index 00000000..ee59a137
--- /dev/null
+++ b/test/unit/examples.py
@@ -0,0 +1,173 @@
+"""
+Exercise the code in our examples directory.
+"""
+
+import os
+import sys
+import unittest
+
+import stem.util.system
+import test
+
+
+class TestExamples(unittest.TestCase):
+ def setUp(self):
+ self.original_path = list(sys.path)
+ self.example_dir = os.path.join(test.STEM_BASE, 'docs', '_static', 'example')
+
+ sys.path.append(self.example_dir)
+
+ def tearDown(self):
+ sys.path = self.original_path
+
+ def test_runs_everything(self):
+ """
+ Ensure we have tests for all our examples.
+ """
+
+ all_examples = set([os.path.basename(path)[:-3] for path in stem.util.system.files_with_suffix(self.example_dir, '.py')])
+ tested_examples = set([method[5:] for method in dir(self) if method.startswith('test_') and method != 'test_runs_everything'])
+
+ extra = sorted(tested_examples.difference(all_examples))
+ missing = sorted(all_examples.difference(tested_examples))
+
+ if extra:
+ self.fail("Changed our examples directory? We test the following which are not present: %s" % ', '.join(extra))
+
+ if missing:
+ self.fail("Changed our examples directory? The following are untested: %s" % ', '.join(missing))
+
+ def test_bandwidth_stats(self):
+ pass
+
+ def test_benchmark_server_descriptor_stem(self):
+ pass
+
+ def test_benchmark_stem(self):
+ pass
+
+ def test_broken_listener(self):
+ pass
+
+ def test_check_digests(self):
+ pass
+
+ def test_client_usage_using_pycurl(self):
+ pass
+
+ def test_client_usage_using_socksipy(self):
+ pass
+
+ def test_collector_caching(self):
+ pass
+
+ def test_collector_reading(self):
+ pass
+
+ def test_compare_flags(self):
+ pass
+
+ def test_create_descriptor(self):
+ pass
+
+ def test_create_descriptor_content(self):
+ pass
+
+ def test_current_descriptors(self):
+ pass
+
+ def test_custom_path_selection(self):
+ pass
+
+ def test_descriptor_from_orport(self):
+ pass
+
+ def test_descriptor_from_tor_control_socket(self):
+ pass
+
+ def test_descriptor_from_tor_data_directory(self):
+ pass
+
+ def test_download_descriptor(self):
+ pass
+
+ def test_ephemeral_hidden_services(self):
+ pass
+
+ def test_event_listening(self):
+ pass
+
+ def test_exit_used(self):
+ pass
+
+ def test_fibonacci_multiprocessing(self):
+ pass
+
+ def test_fibonacci_threaded(self):
+ pass
+
+ def test_get_hidden_service_descriptor(self):
+ pass
+
+ def test_hello_world(self):
+ pass
+
+ def test_introduction_points(self):
+ pass
+
+ def test_list_circuits(self):
+ pass
+
+ def test_load_test(self):
+ pass
+
+ def test_manual_config_options(self):
+ pass
+
+ def test_outdated_relays(self):
+ pass
+
+ def test_persisting_a_consensus(self):
+ pass
+
+ def test_persisting_a_consensus_with_parse_file(self):
+ pass
+
+ def test_queue_listener(self):
+ pass
+
+ def test_read_with_parse_file(self):
+ pass
+
+ def test_reading_twitter(self):
+ pass
+
+ def test_relay_connections(self):
+ pass
+
+ def test_resuming_ephemeral_hidden_service(self):
+ pass
+
+ def test_running_hidden_service(self):
+ pass
+
+ def test_saving_and_loading_descriptors(self):
+ pass
+
+ def test_slow_listener(self):
+ pass
+
+ def test_tor_descriptors(self):
+ pass
+
+ def test_utilities(self):
+ pass
+
+ def test_validate_descriptor_content(self):
+ pass
+
+ def test_votes_by_bandwidth_authorities(self):
+ pass
+
+ def test_words_with(self):
+ pass
More information about the tor-commits
mailing list