-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patches for test suite for Win10 #1973
Conversation
4 out of 14 patched
Ok, 4 down, the others left. The first few ones seem to be important: #====================================================== FAILURES =======================================================
#_________________________________________ test_bin_hy_circular_macro_require __________________________________________
def test_bin_hy_circular_macro_require():
"""Confirm that macros can require themselves during expansion and when
run from the command line."""
# First, with no bytecode
test_file = "tests/resources/bin/circular_macro_require.hy"
rm(cache_from_source(test_file))
assert not os.path.exists(cache_from_source(test_file))
output, _ = run_cmd("hy {}".format(test_file))
assert "42" == output.strip()
# E AssertionError: assert '42' == '42\n42'
# E - 42
# E 42
# tests\test_bin.py:474: AssertionError
#__________________________________________________ test_hy2py_import __________________________________________________
tmpdir = local('C:\\Users\\Ace\\AppData\\Local\\Temp\\pytest-of-Ace\\pytest-30\\test_hy2py_import0')
def test_hy2py_import(tmpdir):
import subprocess
python_code = subprocess.check_output(
["hy2py", "tests/resources/pydemo.hy"]).decode("UTF-8")
# E UnicodeDecodeError: 'utf-8' codec can't decode byte 0x97 in position 490: invalid start byte
#tests\test_hy2py.py:18: UnicodeDecodeError
#______________________________________________ test_import_autocompiles _______________________________________________
@pytest.mark.skipif(sys.dont_write_bytecode,
reason="Bytecode generation is suppressed")
def test_import_autocompiles():
"Test that (import) byte-compiles the module."
with tempfile.NamedTemporaryFile(suffix='.hy', delete=True) as f:
f.write(b'(defn pyctest [s] (+ "X" s "Y"))')
f.flush()
pyc_path = importlib.util.cache_from_source(f.name)
try:
os.remove(pyc_path)
except (IOError, OSError):
pass
test_loader = HyLoader("mymodule", f.name).load_module()
#tests\importer\test_importer.py:107:
#_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#<frozen importlib._bootstrap_external>:469: in _check_name_wrapper
# ???
#<frozen importlib._bootstrap_external>:969: in load_module
# ???
#<frozen importlib._bootstrap_external>:794: in load_module
# ???
#<frozen importlib._bootstrap>:274: in _load_module_shim
# ???
#<frozen importlib._bootstrap>:711: in _load
# ???
#<frozen importlib._bootstrap>:680: in _load_unlocked
# ???
#<frozen importlib._bootstrap_external>:786: in exec_module
# ???
#<frozen importlib._bootstrap_external>:922: in get_code
# ???
#_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#self = <_frozen_importlib_external.SourceFileLoader object at 0x0000026045BE8B50>
#path = 'C:\\Users\\Ace\\AppData\\Local\\Temp\\tmp3ggloosr.hy'
#> ???
#E PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Ace\\AppData\\Local\\Temp\\tmp3ggloosr.hy'
#<frozen importlib._bootstrap_external>:979: PermissionError
#______________________________________________________ test_pyc _______________________________________________________
def test_pyc():
"""Test pyc compilation."""
with tempfile.NamedTemporaryFile(suffix='.hy') as f:
f.write(b'(defn pyctest [s] (+ "X" s "Y"))')
f.flush()
cfile = py_compile.compile(f.name)
#tests\importer\test_pyc.py:19:
#_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#..\..\..\appdata\local\programs\python\python39\lib\py_compile.py:142: in compile
# source_bytes = loader.get_data(file)
#_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#self = <_frozen_importlib_external.SourceFileLoader object at 0x0000026045BC19D0>
#path = 'C:\\Users\\Ace\\AppData\\Local\\Temp\\tmpyd_hfpsg.hy'
#> ???
#E PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Ace\\AppData\\Local\\Temp\\tmpyd_hfpsg.hy'
#<frozen importlib._bootstrap_external>:979: PermissionError This native test looks important as well: (defn test-doc [capsys]
(defmacro <-mangle-> []
"a fancy docstring"
'(+ 2 2))
(doc <-mangle->)
(setv [out err] (.readouterr capsys))
;; https://github.com/hylang/hy/issues/1946
(assert (.startswith (.strip out)
f"Help on function {(mangle '<-mangle->)} in module "))
(assert (in "a fancy docstring" out))
(assert (empty? err))
#doc @
; E NameError: name '__tags__' is not defined
; tests\native_tests\core.hy:713: NameError Otherwise these seem less important, since my guess is that windows newlines are at root. (defn test-basic-line-wrap []
(setv o (dict :RPM_cal 0
:RPM_cal2 48059
:Speed_cal 0
:controldesk_runtime_us 0
:main_code_runtime_us 0
:read_io_runtime_us 0
:write_io_runtime_us 43690)
exp #[[
{"RPM_cal" 0
"RPM_cal2" 48059
"Speed_cal" 0
"controldesk_runtime_us" 0
"main_code_runtime_us" 0
"read_io_runtime_us" 0
"write_io_runtime_us" 43690}]])
(assert (= (pprint.pformat o) exp))
; tests\native_tests\contrib\test_pprint.hy:78: AssertionError
(defn test-nested-indentations []
(setv o1 (list (range 10))
o2 (dict :first 1 :second 2 :third 3)
o [o1 o2]
exp #[FOO[
[ [0 1 2 3 4 5 6 7 8 9]
{"first" 1 "second" 2 "third" 3}]]FOO])
(assert (= (pprint.pformat o :indent 4 :width 39) exp))
; tests\native_tests\contrib\test_pprint.hy:102: AssertionError
(defn test-width []
(defclass set2 [set])
(setv exp #[FOO[
[[[[[[1 2 3]
"1 2"]]]]
{1 [1 2 3]
2 [12 34]}
"abc def ghi"
(, "ab cd ef")
#{1 23}
[[[[[1 2 3]
"1 2"]]]]]]FOO])
(setv o (eval (read-str exp)))
(assert (= (pprint.pformat o :width 16) exp))
; tests\native_tests\contrib\test_pprint.hy:125: AssertionError
(defn test-str-wrap []
(setv fox "the quick brown fox jumped over the lazy dog")
;; Level 1
(assert (= (pprint.pformat fox :width 20) #[[
; tests\native_tests\contrib\test_pprint.hy:165: AssertionError
(defn test-bytes-wrap []
"Check that multi-line pretty printed bytestrings
indent properly and prefer chunking in blocks of
length 4"
(setv letters b"abcdefghijklmnopqrstuvwxyz")
(assert (= (pprint.pformat letters :width 29) (hy-repr.hy-repr letters)))
(assert (= (pprint.pformat letters :width 22) #[[
; tests\native_tests\contrib\test_pprint.hy:185: AssertionError |
There's currently a bug with how pyc filesare generated with macros #1970. I'd try deleting all the |
@allison-casey can confirm that error goes away |
I'm closing this due to inactivity. Please reopen when you're ready to finish it. |
Currently: 3 out of 14 patched, more to come.