Skip to content

Commit 82db1ce

Browse files
committed
more version_info removal
1 parent 86505e4 commit 82db1ce

File tree

6 files changed

+7
-22
lines changed

6 files changed

+7
-22
lines changed

pytest.ini

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
addopts = --durations=10

setup.py

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
print(error, file=sys.stderr)
2020
sys.exit(1)
2121

22-
PY3 = (sys.version_info[0] >= 3)
23-
2422
#-----------------------------------------------------------------------------
2523
# get on with it
2624
#-----------------------------------------------------------------------------

traitlets/config/application.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,8 @@ def start_show_config(self):
363363
if not class_config:
364364
continue
365365
print(classname)
366-
pformat_kwargs = dict(indent=4)
367-
if sys.version_info >= (3,4):
368-
# use compact pretty-print on Pythons that support it
369-
pformat_kwargs['compact'] = True
366+
pformat_kwargs = dict(indent=4, compact=True)
367+
370368
for traitname in sorted(class_config):
371369
value = class_config[traitname]
372370
print(' .{} = {}'.format(

traitlets/config/tests/test_application.py

-4
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,6 @@ def test_flags(self):
285285
app.init_bar()
286286
self.assertEqual(app.bar.enabled, True)
287287

288-
@mark.skipif(sys.version_info < (3, 4),
289-
reason="Missing `contextlib.redirect_stdout` in python < 3.4!")
290288
def test_flags_help_msg(self):
291289
app = MyApp()
292290
stdout = io.StringIO()
@@ -320,8 +318,6 @@ def test_aliases(self):
320318
app.init_foo()
321319
self.assertEqual(app.foo.j, 10)
322320

323-
@mark.skipif(sys.version_info < (3, 4),
324-
reason="Missing `contextlib.redirect_stdout` in python < 3.4!")
325321
def test_aliases_help_msg(self):
326322
app = MyApp()
327323
stdout = io.StringIO()

traitlets/config/tests/test_configurable.py

-4
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ def test_override2(self):
172172
self.assertEqual(c.b, 'and')
173173
self.assertEqual(c.c, 20.0)
174174

175-
@mark.skipif(sys.version_info < (3, ),
176-
reason="Set, Int in py2 get printed as 'set([])', 'Integer'!'")
177175
def test_help(self):
178176
self.assertEqual(MyConfigurable.class_get_help(), mc_help)
179177
self.assertEqual(Foo.class_get_help(), foo_help)
@@ -242,8 +240,6 @@ class MyConf2(Configurable):
242240
self.assertGreater(cls2_cfg.index(defaults_str),
243241
cls2_cfg.index(enum_choices_str))
244242

245-
@mark.skipif(sys.version_info < (3, ),
246-
reason="Unicodes printed with `u` prefix in PY2!'")
247243
def test_generated_config_strenum_comments(self):
248244
help_str = "Many choices."
249245
defaults_str = "Default: 'choice2'"

traitlets/tests/test_traitlets.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -1448,10 +1448,7 @@ class TestObjectName(TraitTestBase):
14481448
_good_values = ["a", "gh", "g9", "g_", "_G", u"a345_"]
14491449
_bad_values = [1, "", u"€", "9g", "!", "#abc", "aj@", "a.b", "a()", "a[0]",
14501450
None, object(), object]
1451-
if sys.version_info[0] < 3:
1452-
_bad_values.append(u"þ")
1453-
else:
1454-
_good_values.append(u"þ") # þ=1 is valid in Python 3 (PEP 3131).
1451+
_good_values.append(u"þ") # þ=1 is valid in Python 3 (PEP 3131).
14551452

14561453

14571454
class DottedObjectNameTrait(HasTraits):
@@ -1463,10 +1460,8 @@ class TestDottedObjectName(TraitTestBase):
14631460
_default_value = "a.b"
14641461
_good_values = ["A", "y.t", "y765.__repr__", "os.path.join", u"os.path.join"]
14651462
_bad_values = [1, u"abc.€", "_.@", ".", ".abc", "abc.", ".abc.", None]
1466-
if sys.version_info[0] < 3:
1467-
_bad_values.append(u"t.þ")
1468-
else:
1469-
_good_values.append(u"t.þ")
1463+
1464+
_good_values.append(u"t.þ")
14701465

14711466

14721467
class TCPAddressTrait(HasTraits):

0 commit comments

Comments
 (0)