Merge pull request #1825 from refi64/test-import

Fix a unit test bug on slim Python Docker images
This commit is contained in:
Ryan Gonzalez 2019-10-13 14:10:39 -05:00 committed by GitHub
commit 8d7775c0a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -31,6 +31,8 @@ Bug Fixes
* Fixed the expression of a while loop that contains statements being compiled twice.
* `hy2py` can now handle format strings.
* Fixed crashes from inaccessible history files.
* The unit tests no longer unintentionally import the internal Python module "test".
This allows them to pass when run inside the "slim" Python Docker images.
0.17.0
==============================

View File

@ -6,6 +6,7 @@ import ast
from hy import compiler
from hy.models import HyExpression, HyList, HySymbol, HyInteger
import types
def make_expression(*args):
@ -25,7 +26,7 @@ def test_compiler_bare_names():
HySymbol("a"),
HySymbol("b"),
HySymbol("c"))
ret = compiler.HyASTCompiler('test').compile(e)
ret = compiler.HyASTCompiler(types.ModuleType('test')).compile(e)
# We expect two statements and a final expr.
@ -54,7 +55,7 @@ def test_compiler_yield_return():
HyExpression([HySymbol("+"),
HyInteger(1),
HyInteger(1)]))
ret = compiler.HyASTCompiler('test').compile_atom(e)
ret = compiler.HyASTCompiler(types.ModuleType('test')).compile_atom(e)
assert len(ret.stmts) == 1
stmt, = ret.stmts