-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #536 from emmo-repo/cwa/test_flb/bypass_punning_in…
…_ontodoc Fix fixtures for Python3.7.
- Loading branch information
Showing
7 changed files
with
247 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
"""Test the `emmocheck` tool.""" | ||
import pytest | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from types import ModuleType | ||
from typing import Callable | ||
|
||
@pytest.mark.parametrize("tool", ["emmocheck"], indirect=True) | ||
def test_run(tool) -> None: | ||
"""Check that running `emmocheck` works.""" | ||
|
||
def test_run(get_tool: "Callable[[str], ModuleType]") -> None: | ||
"""Check that running `emmocheck` works. | ||
Parameters: | ||
get_tool: Local module fixture to load a named tool as a module. | ||
See the current folder's `conftest.py` file. | ||
""" | ||
from pathlib import Path | ||
|
||
test_file = ( | ||
Path(__file__).resolve().parent.parent / "testonto" / "models.ttl" | ||
) | ||
emmocheck = get_tool("emmocheck") | ||
|
||
tool.main([str(test_file)]) | ||
emmocheck.main([str(test_file)]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
"""Test the `ontoconvert` tool.""" | ||
from pathlib import Path | ||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
if TYPE_CHECKING: | ||
from pathlib import Path | ||
from types import ModuleType | ||
from typing import Callable | ||
|
||
|
||
@pytest.mark.parametrize("tool", ["ontoconvert"], indirect=True) | ||
def test_run(tool, tmpdir: Path) -> None: | ||
"""Check that running `ontoconvert` works.""" | ||
def test_run(get_tool: "Callable[[str], ModuleType]", tmpdir: "Path") -> None: | ||
"""Check that running `ontoconvert` works. | ||
Parameters: | ||
get_tool: Local module fixture to load a named tool as a module. | ||
See the current folder's `conftest.py` file. | ||
tmpdir: A generic pytest fixture to generate a temporary directory, which will | ||
exist only for the lifetime of this test function. | ||
""" | ||
from pathlib import Path | ||
|
||
test_file = ( | ||
Path(__file__).resolve().parent.parent / "testonto" / "models.ttl" | ||
) | ||
ontoconvert = get_tool("ontoconvert") | ||
|
||
tool.main([str(test_file), str(tmpdir / "test.ttl")]) | ||
ontoconvert.main([str(test_file), str(tmpdir / "test.ttl")]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,90 @@ | ||
"""Test the `ontodoc` tool.""" | ||
from pathlib import Path | ||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
if TYPE_CHECKING: | ||
from pathlib import Path | ||
from types import ModuleType | ||
from typing import Callable | ||
|
||
|
||
def test_run(get_tool: "Callable[[str], ModuleType]", tmpdir: "Path") -> None: | ||
"""Check that running `ontodoc` works. | ||
Parameters: | ||
get_tool: Local module fixture to load a named tool as a module. | ||
See the current folder's `conftest.py` file. | ||
tmpdir: A generic pytest fixture to generate a temporary directory, which will | ||
exist only for the lifetime of this test function. | ||
""" | ||
from pathlib import Path | ||
|
||
@pytest.mark.parametrize("tool", ["ontodoc"], indirect=True) | ||
def test_run(tool, tmpdir: Path) -> None: | ||
"""Check that running `ontodoc` works.""" | ||
test_file = ( | ||
Path(__file__).resolve().parent.parent / "testonto" / "models.ttl" | ||
) | ||
ontodoc = get_tool("ontodoc") | ||
|
||
tool.main([str(test_file), str(tmpdir / "test.md")]) | ||
tool.main( | ||
ontodoc.main([str(test_file), str(tmpdir / "test.md")]) | ||
ontodoc.main( | ||
[str(test_file), "--format=simple-html", str(tmpdir / "test.html")] | ||
) | ||
|
||
|
||
@pytest.mark.parametrize("tool", ["ontodoc"], indirect=True) | ||
def test_run_w_individual(tool, tmpdir: Path) -> None: | ||
"""Check that running `ontodoc` works when there is an individual.""" | ||
def test_run_w_individual( | ||
get_tool: "Callable[[str], ModuleType]", tmpdir: "Path" | ||
) -> None: | ||
"""Check that running `ontodoc` works when there is an individual. | ||
Parameters: | ||
get_tool: Local module fixture to load a named tool as a module. | ||
See the current folder's `conftest.py` file. | ||
tmpdir: A generic pytest fixture to generate a temporary directory, which will | ||
exist only for the lifetime of this test function. | ||
""" | ||
from pathlib import Path | ||
|
||
test_file = ( | ||
Path(__file__).resolve().parent.parent | ||
/ "testonto" | ||
/ "testonto_w_individual.ttl" | ||
) | ||
ontodoc = get_tool("ontodoc") | ||
|
||
tool.main([str(test_file), str(tmpdir / "test.md")]) | ||
tool.main( | ||
ontodoc.main([str(test_file), str(tmpdir / "test.md")]) | ||
ontodoc.main( | ||
[str(test_file), "--format=simple-html", str(tmpdir / "test.html")] | ||
) | ||
|
||
|
||
@pytest.mark.parametrize("tool", ["ontodoc"], indirect=True) | ||
@pytest.mark.filterwarnings( | ||
"ignore:Ignoring instance" | ||
) # currently pytest is set to accept warnings, but this might change in the future | ||
def test_run_w_punning(tool, tmpdir: Path) -> None: | ||
def test_run_w_punning( | ||
get_tool: "Callable[[str], ModuleType]", tmpdir: "Path" | ||
) -> None: | ||
"""Check that running `ontodoc` works even if there is a punned individual. | ||
This will throw and extra warning as the punned individual will be ignored. | ||
Parameters: | ||
get_tool: Local module fixture to load a named tool as a module. | ||
See the current folder's `conftest.py` file. | ||
tmpdir: A generic pytest fixture to generate a temporary directory, which will | ||
exist only for the lifetime of this test function. | ||
""" | ||
from pathlib import Path | ||
|
||
test_file = ( | ||
Path(__file__).resolve().parent.parent | ||
/ "testonto" | ||
/ "testonto_w_punning.ttl" | ||
) | ||
ontodoc = get_tool("ontodoc") | ||
|
||
tool.main([str(test_file), str(tmpdir / "test.md")]) | ||
tool.main( | ||
ontodoc.main([str(test_file), str(tmpdir / "test.md")]) | ||
ontodoc.main( | ||
[str(test_file), "--format=simple-html", str(tmpdir / "test.html")] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
"""Test the `ontograph` tool.""" | ||
from pathlib import Path | ||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
if TYPE_CHECKING: | ||
from pathlib import Path | ||
from types import ModuleType | ||
from typing import Callable | ||
|
||
|
||
@pytest.mark.parametrize("tool", ["ontograph"], indirect=True) | ||
def test_run(tool, tmpdir: Path) -> None: | ||
"""Check that running `ontograph` works.""" | ||
def test_run(get_tool: "Callable[[str], ModuleType]", tmpdir: "Path") -> None: | ||
"""Check that running `ontograph` works. | ||
Parameters: | ||
get_tool: Local module fixture to load a named tool as a module. | ||
See the current folder's `conftest.py` file. | ||
tmpdir: A generic pytest fixture to generate a temporary directory, which will | ||
exist only for the lifetime of this test function. | ||
""" | ||
from pathlib import Path | ||
|
||
test_file = ( | ||
Path(__file__).resolve().parent.parent / "testonto" / "models.ttl" | ||
) | ||
ontograph = get_tool("ontograph") | ||
|
||
tool.main([str(test_file), str(tmpdir / "test.png")]) | ||
ontograph.main([str(test_file), str(tmpdir / "test.png")]) |
Oops, something went wrong.