We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
def run(notebook, rules=None, filename=None): nb = nbformat.read(notebook, 4) name = filename or notebook[:-6] + '_test.py' # remove .ipynb, replace with _test.py [... generate test file...] return name
def runWithReturn(notebook, executable=None, rules=None): name = run([...]) executable = executable or [sys.executable, '-m', 'pytest', '-v'] argv = executable + [name] return subprocess.check_output(argv)
def runWithReport(notebook, executable=None, rules=None, collect_only=False): tmpd = tempfile.mkdtemp() py_file = os.path.join(tmpd, os.path.basename(notebook).replace('.ipynb', '.py')) json_file = os.path.join(tmpd, os.path.basename(notebook).replace('.ipynb', '.json')) _ = run(notebook, filename=py_file, rules=rules) ret = [] [...run with ?coverage and collect results - TODO: read this code and see...] return ret
def runWithHTMLReturn(notebook, executable=None, rules=None): '''use pytest self contained html''' name = run(notebook, rules=rules) html = name.replace('.py', '.html') executable = executable or [sys.executable, '-m', 'pytest', '-v'] argv = executable + ['--html=' + html, '--self-contained-html', name] subprocess.call(argv) with open(html, 'r', encoding='utf-8') as fp: return fp.read()
def runWithHTMLReturn2(notebook, executable=None, rules=None): '''use custom return objects''' ret = '' executable = executable or [sys.executable, '-m', 'pytest', '-v'] ret_tmp = run(notebook, rules=rules) for test in ret_tmp: test = test.to_html() ret += '<p>' + test + '</p>' return '<div style="display: flex; flex-direction: column;">' + test + '</div>'
The text was updated successfully, but these errors were encountered:
Notes:
runWithHTMLReturn()
runWithHTMLReturn2()
runWithReport()
runWithReturn()
run()
generate_test_script()
python -m nbcelltests.test ... does not actually use any of the run functions, but most likely should.
python -m nbcelltests.test ...
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: