File: only-one-conftest.patch

package info (click to toggle)
python-graphviz 0.20.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,188 kB
  • sloc: python: 4,098; makefile: 13
file content (54 lines) | stat: -rw-r--r-- 1,551 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Author: Diane Trout <diane@ghic.org>
Description: pytest gets confused with two conftest.py files and
 generates an "import file mismatch" error.
 This merges the contents so there's only one conftest.py file to find.
Bugs: https://github.com/xflr6/graphviz/issues/219
--- a/tests/backend/conftest.py
+++ /dev/null
@@ -1,22 +0,0 @@
-"""pytest fixtures for backend."""
-
-import pytest
-
-
-@pytest.fixture
-def mock_run(mocker):
-    yield mocker.patch('subprocess.run', autospec=True)
-
-
-@pytest.fixture
-def mock_popen(mocker):
-    yield mocker.patch('subprocess.Popen', autospec=True)
-
-
-@pytest.fixture
-def mock_startfile(mocker, platform):
-    if platform == 'windows':
-        kwargs = {'autospec': True}
-    else:
-        kwargs = {'create': True, 'new_callable': mocker.Mock}
-    yield mocker.patch('os.startfile', **kwargs)
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -98,3 +98,21 @@
 def unknown_platform(monkeypatch, name='nonplatform'):
     monkeypatch.setattr('graphviz.backend.viewing.PLATFORM', name)
     yield name
+
+@pytest.fixture
+def mock_run(mocker):
+    yield mocker.patch('subprocess.run', autospec=True)
+
+
+@pytest.fixture
+def mock_popen(mocker):
+    yield mocker.patch('subprocess.Popen', autospec=True)
+
+
+@pytest.fixture
+def mock_startfile(mocker, platform):
+    if platform == 'windows':
+        kwargs = {'autospec': True}
+    else:
+        kwargs = {'create': True, 'new_callable': mocker.Mock}
+    yield mocker.patch('os.startfile', **kwargs)