summaryrefslogtreecommitdiff
path: root/tests/util.py
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2018-06-01 08:53:28 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2018-06-01 08:58:53 -0400
commit436f135580521a42f4614ffaa88cb6d47f02fac1 (patch)
tree66d491bc73a8125f624f0f82916eb2408eaad676 /tests/util.py
parentce1bde81ff053ef8bc4567e78b0757ecd4d4aabb (diff)
downloadpycurl-436f135580521a42f4614ffaa88cb6d47f02fac1.tar.gz
Windows compatibility for test suite
Diffstat (limited to 'tests/util.py')
-rw-r--r--tests/util.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/util.py b/tests/util.py
index 3f39891..1a44e83 100644
--- a/tests/util.py
+++ b/tests/util.py
@@ -181,6 +181,18 @@ def only_ipv6(fn):
return decorated
+def only_unix(fn):
+ import nose.plugins.skip
+
+ @functools.wraps(fn)
+ def decorated(*args, **kwargs):
+ if sys.platform == 'win32':
+ raise nose.plugins.skip.SkipTest('Unix only')
+
+ return fn(*args, **kwargs)
+
+ return decorated
+
def guard_unknown_libcurl_option(fn):
'''Converts curl error 48, CURLE_UNKNOWN_OPTION, into a SkipTest
exception. This is meant to be used with tests exercising libcurl
@@ -274,6 +286,5 @@ def with_real_write_file(fn):
@functools.wraps(fn)
def wrapper(*args):
with tempfile.NamedTemporaryFile() as f:
- with open(f.name, 'w+b') as real_f:
- return fn(*(list(args) + [real_f]))
+ return fn(*(list(args) + [f.file]))
return wrapper