python-python-xlib/remove-mock.patch

46 lines
1.2 KiB
Diff

From 8bab50254d78370398dcbdf247d59976b866c27f Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Sat, 12 Dec 2020 00:57:16 +0100
Subject: [PATCH 1/2] remove mock from dev-requirments
---
dev-requirements.txt | 1 -
1 file changed, 1 deletion(-)
diff --git a/dev-requirements.txt b/dev-requirements.txt
index b2f5288..22fc710 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,5 +1,4 @@
coverage
codecov
-mock
nose
setuptools-scm
From 4c08116d51e2b2b2bc53d01ee8dd9698793cad5d Mon Sep 17 00:00:00 2001
From: Ben Greiner <code@bnavigator.de>
Date: Sat, 12 Dec 2020 00:58:19 +0100
Subject: [PATCH 2/2] Use mock from standard lib if possible
---
test/test_unix_connect.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/test/test_unix_connect.py b/test/test_unix_connect.py
index 7680ba5..36abede 100644
--- a/test/test_unix_connect.py
+++ b/test/test_unix_connect.py
@@ -6,7 +6,10 @@
import sys
import unittest
-from mock import patch
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
from Xlib.support import unix_connect
from Xlib.error import DisplayConnectionError, DisplayNameError