Skip to content

Commit

Permalink
Merge pull request #834 from blink1073/top-level-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Sep 13, 2022
2 parents d3d2f12 + e2ff453 commit ff85055
Show file tree
Hide file tree
Showing 24 changed files with 30 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ per-file-ignores =
# B011: Do not call assert False since python -O removes these calls
# F841 local variable 'foo' is assigned to but never used
# B007 Loop control variable
jupyter_client/tests/*: B011, F841, B007
tests/*: B011, F841, B007
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
- name: Install miniumum versions
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
- name: Run the unit tests
run: pytest -vv -W default jupyter_client || pytest -vv -W default jupyter_client --lf
run: pytest -vv -W default || pytest -vv -W default --lf

test_prereleases:
name: Test Prereleases
Expand All @@ -130,7 +130,7 @@ jobs:
pip check
- name: Run the tests
run: |
pytest -vv jupyter_client || pytest -vv jupyter_client --lf
pytest -vv || pytest -vv --lf
make_sdist:
name: Make SDist
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ repos:
rev: v0.971
hooks:
- id: mypy
exclude: jupyter_client/tests
exclude: tests
args: ["--config-file", "pyproject.toml"]
additional_dependencies: [pyzmq, tornado, types-paramiko]
stages: [manual]
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ src = "pyproject.toml"
[tool.pytest.ini_options]
addopts = "-raXs --durations 10 --color=yes --doctest-modules"
testpaths = [
"jupyter_client/tests/"
"jupyter_client",
"tests/"
]
timeout = 300
# Restore this setting to debug failures
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import pytest
from IPython.utils.capture import capture_output

from ..manager import start_new_kernel
from .utils import test_env
from jupyter_client.kernelspec import KernelSpecManager
from jupyter_client.kernelspec import NATIVE_KERNEL_NAME
from jupyter_client.kernelspec import NoSuchKernel
from jupyter_client.manager import start_new_kernel

TIMEOUT = 30

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
from jupyter_core import paths
from traitlets.config.loader import Config

from ..manager import _ShutdownStatus
from ..manager import start_new_async_kernel
from ..manager import start_new_kernel
from .utils import AsyncKMSubclass
from .utils import SyncKMSubclass
from jupyter_client import AsyncKernelManager
from jupyter_client import KernelManager
from jupyter_client.manager import _ShutdownStatus
from jupyter_client.manager import start_new_async_kernel
from jupyter_client.manager import start_new_kernel

pjoin = os.path.join

Expand Down Expand Up @@ -56,7 +56,7 @@ def _install_kernel(name="signaltest", extra_env=None):
"argv": [
sys.executable,
"-m",
"jupyter_client.tests.signalkernel",
"tests.signalkernel",
"-f",
"{connection_file}",
],
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
# -----------------------------------------------------------------------------
from .. import localinterfaces
from jupyter_client import localinterfaces


def test_load_ips():
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from tornado.testing import gen_test
from traitlets.config.loader import Config

from ..localinterfaces import localhost
from .utils import AsyncKMSubclass
from .utils import AsyncMKMSubclass
from .utils import install_kernel
Expand All @@ -24,6 +23,7 @@
from .utils import test_env
from jupyter_client import AsyncKernelManager
from jupyter_client import KernelManager
from jupyter_client.localinterfaces import localhost
from jupyter_client.multikernelmanager import AsyncMultiKernelManager
from jupyter_client.multikernelmanager import MultiKernelManager

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
from traitlets import Int
from traitlets import Unicode

from ..connect import KernelConnectionInfo
from ..kernelspec import KernelSpecManager
from ..kernelspec import NoSuchKernel
from ..launcher import launch_kernel
from ..manager import AsyncKernelManager
from ..provisioning import KernelProvisionerBase
from ..provisioning import KernelProvisionerFactory
from ..provisioning import LocalProvisioner
from jupyter_client.connect import KernelConnectionInfo
from jupyter_client.kernelspec import KernelSpecManager
from jupyter_client.kernelspec import NoSuchKernel
from jupyter_client.launcher import launch_kernel
from jupyter_client.manager import AsyncKernelManager
from jupyter_client.provisioning import KernelProvisionerBase
from jupyter_client.provisioning import KernelProvisionerFactory
from jupyter_client.provisioning import LocalProvisioner

pjoin = os.path.join

Expand Down Expand Up @@ -77,7 +77,7 @@ async def wait(self) -> Optional[int]:
async def send_signal(self, signum: int) -> None:
if self.process:
if signum == signal.SIGINT and sys.platform == 'win32':
from ..win_interrupt import send_interrupt
from jupyter_client.win_interrupt import send_interrupt

send_interrupt(self.process.win32_interrupt_event)
return
Expand Down Expand Up @@ -144,7 +144,7 @@ def build_kernelspec(name: str, provisioner: Optional[str] = None) -> None:
'argv': [
sys.executable,
'-m',
'jupyter_client.tests.signalkernel',
'tests.signalkernel',
'-f',
'{connection_file}',
],
Expand Down Expand Up @@ -201,10 +201,10 @@ def akm(request, all_provisioners):
initial_provisioner_map = {
'local-provisioner': ('jupyter_client.provisioning', 'LocalProvisioner'),
'subclassed-test-provisioner': (
'jupyter_client.tests.test_provisioning',
'tests.test_provisioning',
'SubclassedTestProvisioner',
),
'custom-test-provisioner': ('jupyter_client.tests.test_provisioning', 'CustomTestProvisioner'),
'custom-test-provisioner': ('tests.test_provisioning', 'CustomTestProvisioner'),
}


Expand All @@ -217,9 +217,7 @@ def mock_get_all_provisioners() -> List[EntryPoint]:

def mock_get_provisioner(factory, name) -> EntryPoint:
if name == 'new-test-provisioner':
return EntryPoint(
'new-test-provisioner', 'jupyter_client.tests.test_provisioning', 'NewTestProvisioner'
)
return EntryPoint('new-test-provisioner', 'tests.test_provisioning', 'NewTestProvisioner')

if name in initial_provisioner_map:
return EntryPoint(name, initial_provisioner_map[name][0], initial_provisioner_map[name][1])
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _install_kernel(name="problemtest", extra_env=None):
"argv": [
sys.executable,
"-m",
"jupyter_client.tests.problemkernel",
"tests.problemkernel",
"-f",
"{connection_file}",
],
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions jupyter_client/tests/utils.py → tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class AsyncKMSubclass(KMSubclass, AsyncKernelManager):

class MKMSubclass(RecordCallMixin):
def _kernel_manager_class_default(self):
return "jupyter_client.tests.utils.SyncKMSubclass"
return "tests.utils.SyncKMSubclass"

@subclass_recorder
def get_kernel(self, kernel_id):
Expand Down Expand Up @@ -245,12 +245,12 @@ class SyncMKMSubclass(MKMSubclass, MultiKernelManager):
_superclass = MultiKernelManager

def _kernel_manager_class_default(self):
return "jupyter_client.tests.utils.SyncKMSubclass"
return "tests.utils.SyncKMSubclass"


class AsyncMKMSubclass(MKMSubclass, AsyncMultiKernelManager):

_superclass = AsyncMultiKernelManager

def _kernel_manager_class_default(self):
return "jupyter_client.tests.utils.AsyncKMSubclass"
return "tests.utils.AsyncKMSubclass"

0 comments on commit ff85055

Please sign in to comment.