This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| location ~ \+f/ { | |
| try_files $uri @proxy_to_app; | |
| } | |
| location ~ \+doc/ { | |
| try_files $uri @proxy_to_app; | |
| } | |
| location / { | |
| proxy_pass http://localhost:3141; | |
| proxy_set_header X-outside-url $scheme://$host; | |
| proxy_set_header X-Real-IP $remote_addr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # content of conftest.py | |
| import pytest | |
| @pytest.mark.tryfirst | |
| def pytest_pyfunc_call(pyfuncitem): | |
| marker = pyfuncitem.get_marker("skip_if_eval") | |
| if marker is not None: | |
| class Mapping: | |
| def __getitem__(self, name): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def pytest_load_initial_conftests(parser, args): | |
| ns = parser.parse_known_args(args) | |
| if ns and ns.ds: # orwhatever the option is called | |
| os.environ["DJANGO_SETTINGS"] = ... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pytest | |
| import contextlib | |
| @contextlib.contextmanager | |
| def ctx(): | |
| print "setup ctx" | |
| yield 1 | |
| print "teardown ctx" | |
| @pytest.fixture |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| in case of a whole remote gateway gone: | |
| >>> import execnet | |
| >>> gw=execnet.makegateway() | |
| >>> gw._rinfo() | |
| <RInfo "platform=linux2, executable=/home/hpk/venv/0/bin/python, pid=22601, cwd=/home/hpk/p/devpi, version_info=(2, 7, 3, 'final', 0)"> | |
| >>> os.kill(22601, 9) | |
| >>> gw.remote_exec("hello") | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # content of testcases/conftest.py | |
| from os.path import abspath, dirname | |
| import os | |
| import pytest | |
| @pytest.fixture(autouse=True) | |
| def cd_to_rootdir(): | |
| os.chdir(dirname(dirname(abspath(__file__)))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sys | |
| import execnet | |
| gw = execnet.makegateway("popen") | |
| ch = gw.remote_exec(""" | |
| while 1: | |
| data = channel.receive() | |
| if data: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pytest | |
| import time | |
| delay = 0.006 | |
| @pytest.mark.parametrize("x", range(100)) | |
| def test_func(x): | |
| time.sleep(delay) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| + def test_is_greenlet_local(self, D): | |
| + greenlet = pytest.importorskip("greenlet") | |
| + d = wrap_dict(dict)() | |
| + d['x'] = 42 | |
| + | |
| + def run(): | |
| + assert 'x' not in d._dict | |
| + d['x'] = 23 | |
| + |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/structlog/threadlocal.py b/structlog/threadlocal.py | |
| index 1b2eeb3..80de726 100644 | |
| --- a/structlog/threadlocal.py | |
| +++ b/structlog/threadlocal.py | |
| @@ -17,11 +17,24 @@ Primitives to keep context global but thread local. | |
| """ | |
| import contextlib | |
| -import threading | |
| import uuid |