[tor-commits] [stem/master] Drop exec_documentation_example helper

atagar at torproject.org atagar at torproject.org
Fri Oct 2 23:16:05 UTC 2020


commit 8f5cf5bf4a4226bc6ff532ef7f642dc39ee942d2
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Sep 27 16:16:45 2020 -0700

    Drop exec_documentation_example helper
    
    Previously tests used compile() to run our examples rather than adjusting our
    path. Both approaches work but what we have now is a tad simpler.
---
 test/unit/tutorial.py | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/test/unit/tutorial.py b/test/unit/tutorial.py
index 472285ad..f35a6b6d 100644
--- a/test/unit/tutorial.py
+++ b/test/unit/tutorial.py
@@ -3,11 +3,9 @@ Tests for the examples given in stem's tutorial.
 """
 
 import io
-import os
 import unittest
 
 import stem.descriptor.remote
-import test
 
 from unittest.mock import Mock, patch
 
@@ -15,7 +13,6 @@ from stem.control import Controller
 from stem.descriptor.router_status_entry import RouterStatusEntryV3
 from stem.descriptor.networkstatus import NetworkStatusDocumentV3
 from stem.descriptor.server_descriptor import RelayDescriptor
-from stem.exit_policy import ExitPolicy
 
 OVER_THE_RIVER_OUTPUT = """\
  * Connecting to tor
@@ -31,14 +28,6 @@ MIRROR_MIRROR_OUTPUT = """\
 """
 
 
-def exec_documentation_example(filename):
-  path = os.path.join(test.STEM_BASE, 'docs', '_static', 'example', filename)
-
-  with open(path) as f:
-    code = compile(f.read(), path, 'exec')
-    exec(code)
-
-
 class TestTutorial(unittest.TestCase):
   def tearDown(self):
     # Ensure we don't cache a Mock object as our downloader. Otherwise future





More information about the tor-commits mailing list