Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest for wfl command line examples #203

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bernstei
Copy link
Contributor

@bernstei bernstei commented Dec 12, 2022

Update test_doc_examples.py to correctly handle (at least specially crafted) wfl command line tests.

Note that this initial commit does not include the files needed for the example test.

crafted `wfl` command line tests. Note that this patch does not include
the files needed for the example test.
@bernstei
Copy link
Contributor Author

I'm going to try to convert the relative paths to absolute paths starting from the location of wfl.__file__, I think.

@bernstei
Copy link
Contributor Author

bernstei commented Dec 13, 2022

I'm going to try to convert the relative paths to absolute paths starting from the location of wfl.__file__, I think.

So I figured out how to do this, but I don't think that for a notebook that's the right approach - I think it makes more sense for the notebook to use its own directory's examples, rather than the one that's linked to the wfl version that import wfl returns. Actually, if wfl is installed from pypi rather than a local repo clone, there may not even be a wfl/examples directory on the system.

@bernstei
Copy link
Contributor Author

bernstei commented Jan 30, 2023

Explanation: I put in a framework for pytest to automatically test docs examples that use the command line. It does it by looking for code blocks that start with !wfl, and replaces them with CliRunner click pytest-compatible python calls. However, I was unable to put in a complete example. The framework is in docs/source/examples.cli.ipynb. Someone else needs to upload the corresponding files to docs/example_files so that command will run and test will pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants