facebook / facebook/TestSlide

Simplify sharing contexts at top level

Open
#13 2 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted TestSlide DSL
Dominant language
Python
Stars
149
Forks
62
PR merge metrics
No merged PRs in 30d

Description

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)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.