diff --git a/.flake8 b/.flake8 index c2ddfb0f9..71cc80e45 100644 --- a/.flake8 +++ b/.flake8 @@ -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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0ba69c2fb..f1e39459f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/pyproject.toml b/pyproject.toml index a88f27e76..4af1b7af0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/jupyter_client/tests/__init__.py b/tests/__init__.py similarity index 100% rename from jupyter_client/tests/__init__.py rename to tests/__init__.py diff --git a/jupyter_client/tests/conftest.py b/tests/conftest.py similarity index 100% rename from jupyter_client/tests/conftest.py rename to tests/conftest.py diff --git a/jupyter_client/tests/problemkernel.py b/tests/problemkernel.py similarity index 100% rename from jupyter_client/tests/problemkernel.py rename to tests/problemkernel.py diff --git a/jupyter_client/tests/signalkernel.py b/tests/signalkernel.py similarity index 100% rename from jupyter_client/tests/signalkernel.py rename to tests/signalkernel.py diff --git a/jupyter_client/tests/test_adapter.py b/tests/test_adapter.py similarity index 100% rename from jupyter_client/tests/test_adapter.py rename to tests/test_adapter.py diff --git a/jupyter_client/tests/test_client.py b/tests/test_client.py similarity index 98% rename from jupyter_client/tests/test_client.py rename to tests/test_client.py index 867749f68..594131b48 100644 --- a/jupyter_client/tests/test_client.py +++ b/tests/test_client.py @@ -7,7 +7,7 @@ import pytest from IPython.utils.capture import capture_output -from ..manager import start_new_kernel +from jupyter_client.manager import start_new_kernel from .utils import test_env from jupyter_client.kernelspec import KernelSpecManager from jupyter_client.kernelspec import NATIVE_KERNEL_NAME diff --git a/jupyter_client/tests/test_connect.py b/tests/test_connect.py similarity index 100% rename from jupyter_client/tests/test_connect.py rename to tests/test_connect.py diff --git a/jupyter_client/tests/test_jsonutil.py b/tests/test_jsonutil.py similarity index 100% rename from jupyter_client/tests/test_jsonutil.py rename to tests/test_jsonutil.py diff --git a/jupyter_client/tests/test_kernelapp.py b/tests/test_kernelapp.py similarity index 100% rename from jupyter_client/tests/test_kernelapp.py rename to tests/test_kernelapp.py diff --git a/jupyter_client/tests/test_kernelmanager.py b/tests/test_kernelmanager.py similarity index 98% rename from jupyter_client/tests/test_kernelmanager.py rename to tests/test_kernelmanager.py index 145373cd9..e5a072334 100644 --- a/jupyter_client/tests/test_kernelmanager.py +++ b/tests/test_kernelmanager.py @@ -15,9 +15,9 @@ 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 jupyter_client.manager import _ShutdownStatus +from jupyter_client.manager import start_new_async_kernel +from jupyter_client.manager import start_new_kernel from .utils import AsyncKMSubclass from .utils import SyncKMSubclass from jupyter_client import AsyncKernelManager @@ -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}", ], diff --git a/jupyter_client/tests/test_kernelspec.py b/tests/test_kernelspec.py similarity index 100% rename from jupyter_client/tests/test_kernelspec.py rename to tests/test_kernelspec.py diff --git a/jupyter_client/tests/test_localinterfaces.py b/tests/test_localinterfaces.py similarity index 92% rename from jupyter_client/tests/test_localinterfaces.py rename to tests/test_localinterfaces.py index 7b6c4a9ad..b371d2f21 100644 --- a/jupyter_client/tests/test_localinterfaces.py +++ b/tests/test_localinterfaces.py @@ -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(): diff --git a/jupyter_client/tests/test_manager.py b/tests/test_manager.py similarity index 100% rename from jupyter_client/tests/test_manager.py rename to tests/test_manager.py diff --git a/jupyter_client/tests/test_multikernelmanager.py b/tests/test_multikernelmanager.py similarity index 99% rename from jupyter_client/tests/test_multikernelmanager.py rename to tests/test_multikernelmanager.py index 0437e5349..1fad3755b 100644 --- a/jupyter_client/tests/test_multikernelmanager.py +++ b/tests/test_multikernelmanager.py @@ -14,7 +14,7 @@ from tornado.testing import gen_test from traitlets.config.loader import Config -from ..localinterfaces import localhost +from jupyter_client.localinterfaces import localhost from .utils import AsyncKMSubclass from .utils import AsyncMKMSubclass from .utils import install_kernel diff --git a/jupyter_client/tests/test_provisioning.py b/tests/test_provisioning.py similarity index 94% rename from jupyter_client/tests/test_provisioning.py rename to tests/test_provisioning.py index de15ea011..d74be112a 100644 --- a/jupyter_client/tests/test_provisioning.py +++ b/tests/test_provisioning.py @@ -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 @@ -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'), } @@ -218,7 +218,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' + 'new-test-provisioner', 'tests.test_provisioning', 'NewTestProvisioner' ) if name in initial_provisioner_map: diff --git a/jupyter_client/tests/test_public_api.py b/tests/test_public_api.py similarity index 100% rename from jupyter_client/tests/test_public_api.py rename to tests/test_public_api.py diff --git a/jupyter_client/tests/test_restarter.py b/tests/test_restarter.py similarity index 99% rename from jupyter_client/tests/test_restarter.py rename to tests/test_restarter.py index 54d8283cd..5e9343130 100644 --- a/jupyter_client/tests/test_restarter.py +++ b/tests/test_restarter.py @@ -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}", ], diff --git a/jupyter_client/tests/test_session.py b/tests/test_session.py similarity index 100% rename from jupyter_client/tests/test_session.py rename to tests/test_session.py diff --git a/jupyter_client/tests/test_ssh.py b/tests/test_ssh.py similarity index 100% rename from jupyter_client/tests/test_ssh.py rename to tests/test_ssh.py diff --git a/jupyter_client/tests/utils.py b/tests/utils.py similarity index 97% rename from jupyter_client/tests/utils.py rename to tests/utils.py index ffaba2e9a..10f54954d 100644 --- a/jupyter_client/tests/utils.py +++ b/tests/utils.py @@ -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): @@ -245,7 +245,7 @@ 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): @@ -253,4 +253,4 @@ class AsyncMKMSubclass(MKMSubclass, AsyncMultiKernelManager): _superclass = AsyncMultiKernelManager def _kernel_manager_class_default(self): - return "jupyter_client.tests.utils.AsyncKMSubclass" + return "tests.utils.AsyncKMSubclass"