Skip to content

Commit 073fa20

Browse files
committed
test: use unittest.mock when available
The mock module is no longer required in Python 3.3 as unittest now has a mock module. This patch keeps older versions of Python compatible.
1 parent 333fbcb commit 073fa20

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

dev-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
coverage
22
codecov
3-
mock
3+
mock; python_version < '3.3'
44
nose
55
setuptools-scm

test/test_unix_connect.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
import sys
77
import unittest
88

9-
from mock import patch
9+
try:
10+
from unittest.mock import patch
11+
except ImportError:
12+
from mock import patch
1013

1114
from Xlib.support import unix_connect
1215
from Xlib.error import DisplayConnectionError, DisplayNameError

0 commit comments

Comments
 (0)