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

Simplify sharing contexts at top level #13

Open
fornellas opened this issue Apr 5, 2019 · 2 comments
Open

Simplify sharing contexts at top level #13

fornellas opened this issue Apr 5, 2019 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed TestSlide DSL TestSlide DSL

Comments

@fornellas
Copy link
Contributor

fornellas commented Apr 5, 2019

If we have a shared context defined in one file:

def some_shared_context(context):
  @context.before
  def before(self):
    pass

and we want to use it at different files, we need to do this:

from wherever import some_shared_context

@context
def first(context):
  context.shared_context(some_shared_context)
  context.merge_context("some shared context")

and on the other file:

from wherever import some_shared_context

@context
def second(context):
  context.shared_context(some_shared_context)
  context.merge_context("some shared context")

We can somewhat easily modify the merge_context function to accept the function directly, simplifying things:

from wherever import some_shared_context

@context
def first(context):
  context.merge_context(some_shared_context)

and on the other file

from wherever import some_shared_context

@context
def second(context):
  context.merge_context(some_shared_context)
@xush6528
Copy link
Contributor

I think it's equivalent to make all contexts sharable by default (at least conceptually).

@fornellas
Copy link
Contributor Author

Shared contexts should not be executed, unless they're put into another "real" context. Whether or not "real" contexts can / should be shareable, it seems to me that is a different issue than the one described here.

@fornellas fornellas added enhancement New feature or request help wanted Extra attention is needed labels Apr 21, 2019
@fornellas fornellas added this to the TestSlide's DSL milestone Apr 9, 2020
@fornellas fornellas added the TestSlide DSL TestSlide DSL label Apr 9, 2020
@fornellas fornellas removed this from the TestSlide's DSL milestone Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed TestSlide DSL TestSlide DSL
Projects
None yet
Development

No branches or pull requests

2 participants