Parametrize test_bin_hy_byte_compile

This commit is contained in:
Kodi Arfer 2017-06-20 15:30:13 -07:00
parent 672c8a1637
commit 399e7628b4

View File

@ -9,6 +9,7 @@ import subprocess
import re
from hy._compat import PY3
from hy.importer import get_bytecode_path
import pytest
hy_dir = os.environ.get('HY_DIR', '')
@ -240,15 +241,14 @@ def test_bin_hy_no_main():
assert "This Should Still Work" in output
def test_bin_hy_byte_compile():
@pytest.mark.parametrize('can_byte_compile', [True, False])
@pytest.mark.parametrize('cmd_fmt', [
'hy {fpath}', 'hy -m {modname}', "hy -c '(import {modname})'"])
def test_bin_hy_byte_compile(can_byte_compile, cmd_fmt):
modname = "tests.resources.bin.bytecompile"
fpath = modname.replace(".", "/") + ".hy"
for can_byte_compile in [True, False]:
for cmd in ["hy " + fpath,
"hy -m " + modname,
"hy -c '(import {})'".format(modname)]:
cmd = cmd_fmt.format(**locals())
rm(get_bytecode_path(fpath))