Skip to content

Commit

Permalink
Fixes for the new mistune and pytest-lazy-fixtures.
Browse files Browse the repository at this point in the history
  • Loading branch information
haz committed Aug 13, 2024
1 parent 365756f commit d7400f0
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 62 deletions.
3 changes: 1 addition & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ click = ">=8.1.3,<9.0.0"
pytest = "*"
pytest-cov = "*"
pytest-randomly = "*"
pytest-lazy-fixture = "*"
pytest-lazy-fixtures = "*"
tox = "*"
ipython = "*"
codecov = "*"
Expand All @@ -31,7 +31,6 @@ pymdown-extensions = "*"
flake8-isort = "*"
safety = "*"
bandit = "*"
types-pytest-lazy-fixture = "*"

[requires]
python_version = "3.10"
63 changes: 16 additions & 47 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import mistune
import pytest
from pytest_lazyfixture import lazy_fixture
from pytest_lazy_fixtures import lf

import pddl
from pddl.parser.domain import DomainParser
Expand Down Expand Up @@ -111,14 +111,14 @@ def markdown_parser():
)

pddl_objects_domains = [
lazy_fixture("blocksworld_domain"), # type:ignore
lazy_fixture("triangle_tireworld_domain"), # type:ignore
lazy_fixture("blocksworld_fond_domain"), # type:ignore
lf("blocksworld_domain"), # type:ignore
lf("triangle_tireworld_domain"), # type:ignore
lf("blocksworld_fond_domain"), # type:ignore
]
pddl_objects_problems = [
lazy_fixture("blocksworld_fond_01"), # type:ignore
lazy_fixture("blocksworld_problem_01"), # type:ignore
lazy_fixture("triangle_tireworld_problem_01"), # type:ignore
lf("blocksworld_fond_01"), # type:ignore
lf("blocksworld_problem_01"), # type:ignore
lf("triangle_tireworld_problem_01"), # type:ignore
]

#################################################
Expand Down
7 changes: 4 additions & 3 deletions tests/test_docs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from typing import Dict, List, Optional

import mistune
import mistune.renderers
import pytest

MISTUNE_BLOCK_CODE_ID = "block_code"
Expand Down Expand Up @@ -55,7 +56,7 @@ def setup_class(cls):
if cls.MD_FILE is None:
raise ValueError("cannot set up method as MD_FILE is None")
content = cls.MD_FILE.read_text()
markdown_parser = mistune.create_markdown(renderer=mistune.AstRenderer())
markdown_parser = mistune.create_markdown(renderer="ast")
cls.blocks = markdown_parser(content)
cls.code_blocks = list(filter(cls.block_code_filter, cls.blocks))

Expand All @@ -78,7 +79,7 @@ def type_filter(type_: Optional[str], b: Dict) -> bool:
"""
if type_ is None:
return True
return b["info"].strip() == type_ if b["info"] is not None else False
return b["type"].strip() == type_ if b["type"] is not None else False

@classmethod
def extract_code_blocks(cls, filter_: Optional[str] = None):
Expand All @@ -105,7 +106,7 @@ def setup_class(cls):
@classmethod
def _python_selector(cls, block: Dict) -> bool:
return block["type"] == MISTUNE_BLOCK_CODE_ID and (
block["info"].strip() == "python" if block["info"] else False
block["type"].strip() == "python" if block["type"] else False
)

def _assert(self, locals_, *mocks):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parser/test_parametrized.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pathlib import Path

import pytest
from pytest import lazy_fixture # type:ignore # noqa
from pytest_lazy_fixtures import lf as lazy_fixture # type:ignore # noqa

from pddl.core import Domain, Problem
from tests.conftest import (
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ deps =
pytest
pytest-cov
pytest-randomly
pytest-lazy-fixture
pytest-lazy-fixtures
mistune

commands =
Expand Down Expand Up @@ -40,7 +40,7 @@ commands =
deps =
mypy
types-click
types-pytest-lazy-fixture
pytest-lazy-fixtures
commands =
mypy pddl tests

Expand Down

0 comments on commit d7400f0

Please sign in to comment.