File: nose.patch

package info (click to toggle)
influxdb-python 5.3.2-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,576 kB
  • sloc: python: 7,274; makefile: 5
file content (127 lines) | stat: -rw-r--r-- 3,489 bytes parent folder | download | duplicates (2)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Description: remove usage of deprecated Nose
Author: Alexandre Detiste <tchet@debian.org>
Forwarded: no, project is archived

--- a/influxdb/tests/client_test.py
+++ b/influxdb/tests/client_test.py
@@ -32,7 +32,27 @@
 import requests.exceptions
 import requests_mock
 
-from nose.tools import raises
+from functools import wraps
+
+def raises(*exceptions):
+    valid = ' or '.join([e.__name__ for e in exceptions])
+
+    def decorate(func):
+        name = func.__name__
+        def newfunc(*arg, **kw):
+            try:
+                func(*arg, **kw)
+            except exceptions:
+                pass
+            except:
+                raise
+            else:
+                message = "%s() did not raise %s" % (name, valid)
+                raise AssertionError(message)
+        newfunc = wraps(func)(newfunc)
+        return newfunc
+    return decorate
+
 from urllib3.connection import HTTPConnection
 
 from influxdb import InfluxDBClient
--- a/influxdb/tests/dataframe_client_test.py
+++ b/influxdb/tests/dataframe_client_test.py
@@ -13,7 +13,27 @@
 import warnings
 import requests_mock
 
-from nose.tools import raises
+from functools import wraps
+
+def raises(*exceptions):
+    valid = ' or '.join([e.__name__ for e in exceptions])
+
+    def decorate(func):
+        name = func.__name__
+        def newfunc(*arg, **kw):
+            try:
+                func(*arg, **kw)
+            except exceptions:
+                pass
+            except:
+                raise
+            else:
+                message = "%s() did not raise %s" % (name, valid)
+                raise AssertionError(message)
+        newfunc = wraps(func)(newfunc)
+        return newfunc
+    return decorate
+
 from influxdb.tests import skip_if_pypy, using_pypy
 
 from .client_test import _mocked_session
--- a/influxdb/tests/influxdb08/client_test.py
+++ b/influxdb/tests/influxdb08/client_test.py
@@ -13,7 +13,27 @@
 import requests.exceptions
 import requests_mock
 
-from nose.tools import raises
+from functools import wraps
+
+def raises(*exceptions):
+    valid = ' or '.join([e.__name__ for e in exceptions])
+
+    def decorate(func):
+        name = func.__name__
+        def newfunc(*arg, **kw):
+            try:
+                func(*arg, **kw)
+            except exceptions:
+                pass
+            except:
+                raise
+            else:
+                message = "%s() did not raise %s" % (name, valid)
+                raise AssertionError(message)
+        newfunc = wraps(func)(newfunc)
+        return newfunc
+    return decorate
+
 from mock import patch
 
 from influxdb.influxdb08 import InfluxDBClient
--- a/influxdb/tests/influxdb08/dataframe_client_test.py
+++ b/influxdb/tests/influxdb08/dataframe_client_test.py
@@ -10,7 +10,26 @@
 
 import requests_mock
 
-from nose.tools import raises
+from functools import wraps
+
+def raises(*exceptions):
+    valid = ' or '.join([e.__name__ for e in exceptions])
+
+    def decorate(func):
+        name = func.__name__
+        def newfunc(*arg, **kw):
+            try:
+                func(*arg, **kw)
+            except exceptions:
+                pass
+            except:
+                raise
+            else:
+                message = "%s() did not raise %s" % (name, valid)
+                raise AssertionError(message)
+        newfunc = wraps(func)(newfunc)
+        return newfunc
+    return decorate
 
 from influxdb.tests import skip_if_pypy, using_pypy