[tor-bugs] #9087 [Core Tor/Chutney]: Move network tests out of TorNet.py

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Jul 1 14:16:28 UTC 2016


#9087: Move network tests out of TorNet.py
------------------------------+------------------------------
 Reporter:  ln5               |          Owner:  chobe
     Type:  enhancement       |         Status:  needs_review
 Priority:  Medium            |      Milestone:
Component:  Core Tor/Chutney  |        Version:
 Severity:  Normal            |     Resolution:
 Keywords:                    |  Actual Points:
Parent ID:                    |         Points:
 Reviewer:                    |        Sponsor:
------------------------------+------------------------------
Changes (by cypherpunks):

 * status:  needs_revision => needs_review


Comment:

 I have gone ahead and rebased the patch on the current master. Because the
 `verify` function in `Tornet.py` was extended between the latest patch and
 now, i reimported the code into the verify script. Assuming the patch is
 applied in a separate branch, you can verify the code move with

 {{{
 diff -u -w <(git show master:lib/chutney/TorNet.py | sed -n '906,1097p')
 scripts/chutney_tests/verify.py
 }}}
 which selects the appropriate lines and diffs them with the verify script.
 As you can see, small changes had to be made for it to work properly.

 I also made other small changes which should make the change more robust.
 1. changed the README addition to improve its readability.
 2. used `import_module` instead of `__import__` because it's the
 recommended way of importing modules according to the official
 [https://docs.python.org/2.7/library/functions.html?highlight=__import__#__import__
 documentation].
 3. detect when the test script has no `run_test(network)` function and
 alert the user.

 FWIW this implementation takes preference to the test scripts instead of
 the commands which means that when a test script is called `start`,
 `configure`, etc. it will overwrite the commands. Maybe this should be
 prevented in the code or documented somewhere. I don't have a strong
 opinion on either case.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9087#comment:7>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list