-
Notifications
You must be signed in to change notification settings - Fork 20
Test functions instead of cells #26
Comments
actually the purpose of this plugin is exactly to avoid the need to create
functions, without functions is a lot easier to debug and inspect what is
going on.
…On Fri, Nov 24, 2017 at 12:34 AM pylang ***@***.***> wrote:
Hi. Is it possible to read tests from regular functions and class names?
This would alleviate coding each test to a separate cell and allow the use
of traditional unittests.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#26>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAXYctraMf7Puzic2PWSP3aqnT6SaPCLks5s5gEhgaJpZM4QpPmI>
.
|
And I suspect easier to code. For example, you can parse the notebook cell source keys from json, access the cell name and remaining cell code. I don't mind this idea of running tests in cells. However, using functions helps maintain local scopes. It also does not compel the user to defect from a standard, functional way of writing tests. Consider writing a simple test function: test_foo():
assert foo() == expected Someone familiar with unit tests in python understands what that is - a test on some object called Supporting tests as cells is fine and interesting. I would only recommend extending this plugin to support an extant convention of writing traditional tests. This improvement might be promising in attacking a bigger issue - that is not being able to run pytest inside a notebook |
ok, supporting both would be fine, if it doesn't complicate the code too
much.
Would you like to contribute this improvement as a pull request?
…On Fri, Nov 24, 2017 at 9:55 PM pylang ***@***.***> wrote:
And I suspect easier to code. For example, you can parse the notebook cell
source keys from json, access the cell name and remaining cell code.
I don't mind this idea of running tests in cells. However, using functions
helps maintain local scopes. It also does not compel the user to defect
from a standard, functional way of writing tests. Consider writing a simple
test function:
test_foo():
assert foo() == expected
Someone familiar with unit tests in python understands what that is - a
test on some object called foo. This test can be run in jupyter, or
copied/pasted into a module and run by many test runners, i.e. unittest
(with some modification), nose and pytest. Here, the tests are restricted
to notebook cells.
Supporting tests as cells is fine. I would only recommend extending this
plugin to support an extant convention. This improvement might attack a
bigger issue - that is not being able to run pytest inside a notebook.
pytest-dev/pytest#2268 <pytest-dev/pytest#2268>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#26 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAXYcsPr6zwXvF2kd05bbhhyGXE7FR1aks5s5y1YgaJpZM4QpPmI>
.
|
Thanks. I cannot contribute a pull request at the moment, but perhaps I may in the future. I admit the learning curve is steep to make a contribution at the moment. In the meantime, those interested on continuing this idea are welcome. |
Hi. Is it possible to read tests from regular functions and class names? This would alleviate coding each test to a separate cell and allow the use of traditional unittests.
The text was updated successfully, but these errors were encountered: