Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
Fix issue with fancy pytest fixtures for running the tools as a Python module for Python 3.7.
Basically, the fixtures have been reimplemented by splitting the single
tool
fixture into two separate fixtures:get_tool
: Import a tool as a module.Essentially, one uses this fixture in a test and then runs
ontodoc = get_tool("ontodoc")
to import thetools/ontodoc
file as a module. It can now be tested by running itsmain()
function.rename_tools
: Add a.py
extension to all tools.This fixture runs prior to all tests in this module (the
tests/tools/
folder). First, it adds a.py
suffix to all the tool file names to make them importable as a module. Then it stops executing for a while (yields) and then all the tests can be run.Then after they're done it reverts the file names, by removing the
.py
suffix. Furthermore, it returnssys.path
to its original state prior to running the tests; to make the imports of the tools work, thetools
folder had to be added to thesys.path
.I updated the doc-strings for all the tests to be more clear about where the fixtures are coming from as well, and tried to minimize the imports outside the test functions as much as possible.
Type of change:
Checklist:
This checklist can be used as a help for the reviewer.
Comments: