Comments (8)
Hey, thanks for raising this issue. I think it definitely makes sense to gather all cells with the same tag. I will take this up.
Edit: Seems like there are a few edge cases where gathering all cells with same tag would not make sense, I will document these and come up with a solution soon and post it here.
from testbook.
@devstein Thanks for the follow up! I apologize for the delay. I will try and implement this over the coming weekend.
from testbook.
@rohitsanj Thanks a lot for the reply. I look forward to hear about your solution.
from testbook.
@fcollonval @rohitsanj Any updates on this? A few of user want the ability to separate cells for readability purposes, but group them logically when testing via the same tag
from testbook.
So, I ran into some design issues while trying to implement this. Maybe you can give me your feedback on this.
Let's say you have a notebook with cells as:
cell 0 ('tag1', 'tag2')
cell 1 ('tag3')
cell 2 ('tag2')
cell 3 ('tag1')
cell 4
cell 5 ('tag1')
The issue is as follows: with the current implementation, when we specify testbook('nb.ipynb', execute=['tag3', 'tag1']
, it will execute the cells tagged by those tags in the specified order i.e execute cell 1 and then cell 0. If we were to support multiple cells with same tag, we will have to execute the cells linearly, because otherwise the order becomes ambiguous.
For example, if execute=['tag3', 'tag1']
which means tag3
will fetch cells [1]
and tag1
will fetch cells [0, 3, 5]
Now, there'd be two ways to go about this:
- Does the user want testbook to execute all cells tagged by 'tag3' and then, execute all cells tagged with 'tag1' ?
- OR, Does the user want testbook to execute linearly, which would combine to give
[0, 1, 3, 5]
It is these ambiguities that I wanted to highlight earlier. I'd like to hear your thoughts on this. @devstein @fcollonval
cc @MSeal
from testbook.
I would say
the user want testbook to execute linearly, which would combine to give [0, 1, 3, 5]
The unordered execution sounds odd as it means the intrinsic way to execute the notebook is unordered; aka when you run manually the notebook. This is a bad practice that will confuse most users.
from testbook.
@rohitsanj I agree with @fcollonval, keeping it linear is most intuitive.
If executing the notebook in a tag-based order is desirable, then I think it makes sense to have a separate execution flag for enabling that behavior.
from testbook.
@rohitsanj +1 for keeping it linear, as it's consistent with how manual runs work.
from testbook.
Related Issues (20)
- Getting an InterpreterNotFoundError on running the command tox -e py36 during setup HOT 1
- Document `nb` attribute and how it represents the nbformat object
- Entire notebook executed before the specific method HOT 3
- Testbook fails when using pytest test-classes HOT 2
- Support for objects as return_value when patching HOT 1
- Testbook giving timeout error because of nbclient HOT 1
- testbook loads wrong signature for function HOT 1
- Use pickle instead of JSON for serialization HOT 1
- support `async` function calls
- Asyncio errors and intermittent test failure
- Add support for SKIPPING cells' execution HOT 3
- Return value as None from testbook function HOT 4
- Mention in the contributing docs that an `ipykernel` with name `python3` must be present for tests to run locally
- Incompatibility between `execute=False` and `tb.patch()`
- testbook.ref cannot recognize complex variable
- `AttributeError: data` when repeatedly calling same function
- Because of project structure, relative paths in Notebook are no longer valid when testbook executes Notebook before tests HOT 1
- ModuleNotFoundError while using @testbook('....ipynb', execute=True) HOT 1
- Add type annotations
- Remove codecov dependency
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testbook.