Skip to content

Commit 7239666

Browse files
authored
Add pytest opts and use isort (#762)
* add pytest opts and use isort * fix spelling error
1 parent 4087b98 commit 7239666

File tree

86 files changed

+329
-444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+329
-444
lines changed

.github/workflows/python-tests.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ jobs:
5757
- name: Run the tests
5858
if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(matrix.os, 'windows') }}
5959
run: |
60-
args="-vv -raXs --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered --durations 10 --color=yes --cov-fail-under 70"
60+
args="-vv --cov jupyter_server --cov-branch --cov-report term-missing:skip-covered --cov-fail-under 70"
6161
python -m pytest $args || python -m pytest $args --lf
6262
- name: Run the tests on pypy and windows
6363
if: ${{ startsWith(matrix.python-version, 'pypy') || startsWith(matrix.os, 'windows') }}
6464
run: |
65-
python -m pytest -vv -raXs || python -m pytest -vv -raXs --lf
65+
python -m pytest -vv || python -m pytest -vv --lf
6666
- name: Coverage
6767
run: |
6868
codecov
@@ -88,7 +88,7 @@ jobs:
8888
pip install -r doc-requirements.txt
8989
make html SPHINXOPTS="-W"
9090
91-
test_miniumum_versions:
91+
test_minimum_versions:
9292
name: Test Minimum Versions
9393
timeout-minutes: 20
9494
runs-on: ubuntu-latest
@@ -102,8 +102,7 @@ jobs:
102102
uses: jupyterlab/maintainer-tools/.github/actions/install-minimums@v1
103103
- name: Run the unit tests
104104
run: |
105-
args="-vv -raXs --durations 10 --color=yes"
106-
pytest $args || pytest $args --lf
105+
pytest -vv || pytest -vv --lf
107106
108107
test_prereleases:
109108
name: Test Prereleases
@@ -123,8 +122,7 @@ jobs:
123122
pip check
124123
- name: Run the tests
125124
run: |
126-
args="-vv -raXs --durations 10 --color=yes"
127-
pytest $args || pytest $args --lf
125+
pytest -vv || pytest -vv --lf
128126
129127
make_sdist:
130128
name: Make SDist
@@ -164,5 +162,4 @@ jobs:
164162
- name: Run Test
165163
run: |
166164
cd sdist/test
167-
args="-vv -raXs --durations 10 --color=yes"
168-
pytest $args || pytest $args --lf
165+
pytest -vv || pytest -vv --lf

.pre-commit-config.yaml

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,33 @@
11
repos:
2-
- repo: https://github.com/asottile/reorder_python_imports
3-
rev: v2.7.1
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.1.0
44
hooks:
5-
- id: reorder-python-imports
5+
- id: end-of-file-fixer
6+
- id: check-case-conflict
7+
- id: check-executables-have-shebangs
8+
- id: requirements-txt-fixer
9+
- id: check-added-large-files
10+
- id: check-case-conflict
11+
- id: check-toml
12+
- id: check-yaml
13+
- id: debug-statements
14+
- id: forbid-new-submodules
15+
- id: check-builtin-literals
16+
- id: trailing-whitespace
617

718
- repo: https://github.com/psf/black
819
rev: 22.1.0
920
hooks:
1021
- id: black
1122
args: ["--line-length", "100"]
1223

24+
- repo: https://github.com/PyCQA/isort
25+
rev: 5.10.1
26+
hooks:
27+
- id: isort
28+
files: \.py$
29+
args: [--profile=black]
30+
1331
- repo: https://github.com/pre-commit/mirrors-prettier
1432
rev: v2.5.1
1533
hooks:
@@ -26,22 +44,6 @@ repos:
2644
"flake8-implicit-str-concat==0.2.0",
2745
]
2846

