Show More
@@ -19,7 +19,11 b' import random' | |||||
19 | import sys |
|
19 | import sys | |
20 |
|
20 | |||
21 | import nose.tools as nt |
|
21 | import nose.tools as nt | |
22 | import path |
|
22 | try: | |
|
23 | from pathlib import Path | |||
|
24 | except ImportError: | |||
|
25 | # Python 2 backport | |||
|
26 | from pathlib2 import Path | |||
23 |
|
27 | |||
24 | from IPython.utils import text |
|
28 | from IPython.utils import text | |
25 |
|
29 | |||
@@ -207,7 +211,7 b' def test_LSString():' | |||||
207 | nt.assert_equal(lss.l, ['abc', 'def']) |
|
211 | nt.assert_equal(lss.l, ['abc', 'def']) | |
208 | nt.assert_equal(lss.s, 'abc def') |
|
212 | nt.assert_equal(lss.s, 'abc def') | |
209 | lss = text.LSString(os.getcwd()) |
|
213 | lss = text.LSString(os.getcwd()) | |
210 |
nt.assert_is_instance(lss.p[0], |
|
214 | nt.assert_is_instance(lss.p[0], Path) | |
211 |
|
215 | |||
212 | def test_SList(): |
|
216 | def test_SList(): | |
213 | sl = text.SList(['a 11', 'b 1', 'a 2']) |
|
217 | sl = text.SList(['a 11', 'b 1', 'a 2']) |
@@ -14,6 +14,11 b' import re' | |||||
14 | import sys |
|
14 | import sys | |
15 | import textwrap |
|
15 | import textwrap | |
16 | from string import Formatter |
|
16 | from string import Formatter | |
|
17 | try: | |||
|
18 | from pathlib import Path | |||
|
19 | except ImportError: | |||
|
20 | # Python 2 backport | |||
|
21 | from pathlib2 import Path | |||
17 |
|
22 | |||
18 | from IPython.testing.skipdoctest import skip_doctest_py3, skip_doctest |
|
23 | from IPython.testing.skipdoctest import skip_doctest_py3, skip_doctest | |
19 | from IPython.utils import py3compat |
|
24 | from IPython.utils import py3compat | |
@@ -64,11 +69,10 b' class LSString(str):' | |||||
64 | n = nlstr = property(get_nlstr) |
|
69 | n = nlstr = property(get_nlstr) | |
65 |
|
70 | |||
66 | def get_paths(self): |
|
71 | def get_paths(self): | |
67 | from path import path |
|
|||
68 | try: |
|
72 | try: | |
69 | return self.__paths |
|
73 | return self.__paths | |
70 | except AttributeError: |
|
74 | except AttributeError: | |
71 |
self.__paths = [ |
|
75 | self.__paths = [Path(p) for p in self.split('\n') if os.path.exists(p)] | |
72 | return self.__paths |
|
76 | return self.__paths | |
73 |
|
77 | |||
74 | p = paths = property(get_paths) |
|
78 | p = paths = property(get_paths) | |
@@ -123,11 +127,10 b' class SList(list):' | |||||
123 | n = nlstr = property(get_nlstr) |
|
127 | n = nlstr = property(get_nlstr) | |
124 |
|
128 | |||
125 | def get_paths(self): |
|
129 | def get_paths(self): | |
126 | from path import path |
|
|||
127 | try: |
|
130 | try: | |
128 | return self.__paths |
|
131 | return self.__paths | |
129 | except AttributeError: |
|
132 | except AttributeError: | |
130 |
self.__paths = [ |
|
133 | self.__paths = [Path(p) for p in self if os.path.exists(p)] | |
131 | return self.__paths |
|
134 | return self.__paths | |
132 |
|
135 | |||
133 | p = paths = property(get_paths) |
|
136 | p = paths = property(get_paths) |
@@ -182,7 +182,7 b' extras_require = dict(' | |||||
182 | parallel = ['ipyparallel'], |
|
182 | parallel = ['ipyparallel'], | |
183 | qtconsole = ['qtconsole'], |
|
183 | qtconsole = ['qtconsole'], | |
184 | doc = ['Sphinx>=1.3'], |
|
184 | doc = ['Sphinx>=1.3'], | |
185 |
test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments' |
|
185 | test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments'], | |
186 | terminal = [], |
|
186 | terminal = [], | |
187 | kernel = ['ipykernel'], |
|
187 | kernel = ['ipykernel'], | |
188 | nbformat = ['nbformat'], |
|
188 | nbformat = ['nbformat'], | |
@@ -205,6 +205,7 b' install_requires = [' | |||||
205 | # but requires pip >= 6. pip < 6 ignores these. |
|
205 | # but requires pip >= 6. pip < 6 ignores these. | |
206 |
|
206 | |||
207 | extras_require.update({ |
|
207 | extras_require.update({ | |
|
208 | ':python_version == "2.7" or python_version == "3.3"': ['pathlib2'], | |||
208 | ':sys_platform != "win32"': ['pexpect'], |
|
209 | ':sys_platform != "win32"': ['pexpect'], | |
209 | ':sys_platform == "darwin"': ['appnope'], |
|
210 | ':sys_platform == "darwin"': ['appnope'], | |
210 | ':sys_platform == "win32"': ['colorama'], |
|
211 | ':sys_platform == "win32"': ['colorama'], |
General Comments 0
You need to be logged in to leave comments.
Login now