Skip to content

Commit d0a9291

Browse files
authored
Merge pull request #16 from RazerM/isort
Add isort to CI
2 parents fd13d87 + 64b126a commit d0a9291

File tree

9 files changed

+44
-16
lines changed

9 files changed

+44
-16
lines changed

ci/travis.sh

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,11 @@ fi
5353

5454
pip install -U pip setuptools wheel
5555

56+
python setup.py sdist --formats=zip
57+
pip install dist/*.zip
58+
5659
if [ "$CHECK_FORMATTING" = "1" ]; then
57-
pip install yapf==${YAPF_VERSION}
60+
pip install yapf==${YAPF_VERSION} isort
5861
if ! yapf -rpd setup.py src tests; then
5962
cat <<EOF
6063
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -67,6 +70,27 @@ Formatting problems were found (listed above). To fix them, run
6770
6871
in your local checkout.
6972
73+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
74+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
75+
EOF
76+
exit 1
77+
fi
78+
79+
# required for isort to order test imports correctly
80+
pip install -Ur test-requirements.txt
81+
82+
if ! isort --recursive --check-only --diff . ; then
83+
cat <<EOF
84+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
85+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
86+
87+
Formatting problems were found (listed above). To fix them, run
88+
89+
pip install isort
90+
isort --recursive .
91+
92+
in your local checkout.
93+
7094
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7195
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7296
EOF
@@ -75,9 +99,6 @@ EOF
7599
exit 0
76100
fi
77101

78-
python setup.py sdist --formats=zip
79-
pip install dist/*.zip
80-
81102
if [ "$CHECK_DOCS" = "1" ]; then
82103
pip install -Ur ci/rtd-requirements.txt
83104
cd docs

setup.cfg

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
[bdist_wheel]
2-
universal=1
2+
universal = 1
3+
4+
[isort]
5+
multi_line_output = 4
6+
skip = ./build, ./docs
7+
not_skip = __init__.py
8+
# ci/travis.sh installs outcome normally, so isort assumes it's third party
9+
known_first_party = outcome

setup.py

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

44
from io import open
55

6-
from setuptools import setup, find_packages
6+
from setuptools import find_packages, setup
77

88
version = dict()
99

src/outcome/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
"""Top-level package for outcome."""
33
from __future__ import absolute_import, division, print_function
44

5-
from ._version import __version__
6-
75
import sys
86

7+
from ._util import AlreadyUsedError, fixup_module_metadata
8+
from ._version import __version__
9+
910
if sys.version_info >= (3, 5):
1011
from ._async import Error, Outcome, Value, acapture, capture
1112
__all__ = (
@@ -15,6 +16,5 @@
1516
from ._sync import Error, Outcome, Value, capture
1617
__all__ = ('Error', 'Outcome', 'Value', 'capture', 'AlreadyUsedError')
1718

18-
from ._util import fixup_module_metadata, AlreadyUsedError
1919
fixup_module_metadata(__name__, globals())
2020
del fixup_module_metadata

src/outcome/_async.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import abc
22

3-
from ._sync import (
4-
Error as ErrorBase, Outcome as OutcomeBase, Value as ValueBase
5-
)
3+
from ._sync import Error as ErrorBase
4+
from ._sync import Outcome as OutcomeBase
5+
from ._sync import Value as ValueBase
66

7-
from ._util import AlreadyUsedError
87
__all__ = ['Error', 'Outcome', 'Value', 'acapture', 'capture']
98

109

src/outcome/_sync.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import absolute_import, division, print_function
33

44
import abc
5+
56
import attr
67

78
from ._util import ABC, AlreadyUsedError

src/outcome/_util.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from __future__ import absolute_import, division, print_function
33

44
import abc
5-
65
import sys
76

87

tests/test_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from async_generator import async_generator, yield_
66

77
import outcome
8-
from outcome import Error, Value, AlreadyUsedError
8+
from outcome import AlreadyUsedError, Error, Value
99

1010
pytestmark = pytest.mark.trio
1111

tests/test_sync.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# coding: utf-8
22
from __future__ import absolute_import, division, print_function
3+
34
import sys
45

56
import pytest
67

78
import outcome
8-
from outcome import Error, Value, AlreadyUsedError
9+
from outcome import AlreadyUsedError, Error, Value
910

1011

1112
def test_Outcome():

0 commit comments

Comments
 (0)