29-
- repo: https://github.com/pre-commit/pre-commit-hooks
30-
rev: v4.1.0
31-
hooks:
32-
- id: end-of-file-fixer
33-
- id: check-case-conflict
34-
- id: check-executables-have-shebangs
35-
- id: requirements-txt-fixer
36-
- id: check-added-large-files
37-
- id: check-case-conflict
38-
- id: check-toml
39-
- id: check-yaml
40-
- id: debug-statements
41-
- id: forbid-new-submodules
42-
- id: check-builtin-literals
43-
- id: trailing-whitespace
44-
4547
- repo: https://github.com/pre-commit/mirrors-eslint
4648
rev: v8.8.0
4749
hooks:

docs/source/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
from pkg_resources import parse_version
2121

22-
2322
HERE = osp.abspath(osp.dirname(__file__))
2423

2524

examples/simple/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from jupyter_packaging import create_cmdclass
44
from setuptools import setup
55

6-
76
VERSION = "0.0.1"
87

98

examples/simple/simple_ext1/application.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
from traitlets import Unicode
44

5-
from .handlers import DefaultHandler
6-
from .handlers import ErrorHandler
7-
from .handlers import ParameterHandler
8-
from .handlers import RedirectHandler
9-
from .handlers import TemplateHandler
10-
from .handlers import TypescriptHandler
11-
from jupyter_server.extension.application import ExtensionApp
12-
from jupyter_server.extension.application import ExtensionAppJinjaMixin
5+
from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
6+
7+
from .handlers import (
8+
DefaultHandler,
9+
ErrorHandler,
10+
ParameterHandler,
11+
RedirectHandler,
12+
TemplateHandler,
13+
TypescriptHandler,
14+
)
1315

1416
DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static")
1517
DEFAULT_TEMPLATE_FILES_PATH = os.path.join(os.path.dirname(__file__), "templates")

examples/simple/simple_ext1/handlers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from jupyter_server.base.handlers import JupyterHandler
2-
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin
3-
from jupyter_server.extension.handler import ExtensionHandlerMixin
2+
from jupyter_server.extension.handler import (
3+
ExtensionHandlerJinjaMixin,
4+
ExtensionHandlerMixin,
5+
)
46
from jupyter_server.utils import url_escape
57

68

examples/simple/simple_ext11/application.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import os
22

33
from simple_ext1.application import SimpleApp1
4-
from traitlets import Bool
5-
from traitlets import observe
6-
from traitlets import Unicode
4+
from traitlets import Bool, Unicode, observe
75

8-
from jupyter_server.serverapp import aliases
9-
from jupyter_server.serverapp import flags
6+
from jupyter_server.serverapp import aliases, flags
107

118
DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "./../simple_ext1/static")
129
DEFAULT_TEMPLATE_FILES_PATH = os.path.join(os.path.dirname(__file__), "./../simple_ext1/templates")

examples/simple/simple_ext2/application.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22

33
from traitlets import Unicode
44

5-
from .handlers import ErrorHandler
6-
from .handlers import IndexHandler
7-
from .handlers import ParameterHandler
8-
from .handlers import TemplateHandler
9-
from jupyter_server.extension.application import ExtensionApp
10-
from jupyter_server.extension.application import ExtensionAppJinjaMixin
5+
from jupyter_server.extension.application import ExtensionApp, ExtensionAppJinjaMixin
6+
7+
from .handlers import ErrorHandler, IndexHandler, ParameterHandler, TemplateHandler
118

129
DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static")
1310
DEFAULT_TEMPLATE_FILES_PATH = os.path.join(os.path.dirname(__file__), "templates")

examples/simple/simple_ext2/handlers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from jupyter_server.base.handlers import JupyterHandler
2-
from jupyter_server.extension.handler import ExtensionHandlerJinjaMixin
3-
from jupyter_server.extension.handler import ExtensionHandlerMixin
2+
from jupyter_server.extension.handler import (
3+
ExtensionHandlerJinjaMixin,
4+
ExtensionHandlerMixin,
5+
)
46
from jupyter_server.utils import url_escape
57

68

jupyter_server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
del os
1515

16-
from ._version import version_info, __version__ # noqa
16+
from ._version import __version__, version_info # noqa
1717

1818

1919
def _cleanup():

0 commit comments

Comments
 (0)