test suit needs to have jb in $PATH
See original GitHub issueTest suit is full with lines like
the problem with this, is that its assume that jb
its on your path, and probably does not make any check to see if its the one you should be testing. this means that if i’m working on a virtual environment, i need to activate the virtual environment. so
~/code/jupyter-book >>> python3 -m venv venv
~/code/jupyter-book >>> ./venv/bin/python -m pip install .[testing,code_style,sphinx]
~/code/jupyter-book >>> ./venv/bin/pytest tests
will fail, with
E FileNotFoundError: [Errno 2] No such file or directory: 'jb'
because jb is not in the path. you actually need to activate the venv
~/code/jupyter-book >>> source ./venv/bin/activate
~/code/jupyter-book >>> ./venv/bin/pytest tests
that add an extra step that should be necesary
a much cleaner way of testing click apps, is use the CliRunner that comes with click. that way the line
run(f"jb clean {path}".split())
can be written like
from click.testing import CliRunner
from jupyter_book.commands import main
CliRunner.invoke(main, ["clean", path])
and this can be run without really activating the venv…
if this is ok, i can submit the PR, i just dont wanna do that work if you folks are actively not using clirunner
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
How do I configure PyCharm to run py.test tests?
Please go to File | Settings | Tools | Python Integrated Tools and change the default test runner to py.test. Then you'll get...
Read more >Integrated Tests Are A Scam - The Code Whisperer
If you're not careful, accumulating integrated tests will gradually suffocate your code base, driving you to a place where you have to decide ......
Read more >Automated Regression Testing: Challenges, Process And Steps
To start automating regression test cases, the very first thing that you need to do is to get the regression test cases identified...
Read more >Create test plans and test suites - Azure - Microsoft Learn
Learn about Test tools. Create test plans in Azure Test Plans and Azure DevOps Server to make sure each of the deliverables meets...
Read more >Frequently Asked Questions - JUnit 5
What CLASSPATH settings are needed to run JUnit? Why do I get a NoClassDefFoundError when trying to test JUnit or run the samples?...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh indeed, I didn’t write any of this test infrastucture, but was intending to take a hammer to it at some point lol. I’ve used CliRunner plenty e.g. in https://github.com/executablebooks/jupyter-cache/blob/master/tests/test_cli.py
FYI though, you may notice I just added a
tox.ini
to the repo (9daee14c2cf5e18aa475cee337a9389278682b82), and using that you don’t have to activate any virtual envs (it does it for you 😉)But yeh, I wouldn’t say no to a PR 😄
@chrisjsewell seems like it does solve the issue… Thanks!!!