From 870c136469d41fb594be1d70bf901ad2776e74a0 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Sat, 16 Nov 2013 00:19:18 +0200 Subject: [PATCH 1/2] Add astor to install_requires. `hy --spy` fails on hy 0.9.11. $ hy --spy hy 0.9.11 => (type "hy") Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/hy/cmdline.py", line 68, in print_python_code import astor.codegen ImportError: No module named astor.codegen --- setup.py | 2 +- tests/test_bin.py | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/setup.py b/setup.py index e8e370e..1808022 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ long_description = """Hy is a Python <--> Lisp layer. It helps make things work nicer, and lets Python and the Hy lisp variant play nice together. """ -install_requires = ['rply>=0.7.0'] +install_requires = ['rply>=0.7.0', 'astor>=0.3'] if sys.version_info[:2] < (2, 7): install_requires.append('argparse>=1.2.1') install_requires.append('importlib>=1.0.2') diff --git a/tests/test_bin.py b/tests/test_bin.py index 155e06a..0eab72e 100644 --- a/tests/test_bin.py +++ b/tests/test_bin.py @@ -22,7 +22,6 @@ # DEALINGS IN THE SOFTWARE. import os import subprocess -import sys def run_cmd(cmd, stdin_data=None): @@ -116,10 +115,6 @@ def test_bin_hyc_missing_file(): def test_hy2py(): - # XXX Astor doesn't seem to support Python3 :( - if sys.version_info[0] == 3: - return - # and running this script this way doesn't work on Windows if os.name == "nt": return From 3e8941cdde01635890db524c4789f0640fe665c3 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Tue, 10 Dec 2013 18:59:06 +0200 Subject: [PATCH 2/2] Convert stdout and stderr to UTF-8 properly in the run_cmd helper. --- tests/test_bin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_bin.py b/tests/test_bin.py index 0eab72e..55a23b2 100644 --- a/tests/test_bin.py +++ b/tests/test_bin.py @@ -39,8 +39,8 @@ def run_cmd(cmd, stdin_data=None): # Read stdout and stderr otherwise if the PIPE buffer is full, we might # wait for ever… while p.poll() is None: - stdout += str(p.stdout.read()) - stderr += str(p.stderr.read()) + stdout += p.stdout.read().decode('utf-8') + stderr += p.stderr.read().decode('utf-8') return p.returncode, stdout, stderr