[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Only show newly added descriptor lines once
commit be11d89bf20d8c46bbc463b78fbca217bb8d4d42
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sat Dec 24 12:16:21 2016 -0800
Only show newly added descriptor lines once
Microdescriptors added a new field and our tests are notifying us about it.
This is all well and good, but since it notifies for *every* line it drowns out
the rest of our test output. We only need one example of the line so
suppressing the rest.
---
test/integ/descriptor/networkstatus.py | 4 ++--
test/util.py | 11 +++++++++--
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/test/integ/descriptor/networkstatus.py b/test/integ/descriptor/networkstatus.py
index e02f178..f4de8f5 100644
--- a/test/integ/descriptor/networkstatus.py
+++ b/test/integ/descriptor/networkstatus.py
@@ -46,7 +46,7 @@ class TestNetworkStatus(unittest.TestCase):
reported_flags.append(flag)
for line in router.get_unrecognized_lines():
- register_new_capability('Consensus Line', line)
+ register_new_capability('Consensus Line', line, suppression_token = line.split()[0])
# Sanity test that there's at least a hundred relays. If that's not the
# case then this probably isn't a real, complete tor consensus.
@@ -80,6 +80,6 @@ class TestNetworkStatus(unittest.TestCase):
reported_flags.append(flag)
for line in router.get_unrecognized_lines():
- register_new_capability('Microdescriptor Consensus Line', line)
+ register_new_capability('Microdescriptor Consensus Line', line, suppression_token = line.split()[0])
self.assertTrue(count > 100)
diff --git a/test/util.py b/test/util.py
index 88abce6..a3348be 100644
--- a/test/util.py
+++ b/test/util.py
@@ -83,6 +83,7 @@ STEM_BASE = os.path.sep.join(__file__.split(os.path.sep)[:-2])
# Store new capabilities (events, descriptor entries, etc.)
NEW_CAPABILITIES = []
+NEW_CAPABILITIES_SUPPRESSION_TOKENS = set()
# File extensions of contents that should be ignored.
@@ -292,15 +293,21 @@ def check_for_unused_tests(paths):
raise ValueError('Test modules are missing from our test/settings.cfg:\n%s' % '\n'.join(unused_tests))
-def register_new_capability(capability_type, msg):
+def register_new_capability(capability_type, msg, suppression_token = None):
"""
Register new capability found during the tests.
:param str capability_type: type of capability this is
:param str msg: description of what we found
+ :param str suppression_token: skip registration if this token's already been
+ provided
"""
- NEW_CAPABILITIES.append((capability_type, msg))
+ if suppression_token not in NEW_CAPABILITIES_SUPPRESSION_TOKENS:
+ NEW_CAPABILITIES.append((capability_type, msg))
+
+ if suppression_token:
+ NEW_CAPABILITIES_SUPPRESSION_TOKENS.add(suppression_token)
def _is_test_data(path):
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits