Skip to content

Commit

Permalink
Support and require pytest 8.1 (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski authored Apr 3, 2024
1 parent d4ebd03 commit 5eda408
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@ jobs:
- uses: actions/checkout@v4
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python_version: "3.8"
- uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
with:
only_create_file: 1
dependency_type: minimum
- name: Run the unit tests
run: |
export PIP_CONSTRAINT="./contraints_file.txt"
hatch run test:nowarn || hatch run test:nowarn --lf
test_prereleases:
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ classifiers = [
keywords = ["testing", "documentation", "links", "html"]
requires-python = ">=3.8"
dependencies = [
"docutils",
"html5lib",
"nbconvert",
"nbformat",
"docutils>=0.20.1",
"html5lib>=1.1",
"nbconvert>=7.1",
"nbformat>=5.0.2",
"pytest >=7.0,<9",
"requests",
"requests >=2.22",
]

[[project.authors]]
Expand Down
9 changes: 4 additions & 5 deletions pytest_check_links/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,29 +78,28 @@ def pytest_configure(config: pytest.Config) -> None:
validate_extensions(config.option.links_ext)


def pytest_collect_file(path: Any, parent: pytest.Collector) -> CheckLinks | None:
def pytest_collect_file(file_path: Path, parent: pytest.Collector) -> CheckLinks | None:
"""Add pytest file collection filter."""
config = parent.config
ignore_links = config.option.check_links_ignore

if config.option.check_links:
requests_session = ensure_requests_session(config)
if path.ext.lower() in config.option.links_ext:
path_obj = Path(path)
if file_path.suffix.lower() in config.option.links_ext:
check_anchors = config.option.check_anchors
if hasattr(CheckLinks, "from_parent"):
return cast(
CheckLinks,
CheckLinks.from_parent(
parent,
path=path_obj,
path=file_path,
requests_session=requests_session,
check_anchors=check_anchors,
ignore_links=ignore_links,
),
)
return CheckLinks(
path=path_obj,
path=file_path,
parent=parent,
requests_session=requests_session,
check_anchors=check_anchors,
Expand Down

0 comments on commit 5eda408

Please sign in to comment.