Skip to content

Commit

Permalink
Merge pull request #2528 from Kodiologist/pytest-refine
Browse files Browse the repository at this point in the history
Update `conftest.py`
  • Loading branch information
Kodiologist authored Nov 8, 2023
2 parents 99caa5f + 2d825aa commit dc3bed8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
matrix:
name-prefix: ['']
os: [ubuntu-latest]
python: [3.8, 3.9, '3.10', 3.11, 3.12-dev, pypy-3.10, pyodide]
python: [3.8, 3.9, '3.10', 3.11, 3.12, pypy-3.10, pyodide]
include:
# To keep the overall number of runs low, we test Windows and MacOS
# only on the latest CPython.
Expand Down
15 changes: 7 additions & 8 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import importlib
import os
from pathlib import Path

import pytest
import hy, pytest

NATIVE_TESTS = os.path.join("", "tests", "native_tests", "")
NATIVE_TESTS = Path.cwd() / "tests/native_tests"

# https://github.com/hylang/hy/issues/2029
os.environ.pop("HYSTARTUP", None)


def pytest_collect_file(parent, path):
def pytest_collect_file(file_path, parent):
if (
path.ext == ".hy"
and NATIVE_TESTS in path.dirname + os.sep
and path.basename != "__init__.hy"
file_path.suffix == ".hy"
and NATIVE_TESTS in file_path.parents
and file_path.name != "__init__.hy"
):
return pytest.Module.from_parent(parent, path=Path(path))
return pytest.Module.from_parent(parent, path=file_path)
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest >= 6
pytest >= 7

# documentation
Pygments == 2.15.1
Expand Down

0 comments on commit dc3bed8

Please sign in to comment.