hy/conftest.py

15 lines
565 B
Python
Raw Normal View History

2017-04-26 23:00:11 +02:00
import _pytest
import hy
2017-07-17 22:34:39 +02:00
from hy._compat import PY3, PY35
2017-04-26 23:00:11 +02:00
def pytest_collect_file(parent, path):
if (path.ext == ".hy"
and "/tests/native_tests/" in path.dirname + "/"
and path.basename != "__init__.hy"
2017-07-17 22:34:39 +02:00
and not ("py3_only" in path.basename and not PY3)
and not ("py35_only" in path.basename and not PY35)):
2017-04-26 23:00:11 +02:00
m = _pytest.python.pytest_pycollect_makemodule(path, parent)
# Spoof the module name to avoid hitting an assertion in pytest.
m.name = m.name[:-len(".hy")] + ".py"
return m