Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart committed May 25, 2020
1 parent ccfeb19 commit eea5922
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 25 deletions.
4 changes: 2 additions & 2 deletions tests/app/config_paths_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def voila_config_file_paths_arg():
return '--Voila.config_file_paths=[%r]' % path


def test_config_app(voila_app, get_test_template):
def test_config_app(voila_app):
assert voila_app.template == 'test_template'
assert voila_app.enable_nbextensions is True

Expand All @@ -26,7 +26,7 @@ def test_config_contents_manager(voila_app):
assert voila_app.serverapp.contents_manager.use_atomic_writing is False


async def test_template(get_test_template, fetch):
async def test_template(fetch):
response = await fetch('voila', method='GET')
assert response.code == 200
assert 'test_template.css' in response.body.decode('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion tests/app/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def voila_args(voila_notebook, voila_args_extra, voila_config_file_paths_arg):


@pytest.fixture(autouse=True)
def voila_app(server_config, voila_config, voila_args, get_nbconvert_template):
def voila_app(server_config, voila_config, voila_args):
# Get an instance of Voila
voila_app = Voila(**voila_config)
# Get an instance of the underlying server. This is
Expand Down
2 changes: 1 addition & 1 deletion tests/app/execute_cpp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def voila_args(notebook_directory, voila_args_extra):


@pytest.mark.skipif(not TEST_XEUS_CLING, reason='opt in to avoid having to install xeus-cling')
async def test_cpp11_kernel(fetch, get_jupyter_kernels):
async def test_cpp11_kernel(fetch):
response = await fetch('voila', 'render', 'print.xcpp', method='GET')
assert response.code == 200
assert 'Hello voila, from c++' in response.body.decode('utf-8')
2 changes: 1 addition & 1 deletion tests/app/nbextensions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def voila_config_file_paths_arg():
return '--Voila.config_file_paths=[%r]' % path


async def test_lists_extension(get_test_template, get_nbextensions, fetch):
async def test_lists_extension(fetch):
response = await fetch('voila', method='GET')
assert response.code == 200
html_text = response.body.decode('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion tests/app/serve_directory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def test_print_py(fetch):


@pytest.mark.skipif(not TEST_XEUS_CLING, reason='opt in to avoid having to install xeus-cling')
async def test_print_cpp_notebook(fetch, get_jupyter_kernels):
async def test_print_cpp_notebook(fetch):
response = await fetch('voila', 'render', 'print_cpp.ipynb', method='GET')
assert response.code == 200
assert 'Hi Voila, from c++' in response.body.decode('utf-8')
2 changes: 1 addition & 1 deletion tests/app/template_arg_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def voila_args_extra():
return ['--Voila.template=test_template']


async def test_template(get_test_template, fetch):
async def test_template(fetch):
response = await fetch('voila', method='GET')
assert response.code == 200
assert 'test_template.css' in response.body.decode('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion tests/app/template_config_file_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def voila_args_extra():
return ['--Voila.template=test_template', '--Voila.nbconvert_template_paths=[%r, %r]' % (path_test_template, path_default), '--ServerApp.config_file=%r' % path_config]


async def test_template_test(get_test_template, fetch):
async def test_template_test(fetch):
response = await fetch('voila', method='GET')
assert response.code == 200
assert 'test_template.css' in response.body.decode('utf-8')
Expand Down
2 changes: 1 addition & 1 deletion tests/app/template_custom_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def voila_config():
return config


async def test_template(get_test_template, voila_config, voila_app, fetch):
async def test_template(voila_config, voila_app, fetch):
response = await fetch('voila', method='GET')
assert response.code == 200
assert 'test_template.css' in response.body.decode('utf-8')
Expand Down
23 changes: 7 additions & 16 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,28 @@ def voila_notebook(notebook_directory):
return os.path.join(notebook_directory, 'print.ipynb')


@pytest.fixture
@pytest.fixture(autouse=1)
def get_jupyter_kernels(env_jupyter_path):
src = sys.prefix + '/share/jupyter/kernels'
dst = str(env_jupyter_path) + '/kernels'
shutil.copytree(src, dst)


@pytest.fixture
def get_nbconvert_template(env_jupyter_path):
@pytest.fixture(autouse=1)
def get_nbconvert_templates(env_jupyter_path):
src = sys.prefix + '/share/jupyter/nbconvert'
dst = str(env_jupyter_path) + '/nbconvert'
shutil.copytree(src, dst)


@pytest.fixture
def get_jupyter_config(environ):
dir_path = os.path.dirname(os.path.realpath(__file__))
src = f'{dir_path}/../etc/jupyter/jupyter_server_config.d/voila.json'
dst = os.environ['JUPYTER_CONFIG_DIR']
shutil.copyfile(src, dst)


@pytest.fixture
def get_test_template(env_jupyter_path):
dir_path = os.path.dirname(os.path.realpath(__file__))
src = f'{dir_path}/test_template/share/jupyter/voila'
@pytest.fixture(autouse=1)
def get_voila_templates(env_jupyter_path):
src = sys.prefix + '/share/jupyter/voila'
dst = str(env_jupyter_path) + '/voila'
shutil.copytree(src, dst)


@pytest.fixture
@pytest.fixture(autouse=1)
def get_nbextensions(env_jupyter_path):
src = sys.prefix + '/share/jupyter/nbextensions'
dst = str(env_jupyter_path) + '/nbextensions'
Expand Down

0 comments on commit eea5922

Please sign in to comment.