mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
extra_template_vars plugin hook (#542)
* extra_template_vars plugin hook Closes #541 * Workaround for cwd bug Based on https://github.com/pytest-dev/pytest/issues/1235#issuecomment-175295691
This commit is contained in:
parent
859c79f115
commit
42d6877784
9 changed files with 186 additions and 19 deletions
|
|
@ -1,3 +1,7 @@
|
|||
import os
|
||||
import pytest
|
||||
|
||||
|
||||
def pytest_configure(config):
|
||||
import sys
|
||||
|
||||
|
|
@ -22,3 +26,14 @@ def move_to_front(items, test_name):
|
|||
test = [fn for fn in items if fn.name == test_name]
|
||||
if test:
|
||||
items.insert(0, items.pop(items.index(test[0])))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def restore_working_directory(tmpdir, request):
|
||||
previous_cwd = os.getcwd()
|
||||
tmpdir.chdir()
|
||||
|
||||
def return_to_previous():
|
||||
os.chdir(previous_cwd)
|
||||
|
||||
request.addfinalizer(return_to_previous)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue