diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7cd01786..70237f27 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -84,7 +84,7 @@ jobs: run: | python -m pip install --upgrade pip pip install . - pip install pytest~=6.2 pytest-param-files~=0.2.2 docutils==${{ matrix.docutils-version }} + pip install pytest~=6.2 pytest-param-files~=0.3.3 docutils==${{ matrix.docutils-version }} - name: ensure sphinx is not installed run: | python -c "\ diff --git a/setup.cfg b/setup.cfg index e48e4080..92d22a71 100644 --- a/setup.cfg +++ b/setup.cfg @@ -79,7 +79,7 @@ testing = pytest>=6,<7 pytest-cov pytest-regressions - pytest-param-files~=0.2.2 + pytest-param-files~=0.3.3 [flake8] max-line-length = 100 diff --git a/tests/test_html/test_html_to_nodes.py b/tests/test_html/test_html_to_nodes.py index c43d0a1c..9774a32f 100644 --- a/tests/test_html/test_html_to_nodes.py +++ b/tests/test_html/test_html_to_nodes.py @@ -3,7 +3,6 @@ import pytest from docutils import nodes -from pytest_param_files import with_parameters from myst_parser.html_to_nodes import html_to_nodes from myst_parser.main import MdParserConfig @@ -29,7 +28,7 @@ def _run_directive(name: str, first_line: str, content: str, position: int): ) -@with_parameters(FIXTURE_PATH / "html_to_nodes.md") +@pytest.mark.param_file(FIXTURE_PATH / "html_to_nodes.md") def test_html_to_nodes(file_params, mock_renderer): output = nodes.container() output += html_to_nodes(file_params.content, line_number=0, renderer=mock_renderer) diff --git a/tests/test_html/test_parse_html.py b/tests/test_html/test_parse_html.py index a9775414..5b765887 100644 --- a/tests/test_html/test_parse_html.py +++ b/tests/test_html/test_parse_html.py @@ -1,13 +1,13 @@ from pathlib import Path -from pytest_param_files import with_parameters +import pytest from myst_parser.parse_html import tokenize_html FIXTURE_PATH = Path(__file__).parent -@with_parameters(FIXTURE_PATH / "html_ast.md") +@pytest.mark.param_file(FIXTURE_PATH / "html_ast.md") def test_html_ast(file_params): tokens = "\n".join( repr(t) for t in tokenize_html(file_params.content).walk(include_self=True) @@ -15,7 +15,7 @@ def test_html_ast(file_params): file_params.assert_expected(tokens, rstrip=True) -@with_parameters(FIXTURE_PATH / "html_round_trip.md") +@pytest.mark.param_file(FIXTURE_PATH / "html_round_trip.md") def test_html_round_trip(file_params): ast = tokenize_html(file_params.content) file_params.assert_expected(str(ast), rstrip=True) diff --git a/tests/test_renderers/test_error_reporting.py b/tests/test_renderers/test_error_reporting.py index e6cfa6f0..72327fdb 100644 --- a/tests/test_renderers/test_error_reporting.py +++ b/tests/test_renderers/test_error_reporting.py @@ -2,15 +2,15 @@ from io import StringIO from pathlib import Path +import pytest from docutils.core import publish_doctree -from pytest_param_files import with_parameters from myst_parser.docutils_ import Parser FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") -@with_parameters(FIXTURE_PATH / "reporter_warnings.md") +@pytest.mark.param_file(FIXTURE_PATH / "reporter_warnings.md") def test_basic(file_params): """Test basic functionality.""" report_stream = StringIO() diff --git a/tests/test_renderers/test_fixtures_docutils.py b/tests/test_renderers/test_fixtures_docutils.py index d9482e81..96b5a29d 100644 --- a/tests/test_renderers/test_fixtures_docutils.py +++ b/tests/test_renderers/test_fixtures_docutils.py @@ -5,7 +5,6 @@ from pathlib import Path import pytest -from pytest_param_files import with_parameters from myst_parser.docutils_renderer import DocutilsRenderer, make_document from myst_parser.main import MdParserConfig, create_md_parser @@ -13,7 +12,7 @@ FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") -@with_parameters(FIXTURE_PATH / "docutil_syntax_elements.md") +@pytest.mark.param_file(FIXTURE_PATH / "docutil_syntax_elements.md") def test_syntax_elements(file_params): parser = create_md_parser( MdParserConfig(highlight_code_blocks=False), DocutilsRenderer @@ -25,7 +24,7 @@ def test_syntax_elements(file_params): file_params.assert_expected(outcome, rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "docutil_roles.md") +@pytest.mark.param_file(FIXTURE_PATH / "docutil_roles.md") def test_docutils_roles(file_params): """Test output of docutils roles.""" parser = create_md_parser(MdParserConfig(), DocutilsRenderer) @@ -34,7 +33,7 @@ def test_docutils_roles(file_params): file_params.assert_expected(document.pformat(), rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "docutil_directives.md") +@pytest.mark.param_file(FIXTURE_PATH / "docutil_directives.md") def test_docutils_directives(file_params): """Test output of docutils directives.""" if "SKIP" in file_params.description: # line-block directive not yet supported diff --git a/tests/test_renderers/test_fixtures_sphinx.py b/tests/test_renderers/test_fixtures_sphinx.py index 69d0c87b..9a09d12e 100644 --- a/tests/test_renderers/test_fixtures_sphinx.py +++ b/tests/test_renderers/test_fixtures_sphinx.py @@ -7,7 +7,6 @@ import pytest import sphinx -from pytest_param_files import with_parameters from myst_parser.main import MdParserConfig, to_docutils from myst_parser.sphinx_renderer import SphinxRenderer, mock_sphinx_env @@ -20,25 +19,25 @@ def test_minimal_sphinx(): assert app.config["author"] == "bob geldof" -@with_parameters(FIXTURE_PATH / "sphinx_syntax_elements.md") +@pytest.mark.param_file(FIXTURE_PATH / "sphinx_syntax_elements.md") def test_syntax_elements(file_params): document = to_docutils(file_params.content, in_sphinx_env=True) file_params.assert_expected(document.pformat(), rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "tables.md") +@pytest.mark.param_file(FIXTURE_PATH / "tables.md") def test_tables(file_params): document = to_docutils(file_params.content, in_sphinx_env=True) file_params.assert_expected(document.pformat(), rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "directive_options.md") +@pytest.mark.param_file(FIXTURE_PATH / "directive_options.md") def test_directive_options(file_params): document = to_docutils(file_params.content) file_params.assert_expected(document.pformat(), rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "sphinx_directives.md") +@pytest.mark.param_file(FIXTURE_PATH / "sphinx_directives.md") def test_sphinx_directives(file_params): # TODO fix skipped directives # TODO test domain directives @@ -52,7 +51,7 @@ def test_sphinx_directives(file_params): file_params.assert_expected(document.pformat(), rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "sphinx_roles.md") +@pytest.mark.param_file(FIXTURE_PATH / "sphinx_roles.md") def test_sphinx_roles(file_params): if file_params.title.startswith("SKIP"): pytest.skip(file_params.title) @@ -65,7 +64,7 @@ def test_sphinx_roles(file_params): file_params.assert_expected(actual, rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "amsmath.md") +@pytest.mark.param_file(FIXTURE_PATH / "amsmath.md") def test_amsmath(file_params, monkeypatch): monkeypatch.setattr(SphinxRenderer, "_random_label", lambda self: "mock-uuid") document = to_docutils( @@ -76,7 +75,7 @@ def test_amsmath(file_params, monkeypatch): file_params.assert_expected(document.pformat(), rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "containers.md") +@pytest.mark.param_file(FIXTURE_PATH / "containers.md") def test_containers(file_params, monkeypatch): monkeypatch.setattr(SphinxRenderer, "_random_label", lambda self: "mock-uuid") document = to_docutils( @@ -87,13 +86,13 @@ def test_containers(file_params, monkeypatch): file_params.assert_expected(document.pformat(), rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "eval_rst.md") +@pytest.mark.param_file(FIXTURE_PATH / "eval_rst.md") def test_evalrst_elements(file_params): document = to_docutils(file_params.content, in_sphinx_env=True) file_params.assert_expected(document.pformat(), rstrip_lines=True) -@with_parameters(FIXTURE_PATH / "definition_lists.md") +@pytest.mark.param_file(FIXTURE_PATH / "definition_lists.md") def test_definition_lists(file_params): document = to_docutils( file_params.content, diff --git a/tests/test_renderers/test_include_directive.py b/tests/test_renderers/test_include_directive.py index 908afb8b..20e1a9d6 100644 --- a/tests/test_renderers/test_include_directive.py +++ b/tests/test_renderers/test_include_directive.py @@ -2,7 +2,6 @@ from pathlib import Path import pytest -from pytest_param_files import with_parameters from myst_parser.docutils_renderer import make_document from myst_parser.main import to_docutils @@ -10,7 +9,7 @@ FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") -@with_parameters(FIXTURE_PATH / "mock_include.md") +@pytest.mark.param_file(FIXTURE_PATH / "mock_include.md") def test_render(file_params, tmp_path): tmp_path.joinpath("other.md").write_text("a\nb\nc") tmp_path.joinpath("fmatter.md").write_text("---\na: 1\n---\nb") @@ -22,7 +21,7 @@ def test_render(file_params, tmp_path): file_params.assert_expected(output, rstrip=True) -@with_parameters(FIXTURE_PATH / "mock_include_errors.md") +@pytest.mark.param_file(FIXTURE_PATH / "mock_include_errors.md") def test_errors(file_params, tmp_path): if file_params.title.startswith("Non-existent path") and os.name == "nt": pytest.skip("tmp_path not converted correctly on Windows") diff --git a/tests/test_renderers/test_myst_config.py b/tests/test_renderers/test_myst_config.py index 24af9afc..fee43de3 100644 --- a/tests/test_renderers/test_myst_config.py +++ b/tests/test_renderers/test_myst_config.py @@ -3,15 +3,15 @@ from io import StringIO from pathlib import Path +import pytest from docutils.core import Publisher, publish_doctree -from pytest_param_files import with_parameters from myst_parser.docutils_ import Parser FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures") -@with_parameters(FIXTURE_PATH / "myst-config.txt") +@pytest.mark.param_file(FIXTURE_PATH / "myst-config.txt") def test_cmdline(file_params): """The description is parsed as a docutils commandline""" pub = Publisher(parser=Parser())