Skip to content

Commit

Permalink
Added skip for OrderedDict on Py26
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Nov 18, 2015
1 parent 7d05836 commit 5947daa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source =
plumbum
omit =
*ipython*.py
__main__.py
*__main__.py

[report]
exclude_lines =
Expand Down
14 changes: 13 additions & 1 deletion tests/test_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
import sys
import time
from contextlib import contextmanager
from collections import OrderedDict

from plumbum.cli.terminal import ask, choose, prompt, hexdump, Progress
from plumbum.lib import StringIO

try:
from collections import OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict
except ImportError:
OrderedDict = None
needs_od = pytest.mark.skipif(OrderedDict is None,
reason="Ordered dict not available (Py 2.6)")

@contextmanager
def send_stdin(stdin = "\n"):
prevstdin = sys.stdin
Expand Down Expand Up @@ -75,6 +84,8 @@ def test_choose_dict(self):
value = choose("Pick", dict(one="a",two="b"))
assert value in ("a","b")

@needs_od
def test_ordered_dict(self):
dic = OrderedDict()
dic["one"] = "a"
dic["two"] = "b"
Expand All @@ -85,6 +96,7 @@ def test_choose_dict(self):
value = choose("Pick", dic)
assert value == "b"

@needs_od
def test_choose_dict_default(self, capsys):
dic = OrderedDict()
dic["one"] = "a"
Expand Down

0 comments on commit 5947daa

Please sign in to comment.