make native tests run on Windows too
This commit is contained in:
parent
50c21ca38c
commit
20516cce79
@ -1,10 +1,13 @@
|
|||||||
import _pytest
|
import _pytest
|
||||||
import hy
|
import hy
|
||||||
|
import os
|
||||||
from hy._compat import PY3, PY35
|
from hy._compat import PY3, PY35
|
||||||
|
|
||||||
|
NATIVE_TESTS = os.path.join("", "tests", "native_tests", "")
|
||||||
|
|
||||||
def pytest_collect_file(parent, path):
|
def pytest_collect_file(parent, path):
|
||||||
if (path.ext == ".hy"
|
if (path.ext == ".hy"
|
||||||
and "/tests/native_tests/" in path.dirname + "/"
|
and NATIVE_TESTS in path.dirname + os.sep
|
||||||
and path.basename != "__init__.hy"
|
and path.basename != "__init__.hy"
|
||||||
and not ("py3_only" in path.basename and not PY3)
|
and not ("py3_only" in path.basename and not PY3)
|
||||||
and not ("py35_only" in path.basename and not PY35)):
|
and not ("py35_only" in path.basename and not PY35)):
|
||||||
|
@ -98,7 +98,7 @@ def import_file_to_module(module_name, fpath, loader=None):
|
|||||||
try:
|
try:
|
||||||
_ast = import_file_to_ast(fpath, module_name)
|
_ast = import_file_to_ast(fpath, module_name)
|
||||||
module = imp.new_module(module_name)
|
module = imp.new_module(module_name)
|
||||||
module.__file__ = fpath
|
module.__file__ = os.path.normpath(fpath)
|
||||||
code = ast_compile(_ast, fpath, "exec")
|
code = ast_compile(_ast, fpath, "exec")
|
||||||
if not os.environ.get('PYTHONDONTWRITEBYTECODE'):
|
if not os.environ.get('PYTHONDONTWRITEBYTECODE'):
|
||||||
try:
|
try:
|
||||||
@ -121,7 +121,7 @@ def import_file_to_module(module_name, fpath, loader=None):
|
|||||||
sys.modules[module_name] = module
|
sys.modules[module_name] = module
|
||||||
module.__name__ = module_name
|
module.__name__ = module_name
|
||||||
|
|
||||||
module.__file__ = fpath
|
module.__file__ = os.path.normpath(fpath)
|
||||||
if loader:
|
if loader:
|
||||||
module.__loader__ = loader
|
module.__loader__ = loader
|
||||||
if is_package(module_name):
|
if is_package(module_name):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user