[tor-commits] [nyx/master] Standardizing on unicode for curses.screenshot()

atagar at torproject.org atagar at torproject.org
Sun Aug 28 18:29:22 UTC 2016


commit 14fed296185fb6e4c2e5cbf43707ef44fb0bba84
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Aug 28 10:02:05 2016 -0700

    Standardizing on unicode for curses.screenshot()
    
    Lowest hanging fruit for getting our tests python 3.x compatible, this reduces
    failures as follows...
    
      from: FAILED (failures=53, errors=15)
      to: FAILED (failures=3, errors=15)
---
 nyx/curses.py  |  2 +-
 test/popups.py | 68 +++++++++++++++++++++++++++++-----------------------------
 2 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/nyx/curses.py b/nyx/curses.py
index 27cfbfc..922729c 100644
--- a/nyx/curses.py
+++ b/nyx/curses.py
@@ -479,7 +479,7 @@ def screenshot():
   for y in range(screen_size().height):
     lines.append(CURSES_SCREEN.instr(y, 0).rstrip())
 
-  return '\n'.join(lines).rstrip()
+  return stem.util.str_tools._to_unicode(b'\n'.join(lines).rstrip())
 
 
 def asci_to_curses(msg):
diff --git a/test/popups.py b/test/popups.py
index 02dc6a1..12ce3ef 100644
--- a/test/popups.py
+++ b/test/popups.py
@@ -161,6 +161,40 @@ Event Types:-------------------------------------------------------------------+
 +------------------------------------------------------------------------------+
 """.strip()
 
+EXPECTED_DESCRIPTOR_WITHOUT_FINGERPRINT = """
+Consensus Descriptor:----------+
+|  No consensus data available |
++------------------------------+
+""".strip()
+
+EXPECTED_DESCRIPTOR = """
+Consensus Descriptor (29787760145CD1A473552A2FC64C72A9A130820E):---------------+
+|  1 Consensus:                                                                |
+|  2                                                                           |
+|  3 r cyberphunk KXh3YBRc0aRzVSovxkxyqaEwgg4 VjdJThHuYj0jDY2tkkDJkCa8s1s      |
+|    2016-04-04 19:03:16 94.23.150.191 8080 0                                  |
+|  4 s Fast Guard Running Stable Valid                                         |
+|  5 w Bandwidth=8410                                                          |
+|  6 p reject 1-65535                                                          |
+|  7                                                                           |
+|  8 Server Descriptor:                                                        |
+|  9                                                                           |
+| 10 router cyberphunk 94.23.150.191 8080 0 0                                  |
+| 11 platform Tor 0.2.4.27 on Linux                                            |
+| 12 protocols Link 1 2 Circuit 1                                              |
+| 13 published 2016-04-04 19:03:16                                             |
+| 14 fingerprint 2978 7760 145C D1A4 7355 2A2F C64C 72A9 A130 820E             |
+| 15 uptime 3899791                                                            |
+| 16 bandwidth 10240000 10444800 6482376                                       |
+| 17 extra-info-digest 9DC532664DDFD238A4119D623D30F136A3B851BF                |
+| 18 reject *:*                                                                |
+| 19 router-signature                                                          |
+| 20 -----BEGIN SIGNATURE-----                                                 |
+| 21 EUFm38gONCoDuY7ZWHyJtBKuvk6Xi1MPuKuecS5frP3fX0wiZSrOVcpX0X8J+4Hr          |
+| 22 Fb5i+yuMIAXeEn6UhtjqhhZBbY9PW9GdZOMTH8hJpG+evURyr+10PZq6UElg86rA          |
++------------------------------------------------------------------------------+
+""".strip()
+
 TORRC = """
 ControlPort 9051
 CookieAuthentication 1
@@ -208,40 +242,6 @@ NCGI042p6+7UgCVT1x3WcLnq3ScV//s1wXHrUXa7vi0=
 -----END SIGNATURE-----
 """.strip().split('\n')
 
-EXPECTED_DESCRIPTOR_WITHOUT_FINGERPRINT = """
-Consensus Descriptor:----------+
-|  No consensus data available |
-+------------------------------+
-""".strip()
-
-EXPECTED_DESCRIPTOR = """
-Consensus Descriptor (29787760145CD1A473552A2FC64C72A9A130820E):---------------+
-|  1 Consensus:                                                                |
-|  2                                                                           |
-|  3 r cyberphunk KXh3YBRc0aRzVSovxkxyqaEwgg4 VjdJThHuYj0jDY2tkkDJkCa8s1s      |
-|    2016-04-04 19:03:16 94.23.150.191 8080 0                                  |
-|  4 s Fast Guard Running Stable Valid                                         |
-|  5 w Bandwidth=8410                                                          |
-|  6 p reject 1-65535                                                          |
-|  7                                                                           |
-|  8 Server Descriptor:                                                        |
-|  9                                                                           |
-| 10 router cyberphunk 94.23.150.191 8080 0 0                                  |
-| 11 platform Tor 0.2.4.27 on Linux                                            |
-| 12 protocols Link 1 2 Circuit 1                                              |
-| 13 published 2016-04-04 19:03:16                                             |
-| 14 fingerprint 2978 7760 145C D1A4 7355 2A2F C64C 72A9 A130 820E             |
-| 15 uptime 3899791                                                            |
-| 16 bandwidth 10240000 10444800 6482376                                       |
-| 17 extra-info-digest 9DC532664DDFD238A4119D623D30F136A3B851BF                |
-| 18 reject *:*                                                                |
-| 19 router-signature                                                          |
-| 20 -----BEGIN SIGNATURE-----                                                 |
-| 21 EUFm38gONCoDuY7ZWHyJtBKuvk6Xi1MPuKuecS5frP3fX0wiZSrOVcpX0X8J+4Hr          |
-| 22 Fb5i+yuMIAXeEn6UhtjqhhZBbY9PW9GdZOMTH8hJpG+evURyr+10PZq6UElg86rA          |
-+------------------------------------------------------------------------------+
-""".strip()
-
 
 class TestPopups(unittest.TestCase):
   @require_curses





More information about the tor-commits mailing list