Skip to content

Next PATCH #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- First working version of `dockernel install` and `dockernel start`.

[unreleased]: https://github.com/mrmino/dockernel/v1.0.2...HEAD
[1.0.1]: https://github.com/mrmino/dockernel/releases/tag/v1.0.2
[1.0.2]: https://github.com/mrmino/dockernel/releases/tag/v1.0.2
[1.0.1]: https://github.com/mrmino/dockernel/releases/tag/v1.0.1
[1.0.0]: https://github.com/mrmino/dockernel/releases/tag/v1.0.0
2 changes: 1 addition & 1 deletion dockernel/cli/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def python_argv(system_type: str) -> List[str]:

def generate_kernelspec_argv(image_name: str, system_type: str) -> List[str]:
dockernel_argv = ['dockernel', 'start',
image_name, JUPYTER_CONNECTION_FILE_TEMPLATE]
image_name, JUPYTER_CONNECTION_FILE_TEMPLATE]
return python_argv(system_type) + dockernel_argv


Expand Down
2 changes: 1 addition & 1 deletion example_dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7-slim-buster

RUN pip install --upgrade pip ipython ipykernel
CMD cat $DOCKERNEL_CONNECTION_FILE; python -m ipykernel_launcher -f $DOCKERNEL_CONNECTION_FILE || true
CMD python -m ipykernel_launcher -f $DOCKERNEL_CONNECTION_FILE || true
5 changes: 3 additions & 2 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
from dockernel.cli import main_arguments


class TestKernelspecArgvGeneration:
# TODO Add tests for Darwin and Windows
class TestLinuxKernelspecArgvGeneration:
IMAGE_NAME = 'example/image-name'

@pytest.fixture
def argv(self):
return generate_kernelspec_argv(self.IMAGE_NAME)
return generate_kernelspec_argv(self.IMAGE_NAME, 'Linux')

def test_argv_starts_with_usr_bin_env_python_m(self, argv):
assert argv[:3] == ['/usr/bin/env', 'python', '-m']
Expand Down
16 changes: 15 additions & 1 deletion tests/test_kernelspec.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import pytest
import json
from dockernel.kernelspec import (Kernelspec, InterruptMode,
Expand All @@ -7,6 +8,16 @@
from pathlib import Path


@pytest.yield_fixture
def environment_variables():
starting_state = os.environ.copy()

yield os.environ

os.environ.clear()
os.environ.update(starting_state)


@pytest.fixture
def tmpdir(tmpdir):
"""Workaround for tmpdir being py.path.LocalPath instead of Path"""
Expand Down Expand Up @@ -81,7 +92,10 @@ def test_raises_ValueError_when_directory_name_is_not_store(self, tmpdir):

class TestKernelspecStoreDir:
@pytest.mark.parametrize('system_type', ('Linux', 'Windows', 'Darwin'))
def test_works_for_supported_platforms(self, system_type):
def test_works_for_supported_platforms(self, system_type,
environment_variables):
if system_type == 'Windows':
environment_variables['APPDATA'] = ''
user_kernelspec_store(system_type)

def test_raises_TypeError_on_unknown_system(self):
Expand Down