diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-03-04 00:03:23 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-03-04 00:03:23 -0500 |
commit | 201e8e5619c8e755936de98adea4a0ea6e8d6776 (patch) | |
tree | 50e18d7c547e121d05a3a6a756da0d658351f651 /test_six.py | |
parent | 91d80756e350a002cdfdba2254d4f35a806e7b65 (diff) | |
download | six-201e8e5619c8e755936de98adea4a0ea6e8d6776.tar.gz |
gracefully handle systems without tkinter (fixes #20)
Diffstat (limited to 'test_six.py')
-rw-r--r-- | test_six.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test_six.py b/test_six.py index afe98b4..f4a12c8 100644 --- a/test_six.py +++ b/test_six.py @@ -77,6 +77,13 @@ def test_lazy(): assert "htmlparser" not in six._MovedItems.__dict__ +try: + import _tkinter +except ImportError: + have_tkinter = False +else: + have_tkinter = True + @py.test.mark.parametrize("item_name", [item.name for item in six._moved_attributes]) def test_move_items(item_name): @@ -86,7 +93,7 @@ def test_move_items(item_name): except ImportError: if item_name == "winreg" and not sys.platform.startswith("win"): py.test.skip("Windows only module") - if "_tkinter" in str(sys.exc_info()[1]): + if item_name.startswith("tkinter") and not have_tkinter: py.test.skip("requires tkinter") raise |