facebook / facebook/TestSlide

Simplify sharing contexts at top level

Abierto
#13 2 comentarios 0 reacciones 0 asignados Ver en GitHub
enhancement help wanted TestSlide DSL
Lenguaje dominante
Python
Estrellas
149
Forks
62
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.